-->
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: Hibernate fires false"unmmaped class" Exception
PostPosted: Thu Apr 03, 2008 9:36 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
Something quite weird is firing a bug in my code
(only executing under Windows !!!) where before it all went right.
Besides, Exception (see bellow) says:
"..refers to an unmapped class: com.interfaz.ContainerInterfaz.." which is
the interface implemented by Container and not a class at all even to be referred at
any mapping at all (hibernate surfed my hierarchy and got me into troubles).

Details below:
-----------------
Hibernate version: 3.2.5GA

Mapping documents:
<hibernate-mapping>
<class name="com.impl.Container"
table="CONTAINERS">
<id name="id" column="CONTAINER_ID">
<generator class="native"/>
</id>
<property name="date" type="timestamp" column="CREATION_DATE"/>

<set name="names" table="CONTAINER_NAMES">
<key column="CONTAINER_ID"/>
<element column="name" unique="true"
not-null="true" type="string"/>
</set>

<set name="versions" fetch="join"
lazy="false" order-by="VERSION_DATE" inverse="true">
<key column="CONTAINER_ID"/>
<one-to-many
class="com.impl.ContainerVersion"/>
</set>
</class>
</hibernate-mapping>

<hibernate-mapping>
<class name="com.impl.ContainerVersion"
table="CONTAINER_VERSIONS">

<id name="id" column="VERSION_ID">
<generator class="native"/>
</id>
<property name="date" type="timestamp" column="VERSION_DATE"/>

<property name="xml" type="text"
not-null="true" column="CONTENT" lazy="false"/>

<property name="mainVersion" type="boolean" not-null="true"/>


<many-to-one name="container" column="CONTAINER_ID" not-null="true"/>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
N/A (happens right at the beggining at creation of tables)

Full stack trace of any exception that occurs:
INFO: Mapping collection: com.impl.Container.versions
-> CONTAINER_VERSIONS
Exception uncaught in thread main
org.hibernate.MappingException: An association from the table CONTAINER_VERSIONS refers to an unmapped class: com.interfaz.ContainerInterfaz
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configur
ation.java:1134)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:
1052)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1168)


Name and version of the database you are using:
hsqldb 1.8.0


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 03, 2008 9:59 am 
Regular
Regular

Joined: Mon Aug 06, 2007 10:49 am
Posts: 67
Location: Banska Bystrica, Slovakia
u should specify atribute class :

<many-to-one name="container" class="com.impl.Container" column="CONTAINER_ID" not-null="true"/>


Top
 Profile  
 
 Post subject: Worked but why?
PostPosted: Fri Apr 04, 2008 3:59 am 
Beginner
Beginner

Joined: Tue Aug 29, 2006 8:08 am
Posts: 34
Ok, tnx a lot, it worked, but i still don't understand why before it worked (even now it did on Linux) without that class attribute and now it did not. Has it something to do with hibbernate
fixing bugs/holes ?


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.