I have an entity containing an attribute with annotation @Version and every time I update the entity, the version has incremented. It's OK. If the version of my entity in database is a number X then the version of an entity that I make a merge, must be the same number X. But, if an entity is persistent (obtained with a find), and we change the @Version attribute manually, the OptimisticLockException doesn't throw, and the entity is updated! Why hibernate doesn't checks the value of the @Version attribute that I have setted? Is only because it is persistent?
|