PROBLEM DESCRIPTION
===================
I have two tables (each have composite keys). One
composit key is a subset of the other one. I get
following message error during mapping processing:
net.sf.hibernate.MappingException: Foreign key
(ROLE_ABSENCE [ABSENCETYPE_VERSIONID])) must have same
number of columns as the referenced primary key
(ABSENCETYPE [ID,VERSIONID])
at
net.sf.hibernate.mapping.ForeignKey.setReferencedTable(ForeignKey.java:60)
at
net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:667)
at
net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:761)
at
com.test.java.dao._RootDAO.initialize(_RootDAO.java:33)
at com.test.testclient.Test.main(Test.java:14)
Has someone become a successfull mapping for a
comparable problem?
Thanks in advance!
DATABASE SCHEMA
===============
TABLE: absencetype | with composite id (id,versionid)
- id
- versionid
- column_1
- column_2
TABLE: role_absence | with composite id
(role_id,role_versionid,absencetype_id,absencetype_versionid)
- role_id
- role_versionid
- absencetype_id (foreign key to absencetype)
- absencetype_versionid (foreign key to absencetype)
- column_a
- column_b
MAPPING FILES (generated by Hibernate Synchronizer)
=============
ABSENCETYPE.hbm:
----------------
...
<hibernate-mapping package="com.test.java">
<class name="ABSENCETYPE" table="ABSENCETYPE">
<composite-id name="id" class="ABSENCETYPEPK">
<key-property name="id" column="ID"
type="integer"/>
<key-property name="versionid" column="VERSIONID"
type="integer"/>
</composite-id>
...
RoleAbsence.hbm:
----------------
...
<hibernate-mapping package="com.test.java">
<class name="RoleAbsence" table="ROLE_ABSENCE">
<composite-id name="id" class="RoleAbsencePK">
<key-property name="roleId" column="ROLE_ID"
type="integer"/>
<key-property name="roleVersionid"
column="ROLE_VERSIONID" type="integer"/>
<key-many-to-one name="absencetype"
column="ABSENCETYPE_ID" class="ABSENCETYPE"/>
<key-many-to-one name="absencetypeVersionid"
column="ABSENCETYPE_VERSIONID" class="ABSENCETYPE"/>
</composite-id>
...
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel