Hello guys,

I have a question about how to join multiple object entities.

Concrete sample :

I have 2 tables with no foreign key between them (poor database).

The first one is named SMASTER with 5 columns [SKDDATE (PK), SKDID (PK), JOBNAME (PK), JOBSTATUS, STSTATUS]. The second one is named JSTATMAP with 3 columns, [JOBSTATUS (PK), STSTATUS (PK), FILTERCAT].

I also have my cayenne user object entities named Smaster and Jstatmap with all their properties and their getters and setters.

I'm trying to create a cayenne query to retrieve Smaster objects related to a specifique FILTERCAT value. In pure SQL the request would be something like that:

SELECT SKDDATE, SKDID, JOBNAME, JOBSTATUS, STSTATUS
FROM SMASTER
   INNER JOIN JSTATMAP ON
       JSTATMAP.JOBSTATUS=SMASTER.JOBSTATUS AND
       JSTATMAP.STSTATUS=SMASTER.STSTATUS
WHERE JSTATMAP.FILTERCAT='CANCELLED'

But I can't find the way with cayenne to do the same thing with Query and Expressions. Is there a way to do a "JOIN" between two or multiple cayenne object entity?

Thanks.

Francois

Reply via email to