Consider two entities Parent and Child.
I just implemented something similar which is working like beast fast and nice. At the moment you are saving your 'child' just call do something like:
save(child);
T parent = child.getParentEntity();
entityManager.lock(parent, LockModeType.OPTIMISTIC_FORCE_INCREMENT);
You need access to the entity manager which can be obtained in spring like:
@PersistenceContext
private EntityManager entityManager;
Your parent entity should have @Version from javax.persistence.Version and NOT the spring one. (I assume that on the child save moment you will have all the verifications and things done so when you are saving the child the parent should get dirty for sure)