Updating hibernate version manually

前端 未结 1 1315
伪装坚强ぢ
伪装坚强ぢ 2021-01-12 15:46

I have two classes say Foo and Bar mapped as @OneToOne (bidirectional) using Hibernate (3.6.1 final) with JPA (2.0) like -

@Entity
public class Foo{
    @Id
         


        
相关标签:
1条回答
  • 2021-01-12 16:31

    The correct way to force version update is the following:

    em.lock(entity, LockModeType.OPTIMISTIC_FORCE_INCREMENT);
    

    It's intended to be used in such cases.

    Other methods of EntityManager that take LockModeType can be used as well.

    0 讨论(0)
提交回复
热议问题