I have an AbstractEntity class as a superclass for all my entites, which defines an optimistic locking column as follows:
@Version
private long lockVersion;
Now I often get OptimisticLockingExceptions for entities that only change in the same mappedBy ratio, similar to the following:
@OneToMany(mappedBy = Property.PROPERTY_DESCRIPTOR, cascade = { CascadeType.REMOVE })
private Set<Property> properties = new HashSet<Property>();
Can these collections be excluded from the optimistic Hibernate lock? An entity does not change in the database at all ... only others refer to it.
source
share