[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Multiple Generators in one entity
do-not-reply at jboss.com
Wed Sep 19 12:27:27 EDT 2007
Is there any way to reference multiple @TableGenerator or @SequenceGenerator annotations in an entity?
I have a use case where I am using one table to generator primary key values for all my entities. For two entities, I wish to to generate a business key (serial number). The number is not really important but I don't want it to grow as fast as it would if I used the primary key generator.
I am using @TableGenerator in testing with HSQLDB but will switch to @SequenceGenerator when I move to production (Oracle).
If this is not possible, is there some other way I can generate business keys that increment? (Gaps in the numbers are not really important)
Or if possible generate unique random numbers?
Ultimately the business key will be something like mm-dd-yyyy-xxxx or aaa-xxxx where xxxx is the number generated and prefixed either with a date string or with some alpha numeric value like a department number.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086227#4086227
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086227
More information about the jboss-user