[jboss-user] [JBoss Seam] - How to use @Id @GeneratedValue(strategy=GenerationType.AUTO)
tonylmai
do-not-reply at jboss.com
Thu Mar 1 13:12:10 EST 2007
My apology for posting the following Persistent/Hibernate question on this board. I had posted it on the Persistent/Hibernate forum but found myself visit this forum more frequent than others.
The question is: How does an ID declared as @Id @GeneratedValue(strategy=GenerationType.AUTO) get generated?
Say I have a simple entity with 2 attributes id and message. I don't want to worry about generating an unique ID for this record so I think would like to declare attribute id with @Id @GeneratedValue(strategy=GenerationType.AUTO).
Can I create a new object of this class with just the message and let Hibernate create the id? In the database end, do I create the table for this entity with column id declared as bigint?
Thanks in advance for your help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024409#4024409
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024409
More information about the jboss-user
mailing list