• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

primary key

 
sonali rao
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a Primary key maps to multiple fields in the Entity bean class then how is the <primkey-field> specified in the deployment descriptor.
 
Thomas De Vos
stable boy
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The primkey-field element is not used if the primary key maps to multiple
container-managed fields.
You will use the <prim-key-class> for compound keys.
 
sonali rao
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still confused.
What if there are 3 fields in the database which are of type String and I want to used 2 of the fields as compound primary key.
How will I mention that in the deployment descriptor using <prim-key-class>
 
Sudhir V
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you will make a new class with the two fields as its instance variables and write that class name in the <prim-key-class>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic