How to implment hibernate IN clause with Criteria?

Viewed 22

I'm working with hibernate to serach element into database. I have yhis sql query to implement with hibernate.

select * from PRESence presence0
   inner JOIN  AgentMJ agentmj1_ on presence0.FK_AGENTMJ_ID=agentmj1_.PK_AGENTMJ_ID 
   where  agentmj1_.PK_AGENTMJ_ID=18 
   and (presence0.typeContactLibre like 'Absence')
   and agentmj1_.PK_AGENTMJ_ID 
  in (
    select  agentmj1_.PK_AGENTMJ_ID from AgentMJ agentmj1_  
    inner JOIN  Absence absences2_ on agentmj1_.PK_AGENTMJ_ID=absences2_.FK_AGENT_MJ_ID 
    inner join TypeAbsence typeabsenc3_ on 
    absences2_.FK_TYPE_ABSENCE_ID=typeabsenc3_.PK_TYPE_ABSENCE_ID
    where agentmj1_.PK_AGENTMJ_ID=18 and  typeabsenc3_.code =1);

My problem is I can't implement the IN clause using hibernate. How to do that? and there is an example to see it?Thanks in advance.

0 Answers
Related