Skip to content

Tag: hql

JPA createQuery where condition does not work

I am trying to use JPA to fetch records from database. However I am able to insert records indatabse and even get all the records using createQuery method of class EntityManager. But in below case I am not getting why the condition in where clause is not working. Please help me figure it out. POJO class : DAO class method:

Hibernate Join between 2 tables with foreign key

Im trying to get a list with results from join with two tables, but always get error. What i want is List with person and job name Error Cannot invoke “org.hibernate.hql.internal.ast.tree.FromElement.setAllPropertyFetch(boolean)” because “fromElement” is null My tables Person int id text name int job_id (foreign key with table JOB(id)) Job int id text name Entities DAO Answer To be able

HQL Join with three tables

I’m having some issues with HQL since I’m a newbie with it. Even though I don’t have issues with “simple queries”, I am currently stuck with a query involving three tables. I have already gone through some tutorials, but I haven’t been able to find a valid example for my needs. I have tried my best to explain my problem: