Is there a way to turn off Hibernate optimization lock?

I have an entity:

@Entity
public class VersionedDo {
    @Version
    @Column(name = "version")
    private int version;
    ...
}

I want to update this object without increasing the version in some cases. Is there any way to do this without directly updating SQL?

+4
source share
1 answer

From the Hibernate documentation :

Your application is not allowed to change the version number specified using Hibernate.

To artificially increase the version number, see the property documentation LockModeType.OPTIMISTIC_FORCE_INCREMENTor LockModeType.PESSIMISTIC_FORCE_INCREMENTcheckin the Hibernate Entity Manager reference documentation.

, Hibernate, , . .

SQL- "" Hibernate, .

0

Source: https://habr.com/ru/post/1624400/


All Articles