This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes Mapping For CompositeID Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Mapping For CompositeID" Watch "Mapping For CompositeID" New topic
Author

Mapping For CompositeID

mona dubey
Greenhorn

Joined: May 27, 2005
Posts: 1
Hi Folks,

I am beginner for hibernate, I am not able to find proper mapping for a table containing composite ID. I am using Hibernate2 and the database is MySQL.

Here is the mapping I have done:


<composite-id>
<key-property name="year" type="java.lang.Long" column="year"/>
<key-many-to-one name="employee_id" class="com.tsystems.leavemanagement.hibernate.Employee" column="EMPLOYEE_ID"/>
<key-many-to-one name="leave_type_id" class="com.tsystems.leavemanagement.hibernate.LeaveType" column="LEAVE_TYPE_ID"/>
</composite-id>

<property
name="availed"
type="java.lang.Long"
column="AVAILED"
not-null="false"
length="11">
<meta attribute="field-description">
@hibernate.property
column="AVAILED"
length="11"
not-null="false"
</meta>
</property>
Help Urgently.
Thanks,
Mona
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mapping For CompositeID