I have a problem with Join in Criteria API - I need to execute this SQL: SELECT eventConf.DEPT_ID FROM EVENT_CONF eventConf JOIN EVENT event ON event.EVENT_CONF_ID = eventConf.ID JOIN TASK task ON task.EVENT_ID = event.ID;
Problem is, that when try to "translate" this into Criteria API classes, like this:
Subquery<Long> subquery3 = cq.subquery(Long.class); Root<EventConf> subquery3Root = subquery3.from(EventConf.class); Join<EventConf, Event> eventJoin = subquery3Root.join(Event_.eventConf); My IDE shows me, that
Cannot resolve method 'join(javax.persistence.metamodel.SingularAttribute<atc.edpo.source.entity.Event,atc.edpo.source.entity.EventConf>) It is understandable, because Event_.evenConf is type of SingularAttribute< Event, EventConf > and Root parameterized as EventConf, but how do you make a Join, when target entity contains id of source entity? Or can I make some kind of analog of Join in this situation?