Note that there are some explanatory texts on larger screens.

plurals
  1. POHQL : Multiple inner joins in HQL queries
    primarykey
    data
    text
    <p>I have many entities in my project , and i want to retrieve the data from multiple entities by using HQL query. In HQL query i try to use JOINS to retrieve the data from Entities , but it generate the exception when the code is executed. Following is the exception : </p> <pre><code>org.hibernate.hql.ast.QuerySyntaxException: Path expected for join! [SELECT s.id, s.name, s.url, s.uuid, s.createdBy , t.id , u.id , u.name FROM com.insonix.qrata.models.Site s INNER JOIN s.topics t INNER JOIN User u WHERE lower(s.name) LIKE lower(:name) AND s.createdBy IN (:created_by) AND u.id = s.createdBy] </code></pre> <p>Following is the Query : </p> <pre><code>SELECT s.id, s.name, s.url, s.uuid, s.createdBy , t.id , u.id , u.userinfo.firstname , u.userinfo.lastname FROM Site s INNER JOIN s.topics t INNER JOIN User u WHERE lower(s.name) LIKE lower(:name) AND s.createdBy IN (:created_by) AND u.id = s.createdBy </code></pre> <p>Following is my Entities : </p> <pre><code>public class CommonEntity { ------------------- private Long createdBy; private String uuid; ------------------------ } public class Site extends CommonEntity{ private long id; private String url; private String name; private Category category; private List&lt;Topic&gt; topics = new ArrayList&lt;&gt;(0); --------------------------- } public class Topic extends CommonEntity{ private int id; private List&lt;Site&gt; sites = new ArrayList&lt;Site&gt;(0); ----------------------------------- } public class User extends CommonEntity private long id; private UserInfo userinfo; -------------------------------- } public class UserInfo extends CommonEntity{ private String firstname; private String lastname; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload