aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Composite primary key problem in Entity Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Composite primary key problem in Entity Bean" Watch "Composite primary key problem in Entity Bean" New topic
Author

Composite primary key problem in Entity Bean

Mahendran Aiyappan
Ranch Hand

Joined: Sep 05, 2005
Posts: 102
Hello Sir,

Suppose i have a table named purchase_order(po_id,item_id,po_date,desc,...)
in this i am assuming that i have a composite primary key (po_id,item_id). Whether this kind of composite primary key the entity bean support. What i am asking is in ejbFindByPrimaryKey method is returning only an object. Whether this is possible or i have to normalize the table.

What is your suggestion.

Thanks
Vinay Raj
Ranch Hand

Joined: Jun 19, 2006
Posts: 81
Composite primary keys are supported in entity beans. You will have to define a class which holds all the attributes of the primary key. For details regarding the rules to be followed in defining such a key refer EJB specifications.
Mahendran Aiyappan
Ranch Hand

Joined: Sep 05, 2005
Posts: 102
Thank you for kind idea

But sorry sir I don't know where EJB Specification. Can you provide me the exact link and if any examples would be marvalous.

Once again Thanks
Vinay Raj
Ranch Hand

Joined: Jun 19, 2006
Posts: 81
Refer link for EJB specifications. A sample JBoss example is available at this link.
Dude you can get this info on google.
Mahendran Aiyappan
Ranch Hand

Joined: Sep 05, 2005
Posts: 102
Thank you very much sir that example is very useful to me.
 
 
subject: Composite primary key problem in Entity Bean