| To: | users@xxxxxxxxxx |
|---|---|
| Subject: | Hibernate3 deletes due to removal of list items |
| From: | <twcrone@xxxxxxxxxxxxx> |
| Date: | Wed, 06 Sep 2006 10:17:26 -0400 |
| Delivered-to: | mailing list users@cinjug.org |
| Mailing-list: | contact users-help@cinjug.org; run by ezmlm |
| Priority: | normal |
|
I currently have an application that has a hierchical domain model that has objects that have lists of other objects that have lists of other objects that have lists...It goes about 4-5 layers deep and I need to be able to saveUpdate the main object and have changes to the lists at n level to take effect. Currently removals of items in the list at the first level causes deletes but at lower levels items removed don't cause deletes when I persist the main object.
I am using a "bag" element to define these relationships in the mapping files as such...
<hibernate-mapping>
<class name="MainObjectClass" table="Main" lazy="false"> <!-- ID field --> <id name="uniqueId" type="int" column="mainid"> <generator class="increment"/> </id> ... <bag name="firstLevelObjects" cascade="all" lazy="false">
<key column="mainid" not-null="true"/> <one-to-many class="FirstObjectClass"/> </bag> ... </class> <class name="FirstLevelObjectClass" table="First" lazy="false">
<!-- ID field --> <id name="uniqueId" type="int" column="firstid"> <generator class="increment"/> </id> ... <bag name="secondLevelObjects" cascade="all" lazy="false"> <key column="firstid" not-null="true"/> <one-to-many class="SecondLevelObjectClass"/> </bag> ...
</class> </hibernate-mapping> So when I saveUpdate MainObject, any removals from FirstLevelObjects list causes deletes (good). However any removals from SecondLevelObjects list does not cause deletes (bad). I guess somehow I am interfering with Hibernate's tracking of changes somehow. Anyone know why this might be happening? I can put in deletes explicity but I'd rather just let Hibernate do it for me.
Thanks,
- Todd
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Vaiggra and Cailiis Offfers, Mike Glass |
|---|---|
| Next by Date: | RE: [cinjug-users] Hibernate3 deletes due to removal of list items, Forsythe, Brian |
| Previous by Thread: | Vaiggra and Cailiis Offfers, Mike Glass |
| Next by Thread: | RE: [cinjug-users] Hibernate3 deletes due to removal of list items, Forsythe, Brian |
| Indexes: | [Date] [Thread] [Top] [All Lists] |