File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Problem with Hibernate generator increment Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Problem with Hibernate generator increment" Watch "Problem with Hibernate generator increment" New topic
Author

Problem with Hibernate generator increment

markus lehrhuber
Greenhorn

Joined: Jul 06, 2007
Posts: 6
Hi,

i have a problem with using the hibernate generator increment for a pk generation.

the code of the *.hbm.xml looks like this and in the pojo the passowordId is defined as Long also the getters and setters are defined right.



The attribute in the oracle db is defined as Number(11);

If a new row is inserted in the database a very long number is inserted which is not the next value to those which are already stored in the DB.

On debugging the code, the value which is set in the pojo by hibernate is the right one which is not corresponding to the value set in database.

Whats going wrong??
Thanks for any help!
markus lehrhuber
Greenhorn

Joined: Jul 06, 2007
Posts: 6
This behaviour is detectable on all generators

although the log says that the right value is assigned to the parameter:

2007-07-26 14:43:45,796 DEBUG [org.hibernate.type.LongType] binding '321' to parameter: 1


a number like 100000000000000345 is written to the database.

I am using hibernate3 (3.2.4.sp1) on JBOSS.
 
 
subject: Problem with Hibernate generator increment
 
Threads others viewed
hibernate primary key mapping - sequence
Could not synchronize database state with session
why my oracle sequence id increases by 2 when I use hibernate to insert
data inserting problem
Hibernate Basic Error -
jQuery in Action, 2nd edition