67,549
社区成员
发帖
与我相关
我的任务
分享
@Lock(value = LockModeType.PESSIMISTIC_READ)
@Query(value="select t from TBlvcAccessIpConfig t")
public List test1();
通过添加Lock注解即可,发现发送的查询语句后面会带上for update,即使用了数据库本身的锁机制。如果对JPA不熟采用直接写SQL的形式也是可以的
@Transactional
@Query(value="select * from t_blvc_access_ip_config for update",nativeQuery=true)
public List test1();