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.  [ 4 posts ] 
Author Message
 Post subject: wrong primary keys from MultipleHiLoPerTableGenerator
PostPosted: Mon Nov 07, 2005 6:26 pm 
Newbie

Joined: Mon Nov 07, 2005 6:11 pm
Posts: 6
Hibernate version: 3.05

Mapping documents:

<generator class="org.hibernate.id.MultipleHiLoPerTableGenerator">
<param name="table">hmmtb_next_id</param>
<param name="primary_key_column">nxt_pk_col</param>
<param name="value_column">nxt_pk_value</param>
<param name="primary_key_value">item_id</param>
<param name="primary_key_length">30</param>
</generator>

Name and version of the database you are using: Sybase 12.5

When I insert a new record for any class mapped with the generator specified as above I am getting incorrect primary key values assigned. The key for each record is (32768 x correct value). So if the correct value should be 1 the assigned pk is 32768. The next record's pk becomes 65536, then 98304, etc. The hi value updated in the next id table is correct.

I found if I changed this line:

Code:
maxLo = PropertiesHelper.getInt(MAX_LO, params, Short.MAX_VALUE);


to:

Code:
maxLo = 0;


the generator works fine. Am I doing something stupid, or is this a bug in the generator for Sybase?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 6:28 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
define the max_lo property to 1 to get this feature.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: thanks
PostPosted: Wed Nov 16, 2005 12:52 am 
Newbie

Joined: Mon Nov 07, 2005 6:11 pm
Posts: 6
Adding the max_lo parameter worked. Thanks. I didn't have that parameter because the javadoc for the MultipleHiLoPerTableGenerator doesn't say that is an allowed parameter. Hopefully that will get updated at some point.

jh


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 16, 2005 7:10 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I've updated the JavaDoc

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.