How to return Custom object with Criteria query

56 views Asked by At

I need to return a custom object with criteria query. With normal fields it is working fine. When i used List, it is throwing exception.

 @Entity
 class A {
      ...... remaining fields
      @OnetoMany()
      @JoinColumn(name = "b_id")
      List<B> b;
      @Column
      double amount;
  }

 @Entity
 class B {
     ...... remaining fields
     @Column
     String name;
 }
class customObject {
    List<B> b;
    double amount;
}

When I tried this one am getting exception below
Unable to locate appropriate constructor on class Expected arguments are: java.util.Collection,string.
Can some please tell me how to do this. Thank you.

0

There are 0 answers