Hi all,
I have a problem using optimistic locking. I have a persistent object, with a version number. I want this version number to be increased only when my persistent object is 'really' updated, meaning when one or more fields have been modified or when a collection mapped in my entity with a @ManyToOne or @OneToMany annotation is modified in the database. What happens is that the version is increased only when a field contained directly in my entity has changed, and not when a collection has changed.
Note : I put select-before-update in my Entity annotation. Don't know if it might changed the behaviour of the versioning on the collections! I also have a field which should not influence the version in my entity, on which I put the @OptimisticLock(exclude=true) annotation.
Does anyone know how I may try to make my versioning work? According to what I've read on several forums, the version number should be automatically increased when a collection changed. Why wouldn't it be the case in my case? Any idea?
Thanks
Aurelia
|