Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

JBOSS CMP finder methods

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am new to JBOSS 3.2 environment and am experiencing problem in implementing the CMP2.0 beans. Though all the getter/setter methods of my CMP bean work properly, I am unable to get the finder methods to work. My client hangs when calling the finder methods of my CMP bean. Only the findByPrimaryKey is working properly. However, I have provided the ejbql for the custom finder methods.
I have also provided a sample of my ejb-jar.xml file for your reference. please let me know if I have to do any changes in ejb-jar.xml or the jbosscmp-jdbc.xml to make my code function.
<ejb-jar>
<description>JBoss Employee Sample Application</description>
<display-name>EmployeeEJB</display-name>
<enterprise-beans>
<entity>
<ejb-name>EmployeeBean</ejb-name>
<local-home>ejb.EmployeeLocalHome</local-home>
<local>ejb.EmployeeLocal</local>
<ejb-class>ejb.EmployeeBean</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>EmployeeBean</abstract-schema-name>
<cmp-field><field-name>empNo</field-name></cmp-field>
<cmp-field><field-name>empName</field-name></cmp-field>
<primkey-field>empNo</primkey-field>
<query><!---probably here lies the problem-->
<query-method>
<method-name>findByEmpName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(e) FROM EmployeeBean AS e WHERE e.empName = ?1]]>
</ejb-ql>
</query>
</entity>
</enterprise-beans>
<!--....assembly descriptor...follows....-->
</ejb-jar>
here follows the extract of my jbosscmp-jdbc.xml file
<enterprise-beans>
<entity>
<ejb-name>EmployeeBean</ejb-name>

<datasource>java:/LibraryDS</datasource>
<datasource-mapping>Oracle8</datasource-mapping>

<create-table>true</create-table>
<remove-table>true</remove-table>

<table-name>EmployeeEJB</table-name>

<cmp-field>
<field-name>empNo</field-name>
<column-name>empno</column-name>
</cmp-field>
<cmp-field>
<field-name>empName</field-name>
<column-name>empname</column-name>
</cmp-field>
</entity>
</enterprise-beans>
Eagerly waiting for any response.
Thanks,
Teena
reply
    Bookmark Topic Watch Topic
  • New Topic