Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

complex primary key with EJB 3.0  RSS feed

 
Gerald Holl
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

Does anybody know if complex primary keys (in my case the primary key consists of two keys, varchar and an integer) are supported in EJB 3.0?

My database schema contains some mapping tables and so I have to use complex primary keys that consists of two unique keys (as mentioned above).


Thanks,
Gerald
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, some terminology: a primary key made up from more than one field is called a composite key. Also, the two fields involved in the composite key are not keys in their own right - otherwise, why bother with the composite key?

To answer your question, yes. Composite keys are mentioned in the latest Early Draft of the EJB3.0 Persistence Spec. If you need to know more, the best way tofind out is to read the drafts of the Spec. found here.
 
Gerald Holl
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the explanation, I had some troubles translating it into english.

I think it would be better to use a ManyToMany relation instead of creating the mapping table myself.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!