Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JBOSS CMP finder methods

 
teena germany
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic