views:

25

answers:

0

We have a two tier Swing application using Hibernate. Sometimes we manipulate an object in one session (A), which we know in another session (B) as well (two different Java Instances, same database record).

In this case after commit and closing of A, we refresh the object in session B, in order to show the updated state in the UI. Works fine in most of the cases.

But if we have an object X with a collection of Ys we get a problem with the following sequence of events:

B: load X and Ys

A: load X and Ys

A: remove on Y from the collection and the database

A: flush, commit and close the session

B: refresh X

At the last step we get a UnresolvableObjectException which seems to happen, because B the X keeps its collection (instead to refreshing the collection itself) and tries to refresh each contained instance of Y which of course fails when reaching the deleted one.

If found problem descriptions about similar problems when refreshing collections, but

  • no solution

  • no bug report

  • no explanation, that this is by design

So these are my questions: How can I solve my problem (Even a pointer into the source code with a post it 'fix here' would be of help)? Is this a bug? If so, is it a known one?