我正在尝试将我的 Spring 项目从 Hibernate 迁移到 ObjectDB。在 ObjectDB 页面上,他们说 ObjectDB 与 JPA 100% 兼容。但是,我对这个 JPQL 查询有疑问:
SELECT e FROM Employee e WHERE e.present = false AND NOT EXISTS
(SELECT c FROM Computer c WHERE c.employeeEntity = e)
ORDER BY e.name
使用 Hibernate,这个查询没有问题,但是 ObjectDB 抛出异常:
com.objectdb.o.UserException: Unexpected query token 'EXISTS'
第二个问题是标准语言。这段代码:
In<Employee> inExpression = cb.in(root.get(Computer_.employeeEntity));
for (Long id : emplIds) {
Employee e = new Employee(id);
inExpression = inExpression.value(e);
}
list.add(inExpression);
正在使用 Hibernate,它正在使用 ObjectDB:
com.objectdb.o.UserException: Unexpected query token ':l2'
at com.objectdb.o.MSG.d(MSG.java:61)
at com.objectdb.o.TKN.J(TKN.java:765)
at com.objectdb.o.QNF.B(QNF.java:894)
at com.objectdb.o.QNF.I(QNF.java:1294)
at com.objectdb.o.QNF.k(QNF.java:315)
at com.objectdb.o.QNF.H(QNF.java:1270)
at com.objectdb.o.QNF.k(QNF.java:210)
at com.objectdb.o.QNF.t(QNF.java:611)
at com.objectdb.o.QNF.t(QNF.java:605)
at com.objectdb.o.QNF.k(QNF.java:218)
at com.objectdb.o.QNF.j(QNF.java:135)
at com.objectdb.o.QRC.z(QRC.java:321)
at com.objectdb.o.QRC.v(QRC.java:212)
at com.objectdb.o.QRC.u(QRC.java:166)
at com.objectdb.o.QRM.U6(QRM.java:250)
at com.objectdb.o.MST.U6(MST.java:933)
at com.objectdb.o.WRA.U6(WRA.java:291)
at com.objectdb.o.WSM.U6(WSM.java:113)
at com.objectdb.o.STC.r(STC.java:449)
at com.objectdb.o.SHN.aj(SHN.java:489)
at com.objectdb.o.SHN.K(SHN.java:156)
at com.objectdb.o.HND.run(HND.java:132)
at java.lang.Thread.run(Unknown Source)
有谁知道如何解决这些问题?
米兰