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(InterRepresentationTransformer.java:41)
        at
org.tranql.ejbqlcompiler.DerbyEJBQLCompilerFactory$DerbyEJBQLCompiler.transform(DerbyEJBQLCompilerFactory.java:69)
        at
org.tranql.sql.EJBQLToPhysicalQuery.expandToSQLQuery(EJBQLToPhysicalQuery.java:243)
        at
org.tranql.sql.EJBQLToPhysicalQuery.buildSelect(EJBQLToPhysicalQuery.java:171)
        at
org.tranql.sql.EJBQLToPhysicalQuery.buildSelects(EJBQLToPhysicalQuery.java:109)
        at
org.tranql.builder.SQLQueryBuilder.buildSelects(SQLQueryBuilder.java:204)
        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)


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 fr�he Vogel f�ngt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: 
http://mail.yahoo.de

Reply via email to