• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Mapping For CompositeID

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Attractive, successful people love this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic