Hi I am looking for JPA criteria query (Java code) for the following sql
My SQL Query:
SELECT @today := now();
select r.globalid, r.groupid from review r
left join group ug on r.globalid = ug.globalid
and r.groupid = ug.groupid --having problem here???
and @today between r.startdate and r.enddate
where ug.globalid is null
These are two entities named:
- Review (ID(Primary Key),GlobalId , GroupID,.....)
- Group (ID (Primary Key), GlobalId, GroupID, .....)
in the above two entities there are multiple columns.However,the two columns in both the entities are same they are, globalid and groupid
I would like to join both the tables with the matched columns using criteria query(Java JPA with Hibernate) as there is no entity relationship exists between these two entities I am confused how to join them.
Edit:
This is purely using JPA. Any help is greatly appreciated.