-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Hello, Gianny
glad to tell you that this ejbQL
select distinct count(p.id) from Post as p where p.thread.forum.id=?1
now works. At least I can deploy the ear without any sudden death :P
I'll implement the ejbHome method in some minutes to test if the
counting is correct ;)
Anyway, this ejbQL
select distinct r.user from ForumRolle r where r.userRolle.id=?1 order
by r.user.username asc
from the bean ForumRolle (see the other posts where I included the
source file) ends in an exception like this:
Caused by: java.lang.IllegalArgumentException: QuerySource
[EMAIL PROTECTED] and PrefetchGroup
[EMAIL PROTECTED]
do not match.
at
org.tranql.sql.prefetch.PrefetchGroupTransform.<init>(PrefetchGroupTransform.java:65)
at
org.tranql.builder.SQLQueryBuilder.buildSelects(SQLQueryBuilder.java:219)
at
org.openejb.deployment.CMPContainerBuilder.buildIt(CMPContainerBuilder.java:311)
at
org.openejb.deployment.AbstractContainerBuilder.createConfiguration(AbstractContainerBuilder.java:354)
at
org.openejb.deployment.CMPEntityBuilder.createBean(CMPEntityBuilder.java:213)
... 32 more
I'll recompile the forum project again with another prefetch for the
ejbSelect. Maybe that works :/
Best regards
Dirk
Gianny Damour schrieb:
> Hi,
>
> Thanks for reporting these problems. They are now fixed in HEAD of
> TranQL. Could you please download the latest TranQL-1.4-SNAPSHOT
> artifact and confirm that these problems are now fixed? You can simply
> drop this artifact in your repository and Geronimo will pick it up as it
> is the latest available version (thanks David J. for the hint).
>
> The Apache JIRA infrastructure is down at the moment. I will open two
> issues to track them when JIRA will become available.
>
> Thanks for your patience,
> Gianny
>
> On 20/10/2006, at 10:18 PM, Kaeto23 wrote:
>
>> Hello,
>>
>> OK, I tried your way now and at least Geronimo keeps talking to me. The
>> stacktrace now reads as follows:
>>
>> Caused by: org.tranql.ql.QueryException: Select [Select
>> method=[ejbSelectForumPostsNum]; EJB-QL=[select distinct count(p.id)
>> from Post as p where p.thread.forum.id=?1]] does not return a EJB and
>> defines the prefetch group [Default].
>> at
>> org.tranql.builder.SQLQueryBuilder.buildSelects(SQLQueryBuilder.java:224)
>> at
>> org.openejb.deployment.CMPContainerBuilder.buildIt(CMPContainerBuilder.java:311)
>>
>> at
>> org.openejb.deployment.AbstractContainerBuilder.createConfiguration(AbstractContainerBuilder.java:354)
>>
>> at
>> org.openejb.deployment.CMPEntityBuilder.createBean(CMPEntityBuilder.java:213)
>>
>> ... 32 more
>>
>>
>> It seems Geronimo wants a EJB in return. Counting is still a problem ;)
>>
>> I just consider to switch to JOnAS or JBoss ;)
>>
>> Milan: how did you count the EJBs? Do you also use the "Default"
>> prefetch group (only the CMP fields are loaded instead of CMP+CMR)?
>>
>> Best regards
>>
>> Dirk
>>
>>
>> Unger, Milan schrieb:
>>> 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:[EMAIL PROTECTED]
>>> 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:
>>> ...
>>> <query>
>>> <description>returns the number of entries</description>
>>> <query-method>
>>> <method-name>ejbSelectForumPostsNum</method-name>
>>> <method-params>
>>> <method-param>long</method-param>
>>> </method-params>
>>> </query-method>
>>> <ejb-ql>select distinct count(p) from Post as p where
>>> p.thread.forum.id=?1</ejb-ql>
>>> </query>
>>> ...
>>>
>>> openejb-jar.xml
>>> ...
>>> <query>
>>> <query-method>
>>> <method-name>ejbSelectForumPostsNum</method-name>
>>> <method-params>
>>> <method-param>long</method-param>
>>> </method-params>
>>> </query-method>
>>> <group-name>Default</group-name>
>>> </query>
>>> ...
>>>
>>> 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.<init>(PathTransformer.
>>> java:401)
>>> at
>>> org.tranql.ejbqlcompiler.PathTransformer$Context.<init>(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
>>>
>>
>> --Kaeto23
>>
>> HTTP: http://kaeto23.dnsalias.com (german!)
>> Jabber: jabber://[EMAIL PROTECTED]/DS2
>>
>> Reclaim Your Inbox!
>> http://www.mozilla.org/products/thunderbird/
>>
>>
>>
>>
>>
>> ___________________________________________________________
>> Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo!
>> Mail: http://mail.yahoo.de
>
>
- --
Kaeto23
HTTP: http://kaeto23.dnsalias.com (german!)
Jabber: jabber://[EMAIL PROTECTED]/DS2
Reclaim Your Inbox!
http://www.mozilla.org/products/thunderbird/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFPeztbiSTaBU+G6oRAxmkAJ4rzt7cgqJZArOyfN2nhpBC4LZ6hQCfbrw5
XH892Jln4xSCo18y7vJb6hg=
=luQZ
-----END PGP SIGNATURE-----
___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail:
http://mail.yahoo.de