I have been going through my concurrency issues and have identified the source of the problem.
Essentially we create a complex hierarchical structure with the lowest level of documents being questions these questions are shared or references in a number of different hierarchical document structures. Just to make things more interesting we create an answer structure which mirrors this nested document structure to capture users answers in a similar hierarchical format to the document itself. This is all fabulous NoSQL structures using hierarchical data sets for what they are good for.
However the issues is every time I cascade save the answer structure which has a whole stack of references to objects from the template document somehow Orientdb picks up these nested reference objects as having been modified when in fact the object has not been modified at all and tries to save these objects. So when running in a multi threaded environment the cascade saves result in the same questions trying to be updated in a concurrent way and as a result you get a concurrency update error.
Interestingly this problem happens to different degrees under different OS's and different JVM implementations ie from Windows to Mac to Ubuntu we experience different levels of exceptions etc which kind of suggests this is some kind of low level problem.
But essentially the object is being marked as modified when none of the values have changed and the object has not modified in an way shape or form. I loosely think this kind of versioning and modification detection is done and low level byte code augmentation way. Something I have not dug down into debugging and sorting out issues with.
I am currently experimenting with detaching the entities that have not been modified and then cascade saving the objects with references to first pass testing indicates this might be a successful strategy.
I look forward to a response and some guidance on whether this is an orientdb problem or a problem with the way I am doing things. Or could this be an interaction between spring-orient-data and orientdb.