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!