Select for update skip locked from JPA level
问题 In my application - Oracle with JPA (EclipseLink), I'm using the following expression to lock the subset of the records in some tables: select * from MY_TABLE where MY_CONDITIONS for update skip locked I run it throughout native query, but I have to write that query for all required entities. Is there any way to skip locked records using pure JPA? Can I implement my own locking policy? I don't mind changing JPA provider but I want to use JPA API. 回答1: Hibernate provides the UPGRADE_SKIPLOCKED