-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Simple Array Question
PostPosted: Wed Jun 09, 2004 3:25 pm 
Newbie

Joined: Tue Jun 08, 2004 8:07 pm
Posts: 14
Location: Washington, D.C.
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.