On Sun, 12 Jan 2003 17:32:16 +1100 (EST), "Gavin King" <[EMAIL PROTECTED]>
said:
> > am i doing something wrong or this is a known limitation?
>
> You must be doing something wrong (though I'm not quite sure
> what). A bidirectional one-to-many association with
> readonly="true" should require only 1 SQL statement per
> element.
>
>
> Are you sure that you aren't
>
> (a) flushing the Session between saving the children and adding
> them to the collections
>
> (b) missing the readonly attribute of the collection mapping
here's how the mapping looks like:
<class name="Foo" table="foo">
<id name="id">
<generator class="vm.hex"/>
</id>
<property name="title"/>
<bag role="items" readonly="true" cascade="all">
<key column="foo_id"/>
<one-to-many class="Bar"/>
</bag>
</class>
<class name="Bar" table="bar">
<id name="id">
<generator class="vm.hex"/>
</id>
<many-to-one name="origin" class="Foo" column="foo_id"/>
<property name="title"/>
</class>
the save code is really simple:
// ... set up Foo foo, with 1 Bar child, child has parent set as
origin
Session s = this.sessionFactory.openSession();
s.save(foo);
s.flush();
s.connection().commit();
s.close();
what is the problem with the above? i would like to understand the logic
that makes hibernate do an extra UPDATE...
thx,
viktor
--
[EMAIL PROTECTED]
--
http://fastmail.fm - A fast, anti-spam email service.
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel