Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 5051 invoked from network); 4 Dec 2009 23:18:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Dec 2009 23:18:54 -0000 Received: (qmail 7431 invoked by uid 500); 4 Dec 2009 23:18:54 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 7396 invoked by uid 500); 4 Dec 2009 23:18:53 -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 7386 invoked by uid 99); 4 Dec 2009 23:18:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2009 23:18:53 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of davelamy@gmail.com designates 209.85.212.199 as permitted sender) Received: from [209.85.212.199] (HELO mail-vw0-f199.google.com) (209.85.212.199) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2009 23:18:51 +0000 Received: by vws37 with SMTP id 37so1429036vws.26 for ; Fri, 04 Dec 2009 15:18:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=NlDBwSazIS5B1L9KY+y6BWZIGQ3VIuA5TlW6hIW7kQ4=; b=ixT8kG3z/FGcKfSMNjjV7pj9XcYIy6BB8cNEFCxiwTprz3KJ8rqmyCirK5ygY1pLen 8jy5o0j9V3EBHKOiS/2FSs2fnzR9rjDH3VL/eMnNMstBnrpzssPS3/urhnaqKRIp7LmQ m7L//UjclEdi04az6nSaItWe1ILHXsdgPOKG4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=d65o+9hCFX614BxKyaIvlO84M3SU22QONq3L29gq0zm1PAVbSE4MC2eDjDcpIRTcdG xCNcQQ8XnEepRCDgHB1XMx4xNK/MxP7VEzbqLHz+Bxb/j4mQI5J0tneDnyPaQWbloKxC atqSLchK6ZxWSaiKIOT+GK0DNW2HiaeqGCjz0= MIME-Version: 1.0 Received: by 10.220.65.200 with SMTP id k8mr4803520vci.116.1259968710303; Fri, 04 Dec 2009 15:18:30 -0800 (PST) In-Reply-To: References: <9CBFE084-2984-4E29-B093-29EDE35BEA6F@objectstyle.org> From: Dave Lamy Date: Fri, 4 Dec 2009 17:18:09 -0600 Message-ID: Subject: Re: ParseException with EJBQL expression To: user@cayenne.apache.org Content-Type: multipart/alternative; boundary=0016e64692ae67e1710479ef5379 --0016e64692ae67e1710479ef5379 Content-Type: text/plain; charset=ISO-8859-1 FYI progress made today. I have successfully implemented a custom EJBSQL generator and am mainly getting stuff working. One question: is there a valid way to express that a relationship should be an outer join instead of inner? I'm not finding any docs about this. For example: SELECT a.name,COUNT(b) FROM Artist AS a, IN (a.paintings) AS b WHERE b.year BETWEEN 1800 AND 1900 GROUP BY a.name I want an Artist with 0 paintings from the years 1800-1900 to still come through as a result. Right now of course, it is not because the inner join removes that artist from consideration. So close.. Thanks again for the help-- Dave On Fri, Dec 4, 2009 at 10:09 AM, Dave Lamy wrote: > So one problem that I now understand is that EJBQL doesn't support > navigating over to-many collections inline, so "foo.productStyles.taxonomy" > would be invalid. In order to do that you have to do this whole > "IN(foo.productStyles) styles" bit in the FROM clause, at least according to > the specs. > > I don't know if this is causing the parse problem or not.. but it does > render the Expression.toEJBQL() rather useless. I would need to do my own > FROM/WHERE clause generation. > > I'll plug away at this and will let you know what I find out.. > > Dave > > > On Fri, Dec 4, 2009 at 8:09 AM, Dave Lamy wrote: > >> I can get rid of the likeIgnoreCase and see what happens. So I'm OK on >> the alias part right? In my other tests it didn't need an "as". I've >> mainly been concerned about whether that "doublehop" >> (.productStyles.taxonomy) would be valid or not. >> >> FYI that popped straight out of an Expression.toEJBSQL(). Not sure how >> best to handle situations like that, where the Expression supports a notion >> that EJBSQL does not. >> >> On Fri, Dec 4, 2009 at 7:31 AM, Andrus Adamchik wrote: >> >>> "likeIgnoreCase" is not valid in EJBQL. Although the error message refers >>> to something else... strange... >>> >>> >>> >>> On Dec 4, 2009, at 4:12 AM, Dave Lamy wrote: >>> >>> Hey guys-- >>>> >>>> I'm really just now getting into using the EJBQLQuery and am having some >>>> difficulties. I don't know whether I'm doing something fundamentally >>>> wrong >>>> or what. >>>> >>>> Here's my EJBQL expression that I'm trying to get parsed (running >>>> 3.0B1): >>>> >>>> select COUNT(foo) from ProductCollection foo where >>>> foo.productStyles.taxonomy likeIgnoreCase '323.%' >>>> >>>> Parsing this query yields the following exception: >>>> >>>> >>>> org.apache.cayenne.ejbql.parser.ParseException: Encountered " >>>> >>>> "foo "" at line 1, column 53. >>>> Was expecting: >>>> "(" ... >>>> >>>> at >>>> >>>> org.apache.cayenne.ejbql.parser.EJBQL.generateParseException(EJBQL.java:9419) >>>> at >>>> org.apache.cayenne.ejbql.parser.EJBQL.jj_consume_token(EJBQL.java:9298) >>>> at >>>> >>>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1933) >>>> at >>>> >>>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1911) >>>> at >>>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1776) >>>> at >>>> >>>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1738) >>>> at >>>> >>>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1928) >>>> at >>>> >>>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1911) >>>> at >>>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1776) >>>> at >>>> >>>> org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1738) >>>> at org.apache.cayenne.ejbql.parser.EJBQL.where_clause(EJBQL.java:1585) >>>> at >>>> org.apache.cayenne.ejbql.parser.EJBQL.select_statement(EJBQL.java:69) >>>> at org.apache.cayenne.ejbql.parser.EJBQL.parseQuery(EJBQL.java:41) >>>> ... >>>> >>>> The statement looks legit to me. Is there like a fundamental something >>>> I'm >>>> not understanding about EJBQL? I saw some docs that showed doing this >>>> sort >>>> of join alias "IN" thing, >>>> >>>> SELECT OBJECT(e) FROM Department d, IN(d.employees) e >>>> WHERE d.name = ?1 AND e.salary > ?2 >>>> >>>> My problem is that I'm using Expression.toEJBQL() to gen the where >>>> clause.. >>>> was hoping to not have to recreate my code that generates the Expression >>>> object. >>>> >>>> Help! >>>> >>>> Dave >>>> >>> >>> >> > --0016e64692ae67e1710479ef5379--