finder method runtime exception
I'm trying to create a CMP EJB. I create my Customer bean with a single finder method (findByPrimaryKey) and deploy it to the Sun Reference EE Server and everything works fine.
However, when I create a second finder method: findAll(), specify it's EJB-QL statement, and redeploy I get the following error message:
java.lang.RuntimeException: no method found for XML query element
I suspect that there's a problem with the deployment descriptor. Can anyone help?
Charlie Waddington
You're right, you're missing the query in the DD.
Every finder except for findByPrimaryKey must have an EJBQL string declared in its DD.
<entity>
<display-name>Test</display-name>
<ejb-name>Test</ejb-name>
<home>com.me.TestRemoteHome</home>
<remote>com.me.TestRemote</remote>
<local-home>com.me.TestHome</local-home>
<local>com.me.Test</local>
<ejb-class>com.me.TestBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>test</abstract-schema-name>
<cmp-field>
<field-name>pkFIeld</field-name>
</cmp-field>
<cmp-field>
<field-name>dataOne</field-name>
</cmp-field>
<cmp-field>
<field-name>dataTwo</field-name>
</cmp-field>
<query>
<query-method>
<method-name>findAll</method-name>
<method-params/>
</query-method>
<ejb-ql>SELECT OBJECT(o) FROM test AS o</ejb-ql>
</entity>
- Seth Osher
> I'm trying to create a CMP EJB. I create my Customer
> bean with a single finder method (findByPrimaryKey)
> and deploy it to the Sun Reference EE Server and
> everything works fine.
>
> However, when I create a second finder method:
> findAll(), specify it's EJB-QL statement, and redeploy
> I get the following error message:
>
> java.lang.RuntimeException: no method found for XML
> query element
>
> I suspect that there's a problem with the deployment
> descriptor. Can anyone help?
>
> Charlie Waddington