Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jpa-dev] Optimistic Locking: How to suppress version increment for some updates?

Hi all

I am currently using optimistic locking with a simple version column on calendar appointment entity:

...
   @Version
   private Integer version;
...

I would like to be able to skip the version increment for certain entity updates.

I tried this (which did not work):
...
ContactEvent ce = em.find(ContactEvent.class, contactEventId, LockModeType.NONE);
...


Then I found that this hibernate annotation could probably help me to suppress the version increment in some cases:
...
@OptimisticLock(excluded = true)
...

But I am using Payara and EclipseLink does not seem to support this feature.

Does anyone have an idea how to cleanly suppress a version increment for certain updates (maybe via listeners)?

If there is currently no clean way when, then can we add this kind of annotation (@OptimisticLock) to the jpa spec in future?

Regards
Rainer








Regards
Rainer Schamm



Back to the top