Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 18681 invoked from network); 20 Oct 2006 08:30:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Oct 2006 08:30:47 -0000 Received: (qmail 19211 invoked by uid 500); 20 Oct 2006 08:30:45 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 19182 invoked by uid 500); 20 Oct 2006 08:30:44 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 19171 invoked by uid 99); 20 Oct 2006 08:30:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Oct 2006 01:30:44 -0700 X-ASF-Spam-Status: No, hits=0.3 required=10.0 tests=MAILTO_TO_SPAM_ADDR X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [211.29.133.193] (HELO mail30.syd.optusnet.com.au) (211.29.133.193) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Oct 2006 01:30:42 -0700 Received: from [10.1.1.4] (15.6.240.220.dynamic.dsl.rns01-kent-syd.comindico.com.au [220.240.6.15]) (authenticated sender gianny.damour) by mail30.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id k9K8UFFv024701 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Fri, 20 Oct 2006 18:30:19 +1000 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <7772F0DB-408F-46FC-A42A-36F30418B419@optusnet.com.au> Content-Transfer-Encoding: 7bit From: Gianny Damour Subject: Re: ejbSelect tutorial? Date: Fri, 20 Oct 2006 18:30:14 +1000 To: user@geronimo.apache.org X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello, Thanks for having provided this work around Milan. This is a bug in the processing of the COUNT aggregation function: the code assumes that the content of a COUNT is always a path expression and does not handle the case where only an entity is provided. Thanks, Gianny On 20/10/2006, at 6:04 PM, Unger, Milan wrote: > Hello, > > I faced similar problem, the trick to use following EJB QL: > > select distinct count(p.key) from Post as p where > p.thread.forum.id=?1 > > notice count(p.key) - where key should be a property of CMP bean. > I'm not sure if such syntax is required by EJB spec or simply a bug in > geronimo/open-ejb. > > Regards, Milan. > > -----Original Message----- > From: Kaeto23 [mailto:kaeto23@yahoo.de] > Sent: Thursday, October 19, 2006 6:55 PM > To: Geronimo ML > Subject: ejbSelect tutorial? > > Hello, > > today I started to work on a CMP that also provides a ejbSelect for > counting some contents from a database. Basically, a CMP named Post > which should count how much entries exist in the database. > > Nothing so hard ;) > > Anyway, Geronimo has some trouble to use the EJB so I'd like to know > WHAT is the problem :/ > > Here the code snippet that, when not commented out, makes the trouble: > > > > > @XD5EjbSelectMethode(descr = "returns the number of entries", ejbQL = > "select distinct count(p) from Post as p where p.thread.forum.id=?1") > public abstract long ejbSelectForumPostsNum(long forumId) throws > FinderException; > > > > Now XD5 creates the following deployment descriptor entries: > > ejb-jar.xml: > ... > > returns the number of entries > > ejbSelectForumPostsNum > > long > > > select distinct count(p) from Post as p where > p.thread.forum.id=?1 > > ... > > openejb-jar.xml > ... > > > ejbSelectForumPostsNum > > long > > > Default > > ... > > If these lines are present, Geronimo will crash with this exception: > > Caused by: java.lang.ClassCastException: org.tranql.ql.EntityReference > at > org.tranql.ejbqlcompiler.PathTransformer$Context. > (PathTransformer. > java:401) > at > org.tranql.ejbqlcompiler.PathTransformer$Context. > (PathTransformer. > java:380) > at > org.tranql.ejbqlcompiler.PathTransformer.visit(PathTransformer.java: > 73) > at org.tranql.ql.Query.visit(Query.java:59) > at > org.tranql.ejbqlcompiler.InterRepresentationTransformer.transform > (InterR > epresentationTransformer.java:41) > at > org.tranql.ejbqlcompiler.DerbyEJBQLCompilerFactory > $DerbyEJBQLCompiler.tr > ansform(DerbyEJBQLCompilerFactory.java:69) > at > org.tranql.sql.EJBQLToPhysicalQuery.expandToSQLQuery > (EJBQLToPhysicalQuer > y.java:243) > at > org.tranql.sql.EJBQLToPhysicalQuery.buildSelect > (EJBQLToPhysicalQuery.jav > a:171) > at > org.tranql.sql.EJBQLToPhysicalQuery.buildSelects > (EJBQLToPhysicalQuery.ja > va:109) > at > org.tranql.builder.SQLQueryBuilder.buildSelects > (SQLQueryBuilder.java:204 > ) > at > org.openejb.deployment.CMPContainerBuilder.buildIt > (CMPContainerBuilder.j > ava:311) > at > org.openejb.deployment.AbstractContainerBuilder.createConfiguration > (Abst > ractContainerBuilder.java:354) > at > org.openejb.deployment.CMPEntityBuilder.createBean > (CMPEntityBuilder.java > :213) > > > So, basically, do you have some examples or tutorials that show the > usage of ejbSelects with Geronimo 1.1.1? Let me know :) > > Best regards > > Dirk > > > > > > > ___________________________________________________________ > Der frhe Vogel fngt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: > http://mail.yahoo.de >