I have an AbstractEntity class as superclass for all my entites that defines an optimistic lock column like this:
@Version
private long lockVersion;
Now I often get OptimisticLockingExceptions on entities, that are only changed in one the mappedBy relations similar to the following:
@OneToMany(mappedBy = Property.PROPERTY_DESCRIPTOR, cascade = { CascadeType.REMOVE })
private Set<Property> properties = new HashSet<Property>();
Is it possible to exclude those collections from Hibernate optimistic locking? The entity is not changed in the database at all... only others referencing it.