Hi,
I've started using Hibernate a few days ago and i was trying to map a class which has an inner class. The java class is generated using jaxb and derives from IFC schema , so i think can't really avoid inner classes.
I have something like this:
Code:
public class A{
public static class B{
//...
}
}
Now, i know that one can map inner classes using the "foo$bar technique". So, i created a new hbm map file.
A.hbm.xml:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 18/Nov/2009 14:54:38 by Hibernate Tools 3.2.5.Beta -->
<hibernate-mapping>
<class name="package.A" entity-name="A" table="A">
<!--(properties...)-->
<many-to-one name="B" class="package.A$B" column="B" fetch="join"/>
</class>
</hibernate-mapping>
A$B.hbm.xml:
Code:
<?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 18/Nov/2009 14:54:38 by Hibernate Tools 3.2.5.Beta -->
<hibernate-mapping>
<class name="package.A$B" entity-name="B" table="B">
</class>
</hibernate-mapping>
I'm getting the following exception:
Code:
java.lang.ExceptionInInitializerError
at package.Main.<clinit>(Main.java:31)
Caused by: org.hibernate.MappingException: An association from the table A refers to an unmapped class: package.A$B
Does any of you have a clue on what might be the problem?
Even if you have an example using inner classes i'd appreciate pointing it to me, cause right know I'm not finding anything related to this matter. Well, actually any help at all is appreciated.
Thanks in advance.