I'm using hibernate with xml mapping I'm trying to run some simple code without much success. I am confident that mapping and classes are correct as I am able to perform other queries using JPQL.
我正在使用hibernate和xml映射我试图运行一些简单的代码而没有太大的成功。我确信映射和类是正确的,因为我能够使用JPQL执行其他查询。
This is a snippet of my code:
这是我的代码片段:
CriteriaBuilder qb = em.getCriteriaBuilder();
CriteriaQuery<Report> myquery = qb.createQuery(Report.class);
Root<Report> report = myquery.from(Report.class);
List<Report> result = em.createQuery(myquery).getResultList();
And this is the Stack:
这是堆栈:
Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: null near line 1, column 29 [select generatedAlias0 from null as generatedAlias0]
...
...
Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: null near line 1, column 29 [select generatedAlias0 from null as generatedAlias0]
...
...
Any suggestion? Thanks!
有什么建议吗?谢谢!
1 个解决方案
#1
0
This might help: Bug fix related to CriteriaQuery (JPA) when using XML mappings
这可能会有所帮助:使用XML映射时,与CriteriaQuery(JPA)相关的错误修复
Your problem may actually be related to missing attribute definitions in your persistent and/or root classes. Good luck!
您的问题实际上可能与持久性和/或根类中缺少属性定义有关。祝好运!
#1
0
This might help: Bug fix related to CriteriaQuery (JPA) when using XML mappings
这可能会有所帮助:使用XML映射时,与CriteriaQuery(JPA)相关的错误修复
Your problem may actually be related to missing attribute definitions in your persistent and/or root classes. Good luck!
您的问题实际上可能与持久性和/或根类中缺少属性定义有关。祝好运!