Hibernate hql return object

In Hibernate hql, I want to return Ojbect from hql,

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); 

      

mistake

    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)

      

but I have defined a constructor in HqlReturnObject.

thank

+3
spring hibernate


source to share


No one has answered this question yet

Check out similar questions:

996
What are the possible Hibernate hbm2ddl.auto config values ​​and what do they do
636
What's the difference between JPA and Hibernate?
341
Create the perfect JPA object
269
JPA and Hibernate - criteria versus JPQL or HQL
3
Hibernate criteria with Projections.groupProperty cannot return full hibernate object (ClassCastException)
3
Hibernate HQL with interfaces
1
Hibernate HQL returning stale data?
0
HQL fetches only one result from multiple results
0
Getting hibernate hql language objects
0
There is no Hibernate HQL query output.



All Articles
Loading...
X
Show
Funny
Dev
Pics