10:16:55.616 [http-nio-8080-exec-8] ERROR org.hibernate.hql.internal.ast.ErrorCounter - Unable to locate appropriate constructor on class [com.qianxunkuaiji.entity.query.ChronologicalBookQuery]. Expected arguments are: java.util.Date, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, double, double, int
[cause=org.hibernate.PropertyNotFoundException: no appropriate constructor in class: com.qianxunkuaiji.entity.query.ChronologicalBookQuery]
[cause=org.hibernate.PropertyNotFoundException: no appropriate constructor in class: com.qianxunkuaiji.entity.query.ChronologicalBookQuery]

答:

上面的voucher.voucherType.voucherType刚开始写的是voucher.voucherType,这个是获取到一个voucherType对象
在对应 query查询类里刚开始定义的是VoucherType voucherType,不确定能不能获取到对象
所以直接定义成了String,对应的hql语句里new的也改成了voucher.voucherType.voucherType-String类型。

本文针对Hibernate在尝试实例化特定查询类时遇到的构造函数异常问题进行了解析,并提出了相应的解决方案,涉及到了属性类型不匹配导致的问题。
1945

被折叠的 条评论
为什么被折叠?



