Searched the archives regarding saving arrays and read the Parent/Child example of the guide, but still am not getting the behavior I'd like to see.
class A
{
private B[] arrayOfBs;
...mutator methods elided...
}
class B
{
String id;
String text
C[] arrayOfCs
}
class C
{
String text;
}
in A.hbm.xml I include...
<array name="arrayOfBs" table="belements" cascade="all">
<key column="a_key"/>
<index column="index"/>
<one-to-many class="B"/>
</array>
my B.hbm.xml file has...
<class name="B" table="b_elements" >
<id name="id" type="string" column="b_key">
<generator class="assigned"/>
</id>
<property name="text" column="text" type="string"/>
<array name="C" table="c_elements">
<key column="c_key" foreign-key="b_key"/>
<index column="index"/>
<composite-element class="C">
<property name="text" column="text" type="string"/>
</composite-element>
</array>
</class>
However, when I call session.save( A ), any B elements are not "cascaded" down into the b_elements table. Can saves be cascading without a bi-directional mapping? Also, are there any examples out there of saving arrays that someone can point me to (I've found plenty for collections, but not so much for arrays).
TIA for any tips,
~harris
|