-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: MappingException: invalid join columns for association
PostPosted: Thu Oct 15, 2009 12:52 pm 
Newbie

Joined: Thu Oct 15, 2009 12:36 pm
Posts: 1
An easy one for most:

I have the following mapping files:

The parent is called Instance.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.ctlm.persistence.hibernatemapping">
<class name="com.blah.blah.instance.Instance"
table="in_instance">

<id name="MIdentifier" column="instanceid#">
<generator class="assigned"/>
</id>

<property name="_mState" column="STATE"></property>
<one-to-one name="_theCreditHolder" class="com.blah.blah.instance.Person"/>
</class>


</hibernate-mapping>

and a child called Person.hbm.xml:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.blah.persistence.hibernatemapping">

<class name="com.blah.blah.instance.Person" table="IN_PERSON" check="id in ('1', '2', '3')">
<composite-id mapped="true">
<key-property name="_instanceId" column="INSTANCEID#"/>
<key-property name="id" column="PERSONID#"/>
</composite-id>

<property name="_mAcademicTitle" column="P_ACADEMICTITLE" type="java.lang.String"/>
<property name="_mBirthDate" column="P_BIRTHDATE" type="Date" />
<property name="_mBirthLand" column="P_BIRTHLAND" type="java.lang.String"/>

</class>
</hibernate-mapping>

I have had the Instance file working, taking data in and out of the database, but when I add the Person one-to-one property it fails with an error: Caused by: org.hibernate.MappingException: invalid join columns for association

I figure it has something to do with the way I am mapping the id. Basically (I am working with both a legacy application and database), I have a primary key in the Instance table of instanceid# and a composite key in the Person table of instanceid# and personid#.

Can anyone help?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.