-->
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.  [ 3 posts ] 
Author Message
 Post subject: one-many mapping - Association references unmapped class
PostPosted: Sat Aug 07, 2004 4:12 am 
Beginner
Beginner

Joined: Wed Aug 04, 2004 9:01 pm
Posts: 21
Hello all,

I am trying to do a one to many mapping between

com.aol.ic.art.data.domain.Request class and

com.aol.ic.art.data.domain.RequestStatus class

and following are my mapping documents. I am receiving a complaint that net.sf.hibernate.MappingException: Association references unmapped class: com.aol.ic.art.data.domain.RequestStatus

Following are the details and mapping documents. Please reply ASAP.


Hibernate version:
hibernate2.jar

Mapping documents:

REQUEST

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

<hibernate-mapping>

<class name="com.aol.ic.art.data.domain.Request" table="REQUEST">

<id name="id">
<generator class="assigned"/>
</id>

<property name="requestorDn">
<column name="REQUESTORDN" length="255" not-null="true"/>
</property>

<property name="customerDn">
<column name="CUSTOMERDN" length="255" not-null="true"/>
</property>

<property name="fulfillmentBuildingDn">
<column name="FULFILLMENTBUILDINGDN" length="255" not-null="true"/>
</property>

<property name="fulfillmentRoomNumber">
<column name="FULFILLMENTROOMNUMBER" length="20" not-null="true"/>
</property>

<property name="lastApproverDn">
<column name="LASTAPPROVERDN" length="255" not-null="true"/>
</property>

<property name="nextApproverRoleDn">
<column name="NEXTAPPROVERROLEDN" length="255" not-null="true"/>
</property>

<property name="ticketNumber">
<column name="TICKETNUMBER" length="30" not-null="true"/>
</property>

<property name="status">
<column name="STATUS" length="30" not-null="true"/>
</property>

<property name="type">
<column name="TYPE" length="30" not-null="true"/>
</property>

<property name="comments">
<column name="COMMENTS" length="255" not-null="true"/>
</property>

<set name="products" table="REQUEST_PRODUCT_LINK" lazy="true">
<key column="REQUESTID"/>
<many-to-many class="com.aol.ic.art.data.domain.Product"/>
</set>

<set name="states" inverse="true" lazy="true">
<key column="REQUESTID"/>
<one-to-many class="com.aol.ic.art.data.domain.RequestStatus"/>
</set>
</class>
</hibernate-mapping>


REQUEST STATE

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

<hibernate-mapping>
<class name="com.aol.ic.art.data.domain.RequestStatus" table="REQUEST_STATE">
<id name="id">
<generator class="assigned"/>
</id>

<many-to-one name="request" class="com.aol.ic.art.data.domain.RequestStatus"
column="REQUESTID"/>

<property name="state">
<column name="STATE" length="20" not-null="true"/>
</property>

<property name="dateStateAttained" type="date">
<column name="DATE_STATE_ATTAINED" length="255" not-null="true"/>
</property>
</class>

</hibernate-mapping>

</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():


Full stack trace of any exception that occurs:


Name and version of the database you are using:

Oracle 9.2.0

Debug level Hibernate log excerpt:


2004-08-07 04:02:02 ERROR HibernateUtil.<clinit>(?) - Initial SessionFactory creation failed.
net.sf.hibernate.MappingException: Association references unmapped class: com.aol.ic.art.data.domain.RequestStatus
at net.sf.hibernate.cfg.Binder.bindCollectionSecondPass(Binder.java:1162)
at net.sf.hibernate.cfg.Binder$CollectionSecondPass.secondPass(Binder.java:1366)
at net.sf.hibernate.cfg.Binder$SecondPass.doSecondPass(Binder.java:1342)
at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:618)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:761)
at com.aol.ic.art.data.dao.utils.HibernateUtil.<clinit>(Unknown Source)
at com.aol.ic.art.data.dao.utils.CreateRequest.create(Unknown Source)
at com.aol.ic.art.ARTInitServlet.init(Unknown Source)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 08, 2004 2:09 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You dont have it listed in the step the sets up the Hibernate Session. Don't know which way you are doing it though.


Top
 Profile  
 
 Post subject: Similar problem
PostPosted: Mon Aug 09, 2004 3:56 am 
Newbie

Joined: Mon Aug 09, 2004 3:38 am
Posts: 1
Hello.
I think I have a very similar problem with many-to-many, but I don't understand the answer provided.

I have two tables: Event and Sponsor with many to many relationship between them. Sponsorship is the middle table that collects both ID-s.


I get an error:
Error 500: An association from the table SPONSORSHIP refers to an unmapped class: com.mba.dataobjects.Event

Hibernate version: Hibernate2.jar

Sponsor.hbm.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.mba.dataobjects.Sponsor" table="SPONSOR">
<meta attribute="class-description">
Represents sponsors
@author bozidard
</meta>
<id name="idSponsor" type="int" column="ID_Sponsor">
<meta attribute="scope-set">public</meta>
<generator class="native"/>
</id>
<property name="name" type="string" not-null="true"/>
<property name="type" type="string" not-null="true"/>
<property name="logo" type="string" not-null="false"/>
<property name="hyperlink" type="string" not-null="false"/>
<set name="events" table="SPONSORSHIP">
<key column="ID_Sponsor"/>
<many-to-many class="com.mba.dataobjects.Event" column="ID_Event"/>
</set>
</class>
</hibernate-mapping>

Event.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.mba.dataobjects.Event" table="EVENT">
<meta attribute="class-description">Represents an event that happened or will happen in the future @author bozidard
</meta>
<id name="idEvent" type="int" column="ID_Event">
<meta attribute="scope-set">public</meta>
<generator class="native"/>
</id>
<property name="title" type="string" not-null="true"/>
<property name="type" type="string" not-null="true"/>
<property name="date" type="date" not-null="true"/>
<property name="location" type="string" not-null="true"/>
<property name="organizers" type="string" not-null="false"/>
<property name="noParticipants" type="int" not-null="false"/>
<property name="noCountries" type="int" not-null="false"/>
<property name="specialGuests" type="string" not-null="false"/>
<property name="description" type="string" not-null="false"/>
<property name="linkMore" type="string" not-null="false"/>
<set name="sponsors" table="SPONSORSHIP" inverse="true">
<key column="ID_Event"/>
<many-to-many class="com.mba.dataobjects.Sponsor" column="ID_Sponsor"/>
</set>
</class>
</hibernate-mapping>


I would apriciate any help.

Thank You!
Bozo


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

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.