Return-Path: Delivered-To: apmail-cayenne-dev-archive@www.apache.org Received: (qmail 26729 invoked from network); 31 Dec 2009 08:04:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 31 Dec 2009 08:04:31 -0000 Received: (qmail 63737 invoked by uid 500); 31 Dec 2009 08:04:31 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 63680 invoked by uid 500); 31 Dec 2009 08:04:31 -0000 Mailing-List: contact dev-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list dev@cayenne.apache.org Received: (qmail 63670 invoked by uid 99); 31 Dec 2009 08:04:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Dec 2009 08:04:31 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 31 Dec 2009 08:04:24 +0000 Received: (qmail 22916 invoked from network); 31 Dec 2009 08:04:03 -0000 Received: from unknown (HELO ?IPv6:::1?) (127.0.0.1) by localhost with SMTP; 31 Dec 2009 08:04:03 -0000 Message-Id: <369AF70D-367B-4533-BF84-675958FDCA2B@objectstyle.org> From: Andrus Adamchik To: dev@cayenne.apache.org In-Reply-To: <4B3C32E7.5010908@maniatis.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: Type-safe qualifiers Date: Thu, 31 Dec 2009 10:04:02 +0200 References: <79903751-CC7D-4D22-AAC3-2048F47E2CF5@objectstyle.org> <4B3C32E7.5010908@maniatis.org> X-Mailer: Apple Mail (2.936) On Dec 31, 2009, at 7:13 AM, Aristedes Maniatis wrote: > How does Key relate to Attribute and Relationship? Is it an > interface that both implement? Unrelated at all, except for the matching name. I thought of using Attributes/Relationships for this purpose, but it is not possible to parameterize them as they are abstract metadata. Their "compiled" counterparts (Property/ArcProperty) could've potentially been used as "keys", but those can't be statically bound to Persistent objects in compile time, as they are generated in runtime. > 2. New API: >> >> Expression clause1 = Artist.NAME.eq("X"); >> Expression clause2 = Artist.PAINTINGS.dot(Painting.NAME).eq("Y"); > > Would this be more in keeping with existing usage: > > Artist.PAINTINGS.join(Painting.NAME).match("Y"); > > and > > Artist.PAINTINGS.outerJoin(Painting.NAME).match("Y"); > > to emulate the "|" we have now. I like "dot" and "eq" because they have fewer letters, making things more tight. (also we used the term "path", not "join", so I guess there's really no precedent here). But good point about outer joins. Will definitely need to address that aspect. > At first glance Artist.PAINTINGS looks like it should be > >. But that breaks the type-safeness. We can > tell when a key represents a Relationship ( PersistentObject>) rather than an Attribute. But would we ever want > to know when it represents a to-many relation rather than a to-one? I had this question as well when first looking at Wonder. For the expression building stuff seems like it is ok to not make a distinction between to-one and to-many. However if we stumble on the case where we need to, we can simply subclass Key. (similar to Property/ArcProperty). > Expression qualifier = clause1.and(clause2.or(clause3).or(clause4)); I like this one. I guess we'll go with it. Andrus