For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 3 replies, 3 voices, and was last updated 20 years, 1 month ago by
Greg.
-
AuthorPosts
-
Glenn PuckettParticipantI am adding my first finder method to my cmp ejb. I am getting what appears to be a fairly common problem, however, the fix that others have found to work is not applicable to my code. I was already handling the specification the way I was supposed to.
I have Eclipse SDK 3.1.2, MyEclipse 4.1.1 and am developing for JBoss 4.0.3 and MySQL 5.0.20.
I first developed the EJBs and the Struts interface using the default findByPrimaryKey(key) method of the EJB and everything has been working fine. Now as I am expanding the capabilities of the application I need to start getting more sophisticated with my table access.
I have added ejb.finders to 4 ejbs. When I deploy the project to JBoss it gives the following message for all off them.
Every finder method except findByPrimaryKey(key) must be associated with a query element in the deployment descriptorI have researched the problem and most people who have encountered it have not included full paths on the classes used in the signature. But I already have it in my code. So I am stuck.
Here is the information for one of the ejbs.
* @ejb.bean name="PartSales" * display-name="PartSales CMP entity bean" * description="Access the Part Sales Table" * jndi-name="ejb/PartSales" * type="CMP" * schema="PartSalesAccess" * cmp-version="2.x" * view-type="local" * primkey-field="partNbr" * @jboss.persistence * create-table = "false" * remove-table = "false" * table-name = "parts_sales_tbl" * @ejb.finder * query="SELECT OBJECT(s) FROM PartSalesAccess s WHERE s.partNbr = ?1 ORDER BY s.dateOfSale DESC" * signature="java.util.Collection findSalesForPart(java.lang.String partNbr)" * description="get all the sales for a part"This class also contains the following:
/** * @ebj.interface-method view-type = "both" * @ejb.persistence column-name = "partnbr" * @ejb.pk-field * @return */ public abstract String getPartNbr();And
/** * @ejb.interface-method view-type="both" * @ejb.persistence column-name = "date_of_sale" * @return */ public abstract String getDateOfSale();The ejb-jar.xml file that is generated contains the following:
<entity > <description><![CDATA[Access the Part Sales Table]]></description> <display-name>PartSales CMP entity bean</display-name> <ejb-name>PartSales</ejb-name> <local-home>com.newinv.interfaces.PartSalesLocalHome</local-home> <local>com.newinv.interfaces.PartSalesLocal</local> <ejb-class>com.newinv.ejb.PartSalesCMP</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>java.lang.String</prim-key-class> <reentrant>False</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>PartSalesAccess</abstract-schema-name> <cmp-field > <description><![CDATA[]]></description> <field-name>partNbr</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>dateOfSale</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>tranType</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>numParts</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>fullAmt</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>discountAmt</field-name> </cmp-field> <cmp-field > <description><![CDATA[]]></description> <field-name>totOrderSize</field-name> </cmp-field> <primkey-field>partNbr</primkey-field> <query> <description><![CDATA[get all the sales for a part]]></description> <query-method> <method-name>findSalesForPart</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql><![CDATA[SELECT OBJECT(s) FROM PartSalesAccess s WHERE s.partNbr = ?1 ORDER BY s.dateOfSale DESC]]></ejb-ql> </query> <!-- Write a file named ejb-finders-PartSales.xml if you want to define extra finders. --> </entity>So what am I doing wrong? This is my last big step in getting phase 1 of my project completed. After this everything is smooth sailing!! (I HOPE!!!! 8) )
Thanks for your interest and comments!!
Glenn Puckett
MetaMAP, Inc.
Lexington, KyJuly 13, 2006 at 8:39 pm #254760
Riyad KallaMemberGlenn,
Sorry at the lack of replies. I had no idea so I sent your request off to our two EJB guys, both of which were swamped and one got back to me and didn’t have any answer either.July 16, 2006 at 9:36 pm #254855
GregMemberGlenn,
Are these warnings or error? Do the EJBs work regardless?
Myabe you need to set the @jboss.finder-query xdoclet tag as well.
Here is the doc for the jboss tag.
http://xdoclet.sourceforge.net/xdoclet/tags/jboss-tags.html#@jboss_finder-query__0____I know that the jbosscmp-jdbc.xml descriptor has a query element. But I’m not for sure if it is required.
July 16, 2006 at 9:39 pm #254857
GregMemberWell I just read something that says that you only need the @jboss.finder-query if you are using non-standard EJB-QL, like JBossQL.
Are you sure that you are deploying the updated version? Because as you said, if you specify “java.lang.String” for method-param then it should be working just fine.
-
AuthorPosts
