syg6 wrote:
Something else I have noticed: deleting members of the AAndBJoin Collection
seems to be working, more or less, now that I put the DELETE_ORPHAN
Hibernate Annotation. But there is one case where it does NOT work -- when
you delete all of the elements. When you delete all of the elements, the
'AAndBJoin' Request parameter is of course null. What Hibernate should do in
this case is delete all elements. But what it in fact does, is nothing.
It seems that in order for Hibernate to properly delete elements from a
Collection, at least one element has to be sent in the Request. Thus, if you
had 4 and deleted 3, 1 element is sent in the Request and Hibernate compares
the Collection before and after, and properly deletes 3. But if you delete
all 4, in the Request 'null' is received, Hibernate seems to do no
comparison, and deletes nothing. Ugh.

You need to detect this case, because assigning "null" to the the collection attribute is wrong--the appropriate answer is to retrieve the (hibernate managed) collection, and either remove each item from it or clear() the collection, then re-setting the (same) cleared collection to the attribute.

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to