[英]Hibernate is using wrong table name for order by expression with three level inheritance
[英]Hibernate : invalid ORDER BY expression
我试图像这样在我的Criteria
添加一些Order。
crit.addOrder(Order.asc("priority")); // Not the real property though
并使用带有HSQLDialect的MsAccess数据库在我的系统上进行测试
引起:org.hsqldb.HsqlException:ORDER BY表达式无效
所以我试图显示查询,它看起来像这样:
Hibernate:
/* criteria query */ select
distinct this_.i_id as y0_
from
T_FIT_ARTICLE this_
where
(
this_.b_export_ready=?
or this_.d_application_deadline>=?
)
order by
this_.d_application_deadline asc limit ?
//FROM HERE THE STACK TRACE
问题是,我之前在我的集合上使用了@OrderBy
注释,它产生了相同的查询,这有效:
order by
elements2_.i_order_nr asc limit ?
但是使用我的实体中的属性,它会导致异常。
顺便说一句,如果我尝试使用MYSQLSERVER
测试相同的程序,它可以完美地工作。
知道为什么或如何避免这种情况?
非常感谢 !
对于仍然感兴趣的人:问题是我设置了属性的投影并设置了另一个属性的订单。 这显然不受方言或数据库的支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.