• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... 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