Hibernate version: 3.0.3
Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.be.desktopbeautifier.server">
<class name="ThemeHibernate" table="theme">
<id name="id" unsaved-value="0">
<generator class="assigned"/>
</id>
<discriminator column="class"/>
<version name="version"/>
<property name="name" type="java.lang.String" not-null="true"/>
<set name="children" cascade="all-delete-orphan" sort="unsorted"
inverse="true">
<key>
<column name="parent_id"/>
</key>
<one-to-many class="ThemeHibernate"/>
</set>
<many-to-one name="parent" column="parent_id" class="ThemeHibernate"
cascade="all"/>
<subclass name="com.be.desktopbeautifier.server.DefaultTheme"/>
</class>
</hibernate-mapping>
I have a parent/child relationship as mentioned in the document. The problem is that if I create a Parent, invoke Parent.add(Child), then Session.save(parent) the save() operation is not being cascaded to the child. This is a special case because I am using assigned identifiers but the documentation says this *should* work nontheless, yet it does not.
Any ideas?
Gili