Hello!
What I haveI have a class called Node, and, two classes that are joined subclasses, extending it, called Part, and Form.
AssociationsPart has a unidirectional one-to-many association on a join table. The join table maps Parts with Nodes.
Cascade all is specified.
What invokes the problemI notice clearly that both the Part and the Form are persisted. But...
The problemI don't fint that the join table is populated!
Why is this?
There are no exceptions!
I'd like to use a unidirectional one-to-many association, because there is optional multiplicity on the child's behalf.
I use Hibernate version 3.5.2-Final!
CodeMapping for class Node:
Code:
<hibernate-mapping>
<class name="com.company.project.domain.configurator.Node" table="NODE">
<id name="id" type="java.lang.Integer">
<column name="NODE_ID" />
<generator class="native" />
</id>
<version name="version" />
<property name="name" type="java.lang.String">
<column name="NAME" />
</property>
<property name="label" type="java.lang.String">
<column name="LABEL" />
</property>
</class>
</hibernate-mapping>
</code>
Mapping for class Part:
Code:
<hibernate-mapping>
<joined-subclass
name="com.company.project.domain.configurator.Part"
extends="com.company.project.domain.configurator.Node"
table="PART" lazy="false">
<key>
<column name="NODE_ID" />
</key>
<set name="nodes" table="PART_NODE" cascade="all">
<key>
<column name="PART_ID" />
</key>
<many-to-many column="NODE_ID" unique="true"
class="com.company.project.domain.configurator.Node"/>
</set>
</joined-subclass>
</hibernate-mapping>
Mapping for class Form:
Code:
<hibernate-mapping>
<joined-subclass
name="com.company.project.domain.configurator.Form"
extends="com.company.project.domain.configurator.Node"
table="FORM" lazy="false">
<key>
<column name="NODE_ID" />
</key>
</joined-subclass>
</hibernate-mapping>
Thank you very much in advance!
This is very important for me. I will grant you 110 Karma points, perhaps even more for answering this.
The supple and most docile,
Leif Bork