select x from X x where x.a.id = :a_id
- >总是选择的Java:JPQL select语句
为什么上面的JPQL语句不行0对象,但下面的工作吗?
select a from A a where a.id = :a_id
- > a_obj
select x from X x where x.a = :a_obj
- >总是正确的对象数选择
既不查询抛出执行期间的异常,但获得了不同数量的结果。
感谢
更新
我通过尝试使用下面的连接的查询:
select x from X x, x.a a where x.a.id = :a_id
- > TopLink的例外意外的标记
这: select x from X x JOIN x.a a where a.id = :a_id
- >始终选择正确的对象数量
对于后者的查询,我已经解决了最初的问题。但是,现在我有两个应该工作的查询,但由于某种原因,不。
select x from X x where x.a.id = :a_id
- >总是0对象选择
select x from X x, x.a a where x.a.id = :a_id
- > TopLink的意外令牌
有其他人遇到过类似的行为异常?
哪个JPA提供商正在使用? – mdma 2010-05-24 23:26:29
@mdma:GlassFish 2.1.1上的TopLink/Java DB – bguiz 2010-05-24 23:34:40