wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Forigen key to Composit primary Key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Forigen key to Composit primary Key" Watch "Forigen key to Composit primary Key" New topic
Author

Forigen key to Composit primary Key

Purushotham Panduranga
Greenhorn

Joined: Dec 07, 2004
Posts: 2
Hi All,

How can i create hbm mapping for a scenario of Forigen key to Composit primary Key. below is the problem defination.
I have 2 tables one table has 3 columns, all 3 columns are part of composit key. Another table has 2 columns and all the 2 columns are part of composit key.

ITEM_TABLE
USER_ID, DEPARTMENT, ITEM_TYPE

USER_ID, DEPARTMENT, ITEM_TYPE are composit keys.

USER_TABLE
USER_ID, DEPARTMENT

USER_ID, DEPARTMENT are composit keys.

How to create relation between ITEM_TABLE and USER_TABLE.
I am using Hibernate 3.1

Thanks
Purshi
Rashid Darvesh
Ranch Hand

Joined: Feb 13, 2004
Posts: 189
This might be helpful but its implemented in JPA
http://www.makemyinfo.com/Tutorial.do?action=getTutorial&tutId=T0009.jsp
Rashid
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Forigen key to Composit primary Key
 
Similar Threads
CMP maping - one to many unidirection in wl7.0
JPA Auto Incrementing EmbeddedId (Composit primary key values).
composit component in UML 2.0
need good example of hibernate with composit key
JPA Auto Incrementing EmbeddedId (Composit primary key values).