org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join!

I am using Hibernate 4.3.5 and basically running into the following problem with the query:

Query query = session.createQuery("FROM "
                    + " EmployeeProp cp JOIN Db db ON "
                    + "(db.dbId = cp.value ) WHERE cp.typeId=11111 AND cp.employeeId=12345 ");

Where EmployeeProp is an entity.

Db is an entity.

I keep getting the following error:

org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join! [FROM abc.def.package.orm.EmployeeProp cp JOIN Db db ON (db.dbId = cp.value ) WHERE cp.typeId=11111 AND cp.employeeId=12345 ]

And this is the SQL I have which I am trying to use in the HQL above:

SELECT * FROM employeeProp 
JOIN db ON (db.db_id=employeeProp.value)
WHERE type_id=11111 and employeeProp.employee_id=12345;

P.S. I am new to Hibernate

You don’t need to specify the ON clause for HQL which is only supported since 5.1. In entity queries, JOIN requires an association at the entity level (e.g. @ManyToOne, @OneToMany).

P.S. I am new to Hibernate

That’s why it’s important for you to read the entire User Guide.