I am using Tree Cache as follows:
1. get an object from the cache
2. change the object, (call a set method)
3. setRollbackOnly
Assumptions:
1. all steps are running in the same TX no serialization
2. all steps are running at the same ejb method in the server.
My expectations after reading the optimistic docs, is Tree Cache would create a copy of the nodes and will retrun me a copy of my object and not the actual object reference and thus will rollback my changes.
BUT, I see the object isn't rollback and my changes are stored, any insights ?
Optimistic locking does not copy your data objects. It just copies a node in the tree structure into a workspace, which will have a reference to your object in memory.