How to code optimistic and pessimistic locking from java code

前端 未结 2 709
有刺的猬
有刺的猬 2021-01-12 06:30

I know what optimistic and pessimistic locking is, but when you write a java code how do you do it? Suppose I am using Oracle with Java, do I have any methods in JDBC that w

2条回答
  •  耶瑟儿~
    2021-01-12 06:57

    Suppose I am using Oracle with Java, do I have any methods in JDBC that will help me do that?

    This Oracle paper should provide you with some tips on how to do this.

    There are no specific JDBC methods. Rather, you achieve optimistic locking by the way that you design your SQL queries / updates and where you put the transaction boundaries.

提交回复
热议问题