-->
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.  [ 1 post ] 
Author Message
 Post subject: How do Hibernate managed sequences work ( native ) - anyone?
PostPosted: Wed Sep 14, 2011 12:50 am 
Newbie

Joined: Wed Sep 14, 2011 12:36 am
Posts: 4
We have a PostgreSQL database (8.x & 9.x) using Hibernate 3.3.2 - older proprietary style with .hbm.xml files and are using hibernate managed sequences.

If the app/db is shut down, where does hibernate store the meta-data? how does it know what the nextval is on startup?

For a sequence created in the DB, the DB manages/stores the sequence, but if we use a sequence in a .hbm.xml file like this:

<id name="id" column="id" >
<generator class="native"></generator>
</id>

Where does hibernate keep track of numbers? any way to see the ordering of this? and if the app is shut down and starts up, where does it store/keep the max number to start sequencing again when the app starts up?

I have read that there is no guarantee of sequential order of id's for database id's (we are using for primary keys).

the problem is that we are hitting the upper limit every three months running out of primary keys hitting the int limit ( +2147483647 ).

This indicates a consumption of millions of records per day but we have no idea where this is coming from except some probable bug in Hibernate that is skipping sequence numbers by the hundreds of thousands or millions at a time.

any ideas?


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

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.