在Hibernate HQL中,我想从HQL返回一个Object,
public class HqlReturnObject implements Serializable{
String domain;
String id;
Object obj;
public HqlReturnObject() {
//super();
}
public HqlReturnObject(String domain, String id, Object obj) {
this.domain = domain;
this.id = id;
this.obj = obj;
}
......
}
String hql = "select new HqlReturnObject('order',salesOrderId, document) from ... ";
this.getHibernateTemplate().find(hql);
错误是
java.lang.NullPointerException
at org.hibernate.util.ReflectHelper.getConstructor(ReflectHelper.java:172)
at org.hibernate.hql.ast.tree.ConstructorNode.resolveConstructor(ConstructorNode.java:114)
at org.hibernate.hql.ast.tree.ConstructorNode.prepare(ConstructorNode.java:88)
但是我在HqlReturnObject
中定义了一个构造函数。
由于