Hi all! Im looking for some advice:
Automatic versioning is easy to configure and works great (I get the StaleObjectException when I should). Trouble is I've designed an app which has high concurrency and Im not sure if optimistic locking is the way to go...
I have a an object graph of three different objetcts A->B->C ( -> denotes composition) and the objects in C are the ones that are transaction intensive.
Should I make a separate DAO for C? Or is it fine just to have a DAO for A and use cascade="all" for the relationships?
At the beginning I thought of just having a DAO for A, store it in a session (like the various sessions, one persistent object approach to optimistic locking). The problem with this approach is that when a version conflict occurrs I'm forced to rollback, load the object again from the db (i.e load) and then add the changes... Ouch... (not to mention de performance drawback, but its something we can live with for the size of A).
Is this the way to handle versioned data when a conflict occurs?
If I have a separate DAO for C... then I'll have to write the whole darn thing again... ouch...
Thoughts, ideas are welcome!
_________________ Mauricio Hern
|