我们可以在JPA删除查询中放入lockMode = LockModeType.PESSIMISTIC_WRITE吗?

时间:2014-09-29 07:58:50

标签: jpa eclipselink

我写了一个命名查询

@NamedQuery(name = "deleteEmployee", query = "DELETE from emp e where e.Id = :Id", lockMode=LockModeType.PESSIMISTIC_WRITE)

但Eclipse链接会抛出以下错误 -

java.lang.IllegalArgumentException:  A lock type can only be used with a select query (which allows the database to be locked where necessary)

然而,它适用于openJPA,我没有看到任何与上述异常相关的java文档。请建议。

0 个答案:

没有答案