-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Oracle Sequence Issues...
PostPosted: Tue Aug 01, 2006 4:38 am 
Newbie

Joined: Tue Aug 01, 2006 4:17 am
Posts: 8
Hibernate version:3.1.3

Mapping documents:

Here is the mapping of the Auto-Generated ID column of my object...

Code:
<id name="applicationId" type="long">
    <column name="APPL_ID" precision="10" scale="0" />
    <generator class="sequence">
        <param name="sequence">NB_GENERIC_SEQ</param>
    </generator>
</id>


When I try to run the validation of the configuration I get this error...

10:28:59,208 INFO DatabaseMetadata:91 - table not found: NB_GENERIC_SEQ

Name and version of the database you are using: Oracle 9i

It seems that it cannot resolve the Sequence in the DB, however executing SELECT NB_GENERIC_SEQ.nextval FROM dual works fine...

Is there anything I'm missing here?


Top
 Profile  
 
 Post subject: Oracle Sequence Issues...
PostPosted: Tue Aug 01, 2006 3:41 pm 
Newbie

Joined: Sun Jun 18, 2006 1:58 pm
Posts: 6
I guess, the schema name is missing, specify the schema at the top level.

<hibernate-mapping
schema="SCHEMA_NAME"
>



---------
Don't forget to rate! (if the answer helped)


Top
 Profile  
 
 Post subject: Still No Luck with Oracle
PostPosted: Wed Aug 02, 2006 3:27 am 
Newbie

Joined: Tue Aug 01, 2006 4:17 am
Posts: 8
That didn't fix the problem, both as a declaration in the XML as well as specifying the schema in the sequence name...

Code:
09:14:22,014  INFO DatabaseMetadata:91 - table not found:NB.NB_GENERIC_SEQ
09:14:22,032  INFO DatabaseMetadata:91 - table not found: NB_GENERIC_SEQ


The fact that it is looking for it as a table is somewhat concerning.

The reason I asked in this forum is because this works perfectly in my unit tests using hsqdb and the hibernate.hbm2ddl.auto=create option. I did see an article somewhere where they actually extended a hibernate class to add sequence fetching capabilities, but I don't want to get involved at that level, I just want it to work :)

[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 02, 2006 9:13 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Can you show us the sql hibernate generates ?

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 11:19 am 
Newbie

Joined: Tue Nov 15, 2005 8:27 pm
Posts: 19
Location: Columbia, MO USA
I'm having the same problem with PostgreSQL 8.1 and Hibernate 3.1.3. When I have a mapping file that looks like this:

Code:
<hibernate-mapping schema="compulink" package="com.compulink.rbims.model">
   <class name="User" table="User">
      <id name="id" column="UserID" type="long">
         <generator class="sequence">
            <param name="sequence">user_seq</param>
         </generator>
      </id>
...
</hibernate-mapping>


I get the following errors when I set the hbm2ddl.auto property to update in my hibernate.cfg.xml file:

Code:
INFO DatabaseMetadata:91 - table not found: compulink.user_seq
INFO DatabaseMetadata:91 - table not found: user_seq
DEBUG SchemaUpdate:149 - create sequence compulink.user_seq
ERROR SchemaUpdate:155 - Unsuccessful: create sequence compulink.user_seq
ERROR SchemaUpdate:156 - ERROR: relation "user_seq" already exists


Any ideas how to fix this?

Bruce


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.