Hi,
I created a custom Assembler extending from AbstractAssembler. The Assembler itself uses JPA 1.0 with Hibernate Annotations and Hibernate EntityManager. The entities all have a version property that is annotated with @Version and a corresponding column for the version in their database table.
The problem is: when an entity gets updated on the client (e.g. entity.name changes from "A" to "B") and the change gets committed, the data gets correctly stored in the database and the version property gets increased by one by Hibernate (e.g. entity.version was 1 and after the update in the database entity.version is 2).
However, the change of the version is not transferred back to the clients. This leads to stale / incorrect data on the client as the version is always incorrect. So the next time a client changes data in that entity and commits it, Hibernate will throw an OptimisticLockException as the version numbers do not match any more.
The only idea I came up with so far is to manually tell LCDS about this by getting the DataServiceTransaction withing the update method of the assembler and then propagate the change after the call to entityManager.merge() - but this seems a bit overkill to me.
Any ideas?
Dirk.