I'm new to JPA and have noticed that one can make use of optimistic locking by annotating a field in an entity with @Version
. I'm just curious about whether persistence providers will create an implicit version field if there doesn't exist one before. For example the website of objectdb states:
"When using ObjectDB, optimistic locking is enabled by default and fully automatic."
But this seems to be vendor-specific behaviour since optimistic locking won't be enabled by default in EclipseLink, for example. So if I want to use locking (and yes, I want :-) ), am I required to create an extra attribute for all my entities? Are there any hints in the specification?
Thank you in advance!