-->
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.  [ 3 posts ] 
Author Message
 Post subject: custom Identifier Generator
PostPosted: Thu Mar 22, 2007 3:32 am 
Newbie

Joined: Fri Jan 26, 2007 10:13 pm
Posts: 9
Hibernate version: 3.2.2 GA

We are using an hibernate custom generator to generate primary key values for all tables in the application.

We are working with a legacy database schema and the custom id generator retrieves an integer value from a table in the database and uses that value to generate the primary key after applying a customized logic to the integer value.

As part of a new requirement, we have to make this primary key generation logic user-specific, i.e. each user of the system will have there own integer value saved in a database table. The primary key generation will take place based on the user adding new records to the application. Thereafter, the integer value will be incremented by 1.

The user name is available after the user logs in to the application. I did not find any mechanism to pass the user name information or any values retrieved at runtime to the id generator interfaces provided by hibernate.

Can this be taken care within the custom id generator?

Any help will be appreciated!!

Hitesh


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 3:51 am 
Regular
Regular

Joined: Sun Aug 01, 2004 6:49 pm
Posts: 76
I really don't know, but perhaps an interceptor could be helpful. You should look at this.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 3:55 am 
Regular
Regular

Joined: Sun Aug 01, 2004 6:49 pm
Posts: 76
To be more clear how it could work with the interceptor: First a custom generator could be used without the user information and afterwards the id could be modified again with the user information passed to it among the other data.

HTH
Thomas


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