Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 90124 invoked from network); 8 Feb 2008 14:36:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Feb 2008 14:36:10 -0000 Received: (qmail 79445 invoked by uid 500); 8 Feb 2008 14:36:03 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 79201 invoked by uid 500); 8 Feb 2008 14:36:02 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 79191 invoked by uid 99); 8 Feb 2008 14:36:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Feb 2008 06:36:02 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of blacknext@gmail.com designates 64.233.184.232 as permitted sender) Received: from [64.233.184.232] (HELO wr-out-0506.google.com) (64.233.184.232) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Feb 2008 14:35:32 +0000 Received: by wr-out-0506.google.com with SMTP id c55so3320782wra.0 for ; Fri, 08 Feb 2008 06:35:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=eB/QZYoHR26R7cJ+8klfGm+2gSYsTHcfuEiLuBJ7O2U=; b=rd4pQEIgSDYZ8QiF9whx+06rjxg9n7m9zezOgKULwfgZXH6IAG7GaxS6HaseZwXBYw3BxnRYN3EnCPFKimaJFpoKZvcqQE23FnwI5TJ0unbXPJGOBVpcmwCzatyQfgDxN9eTbvYV+jIdQ/rDUfKz2+J9atMvEscmJZfG1fBxPNk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=grQ6bws0dTyyRL3G3/btMkLbOchgheLHwNP6WmsyZvaU7Mqewcw/WZVbLbQcAyW2zeFUzRX3wCOnLk/hiYXDWuHEnNwE9IWkUzwnstBySd1ESINFSjDmweFOHnpsBcZb382p08uLS8Z47Nlg06kroKUzZupFp4wSuTSWnf+zAwY= Received: by 10.142.212.19 with SMTP id k19mr6959269wfg.154.1202481338048; Fri, 08 Feb 2008 06:35:38 -0800 (PST) Received: by 10.142.180.20 with HTTP; Fri, 8 Feb 2008 06:35:38 -0800 (PST) Message-ID: Date: Fri, 8 Feb 2008 09:35:38 -0500 From: "Michael Gentry" To: user@cayenne.apache.org Subject: Re: Pb implement JOIN function In-Reply-To: <47AB7BBC.5030307@smaeur.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <47AB7BBC.5030307@smaeur.com> X-Virus-Checked: Checked by ClamAV on apache.org Using Cayenne Modeler, you can define a relationship from SMASTER to JSTATMAP using two joins. Create the join, say in SMASTER, and click the "I" inspector button to establish this. Will this do what you want? If so, then you should be able to perform your query something like this: Expression expression = Expression.fromString("jstatmap.filtercat = 'CANCELLED'"); SelectQuery = new SelectQuery(Smaster.class, expression); List values = dataContext.performQuery(query); If this isn't what you are looking for, look into the SQLTemplate feature. /dev/mrg On Feb 7, 2008 4:44 PM, Francois Eyl wrote: > 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 >