Hi All!
I have a question, that will maybe sound silly. But I would like to know, how you handle loading of an aggregate object, object that has some child objects etc, tree structure, cycle etc. in read-committed transaction level.
Because, I have a problem to load it, and I haven't found the way to make it easier using hibernate.
Here is the problem
environment:
- very high concurrency
- read-committed transaction level
- object aggregates with lot of child objects in collections and other relations (mostly lazy, cannot be eager - multiple bags)
T1 is loading the object aggregate, loads the root object
T2 is committing the very same root object.
T1 now loads child objects (lazy, cache, or whatever). But, because of read-committed level, child objects are different than in time the T1 started. Because of T2 commit.
So hibernate will loaded in general mixed aggregate, some old data, some new.
Well, I know that the T1 would fail on optimistic exception on commit. But, the problem is that code is quite complicated, and we await, that the aggregate is correct. However, after this bad load, the code can fail on many places, as the object structure is in inconsistent state.
Has anyone similar problem?
Our handling is so, that we must use a checksum when loading the aggregate entity, and calculate it again before save (versions of all child objects). But is there some way hibernate could handle this? Best using JPA.
Thanx for any reply :-).
pavol
|