java - Path expected for join hibernate -


i have problem hibernate hql queries , simple inner join

string hql = "select new es.criteria.crc.model.queryobjects.namequery(pf.name) person p inner join phisicalperson pf pf.idpersona = p.idpersona";     return personservice.query(hql); 

my java file has following code:

public class namequery{     private string name;      public namequery(string name) {         super();         this.name= name;     }      public string getname() {         return name;     }      public void setname(string name) {         this.name= name;     } } 

i recieve following error in console:

   caused by: java.lang.illegalargumentexception: org.hibernate.hql.internal.ast.querysyntaxexception: path expected join! 

you need have association (@onetomany, @onetoone) between person , phisicalperson. having such association don't need where clause

select new es.criteria.crc.model.queryobjects.namequery(pf.name)      person p inner join p.pf 

in example pf property of person, associated phisicalperson.

class person {      @onetoone(mappedby = "person")     private phisicalperson pf;  }  class phisicalperson {      @onetoone(fetch = fetchtype.lazy)     @joincolumn(name = "fk_person")     private person person;  } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -