the following examples load and modify an entity, and load and remove the same entity.
The first example 'SetAndRemoveIssue.java' is a simple java program which executes without errors.
The second example is an OSGi program which fails with an optimistic lock exception.
Both examples are equivalent, please execute SetAndRemoveIssue.java (in the OSGi example as a plugin-test).
Can you explain the optimistic lock exception?
It seems that the first level cache contains yet a dirty entity although the former query has cause an automatically flush.