Optimistic Locking in Hibernate by default

前端 未结 2 1259
暗喜
暗喜 2020-12-24 00:49

I have one question about optimistic locking in Hibernate. I am trying to go deep inside optimistic locking with Hibernate, but I have one doubt. Hibernate uses version appr

2条回答
  •  太阳男子
    2020-12-24 01:03

    @axtavt, you right, but question about how hibernate implement optimistic locking without @Version column.

    Today four OptimisticLockType options available:

    /**
     * Perform no optimistic locking.
     */
    NONE,
    /**
     * Perform optimistic locking using a dedicated version column.
     *
     * @see javax.persistence.Version
     */
    VERSION,
    /**
     * Perform optimistic locking based on *dirty* fields as part of an expanded WHERE clause restriction for the
     * UPDATE/DELETE SQL statement.
     */
    DIRTY,
    /**
     * Perform optimistic locking based on *all* fields as part of an expanded WHERE clause restriction for the
     * UPDATE/DELETE SQL statement.
     */
    ALL
    

    I think this is enough to answer the original question.

提交回复
热议问题