-->
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.  [ 2 posts ] 
Author Message
 Post subject: org.hibernate.MappingException Bull***t
PostPosted: Mon Jun 16, 2014 9:18 am 
Newbie

Joined: Mon Jun 16, 2014 9:03 am
Posts: 2
Hi, Im using Hibernate in my little project.

When Im trying to run program, this exception occurs for some reason:

Code:
Exception in thread "main" org.hibernate.MappingException: An association from the table unit_commander refers to an unmapped class: path.to.class.UnitCommaderType
   at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1805)
   at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1739)
   at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1424)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)
   at path.to.ORMConnector.connect(ORMConnector.java:24)
   at path.to.main(Main.java:13)


Here is my UnitCommander.hbm.xml:

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="path.to.package">
   <class name="UnitCommander" table="unit_commander">
      <id name="id" type="long" column="id">
         <generator class="native"/>
      </id>
      <property name="isErased" column="is_erased" type="boolean"/>
      <many-to-one name="unit" column="unit" class="Unit" not-null="true"/>
      <many-to-one name="unitCommanderType" column="unit_commander_type" class="UnitCommaderType" not-null="true"/>
      <many-to-one name="unitPost" column="unit_post" class="UnitPost" not-null="true"/>
      <many-to-one name="person" column="person" class="Person" not-null="true"/>
   </class>
</hibernate-mapping>


And here is my UnitCommanderType.hbm.xml:

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="path.to.package">
   <class name="UnitCommanderType" table="unit_commander_type">
      <id name="id" type="long" column="id">
         <generator class="native"/>
      </id>
      <property name="isErased" column="is_erased" type="boolean"/>
      <property name="priority" column="priority" type="int"/>
      <property name="messagePriority" column="message_priority" type="int"/>
   </class>
</hibernate-mapping>


I tried some ways but nothing helps. Who faced with similar? What can be wrong?

Thanks!


Top
 Profile  
 
 Post subject: Re: org.hibernate.MappingException Bull***t
PostPosted: Tue Jun 17, 2014 4:14 am 
Newbie

Joined: Mon Jun 16, 2014 9:03 am
Posts: 2
Solved!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.