File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pimary keys in entity beans

 
shawn kennedy
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when is a duplicate primary key exception thrown?
Can 2 entity bean instances access the same primary key.If not why?
Can different instances of the same entity bean access the same primary key?
Bit confused regarding this please explain
 
Sergiu Truta
Ranch Hand
Posts: 121
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, an exception is thrown when trying to insert a record inside the database and there already is a record with that primary key.
2 entity beans will access the same primary key in a clustered environment. Inside a single application server there will not be two beans representing the same record, though this might depend on the applications server.
 
shawn kennedy
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could u pls explainur reply in detail as to why in a clustered envo the same data can be accessed and y does it depend on app servers as to the data being accessed is same or not
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is DuplicateKeyException thrown even when there are no database constraints on the table. Say there is a primary key for a table, but has no unique constraint.....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic