jpa - Hibernate JPQL Constructor Expression doesn't work with OneToMany field -


when try use constructor expression in jpql query

class companyprojection {     string name;     list<employee> employees;      public companyprojection (string name, list<employee> employees) {         ...     }     }  class company {     string name;      @onetomany(mappedby = "company")     list<employee> employees; }  class employee {      @manytoone      company company; } 

select com.foo.companyprojection(c.name, c.employees) company c

i org.hibernate.hql.internal.ast.querysyntaxexception: unable locate appropriate constructor on class [com.foo.companyprojection]. expected arguments are: java.lang.string, com.foo.employee[........]

from stacktrace above, understand hibernate expects second constructor argument have employee.class type instead of list.class.

but c.employees list. don't understand if bug in hibernate, or if i'm misusing it?

user error.

using multi-valued fields in select clause of jpql illegal syntax. see jpql bnf.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -