Hibernate version:
3.1.2
Mapping documents:
Code:
<hibernate-mapping package="component">
<class name="EntityA" table="ENTITYA">
<id name="id" column="ID" type="long">
<generator class="increment"/>
</id>
<component name="myComponent" class="ComponentA" >
<parent name="myEntity"/>
<property name="title" column="TITLE" type="string"/>
<set name="entityBs">
<key column="A_ID"></key>
<one-to-many class="EntityB"></one-to-many>
</set>
</component>
</class>
</hibernate-mapping>
I'm trying to map a bidirectional association between a component of type "ComponentA" -which is part of an entity of type "EntityA" - to an entity of type "EntityB". The unidirectional association from above works, but I couldn't figure out how the mapping for the many-to-one-element on the other side would have to look like.
I tried this...
Code:
<hibernate-mapping package="component">
<class name="EntityB" table="ENTITYB">
<id name="id" column="ID" type="long">
<generator class="increment"/>
</id>
<many-to-one name="component" class="ComponentA" column="A_ID">
</many-to-one>
</class>
</hibernate-mapping>
... and got an error like this from hbm2ddl:
An association from the table ENTITYB refers to an unmapped class: component.ComponentA
The same happens, if I omit the class-attribute.
Is there a way to get this kind of association work?
Thanx in advance!