-->
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: org.hibernate.MappingException: Association references unmap
PostPosted: Fri Jan 26, 2007 7:22 pm 
Newbie

Joined: Wed Jan 24, 2007 2:54 pm
Posts: 6
Getting the following erorr if I use the mapping document and java classes generated by the tool.

org.hibernate.MappingException: Association references unmapped class: com.test.hibernate.EmpContact


Hibernate version: 3.2.1 ga

Mapping documents: EmpContact.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">
<!-- Generated Jan 26, 2007 3:03:53 PM by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="com.test.hibernate.EmpContact" table="EMP_CONTACT" schema="HIBERNATE">
<id name="id" type="big_decimal">
<column name="ID" precision="22" scale="0" />
<generator class="assigned" />
</id>
<many-to-one name="employee" class="com.test.hibernate.Employee" fetch="select">
<column name="EMP_ID" precision="22" scale="0" />
</many-to-one>
<property name="street" type="string">
<column name="STREET" length="500" />
</property>
<property name="city" type="string">
<column name="CITY" length="100" />
</property>
<property name="zip" type="big_decimal">
<column name="ZIP" precision="22" scale="0" />
</property>
<property name="state" type="string">
<column name="STATE" length="2" />
</property>
</class>
</hibernate-mapping>


Mapping documents: Employee.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">
<!-- Generated Jan 26, 2007 3:03:53 PM by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="com.test.hibernate.Employee" table="EMPLOYEE" schema="HIBERNATE">
<id name="empId" type="big_decimal">
<column name="EMP_ID" precision="22" scale="0" />
<generator class="assigned" />
</id>
<version name="verNum" column="VER_NUM" type="integer"></version>
<property name="firstName" type="string">
<column name="FIRST_NAME" length="4000" />
</property>
<property name="experience" type="big_decimal">
<column name="EXPERIENCE" precision="22" scale="0" />
</property>
<property name="verNum" type="big_decimal">
<column name="VER_NUM" precision="22" scale="0" />
</property>
<set name="empContacts" inverse="true">
<key>
<column name="EMP_ID" precision="22" scale="0" />
</key>
<one-to-many class="com.test.hibernate.EmpContact" />
</set>
</class>
</hibernate-mapping>



Full stack trace of any exception that occurs:

org.hibernate.MappingException: Association references unmapped class: com.test.hibernate.EmpContact
at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2370)
at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2652)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1127)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1283)
at TestHibernate.main(TestHibernate.java:27)

Name and version of the database you are using:
Oracle 10g XE

DDL for the tables used:

CREATE TABLE "HIBERNATE"."EMP_CONTACT"
( "STREET" VARCHAR2(500 BYTE),
"CITY" VARCHAR2(100 BYTE),
"ZIP" NUMBER(*,0),
"STATE" VARCHAR2(2 BYTE),
"ID" NUMBER NOT NULL ENABLE,
"EMP_ID" NUMBER,
CONSTRAINT "EMP_CONTACT_PK" PRIMARY KEY ("ID")
CONSTRAINT "EMP_CONTACT_EMPLOYEE_FK1" FOREIGN KEY ("EMP_ID")
REFERENCES "HIBERNATE"."EMPLOYEE" ("EMP_ID") ENABLE
)


CREATE TABLE "HIBERNATE"."EMPLOYEE"
( "FIRST_NAME" VARCHAR2(4000 BYTE),
"EXPERIENCE" NUMBER(*,0),
"EMP_ID" NUMBER NOT NULL ENABLE,
"VER_NUM" NUMBER(*,0),
CONSTRAINT "EMPLOYEE_PK" PRIMARY KEY ("EMP_ID")
)


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.