当我使用 hibernate (4.2.3.Final) 以内存模式在 hsqldb (1.8.0.7) 上运行查询时 我得到以下异常
java.sql.SQLException: Unexpected token: FOR in statement [SELECT *
FROM MYTABLE where ID=? FOR UPDATE NOWAIT] at
org.hsqldb.jdbc.Util.throwError(Unknown Source) at
org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source) at
org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source) at
...
hsqldb是否支持select from update?
最佳答案
在updatability 2.3 的文档部分指出它以某种方式受到支持:
If the SQL qualifier, FOR UPDATE is used, then all the updatable columns of the result set become updatable.
但是我没能在 1.8 的文档中找到它。我找到了一些网站,比如 this ,表示 SELECT FOR UPDATE 在 1.8 版本中不受支持。
No concurrent migration support (to make Flyway cluster-safe) with Hsql 1.8, as this version does not property support SELECT ... FOR UPDATE locking
关于java - 使用 hibernate 在 hsqldb 中选择更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18052406/