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
|