| Author |
the best way to generate the primary key for entity bean
|
zb cong
Ranch Hand
Joined: Jan 14, 2002
Posts: 403
|
|
hello i am the beginner to entity bean,and usually use the toplink as the o-r mapping tool.it can generate the unique primary key automatically for me,i don't need to worry about it. now i transfer to entity bean,i found that i must generate the pk in my code(if i use the integer id as primary key),then invoke the "create" method to insert a record to database,but how can i keep the id unique? who can introduce me the best mechanism to generate pk for the entity bean? thank you very much!
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
http://www.theserverside.com//patterns/thread.jsp?thread_id=4228 http://www-106.ibm.com/developerworks/java/library/j-ejbdesign.html
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
Andres Gonzalez
Ranch Hand
Joined: Nov 27, 2001
Posts: 1561
|
|
Have a look at EJB design patterns, by floyd marinescu. You can find a free PDF copy of the book at www.theserverside.com. It's got different patterns on how to generate keys.
|
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
|
 |
 |
|
|
subject: the best way to generate the primary key for entity bean
|
|
|