Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

findByPrimaryKey() returns null

 
Kalyan Akella
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks a lot for ur time. I have a CMP entity bean, Supplier, whose abstract schema is as below:
suppId - Integer (primary key),
suppName - String

This schema is already mapped with the underlying 'Supplier' table in the DB. Also, this table contains a few valid records. However, the findByPrimaryKey(Integer) method of this bean returns null.

Could some one please help me out with this problem. Do I need to configure any DB settings. I am using WSAD v5.1.2, CloudScape DB and CMP 2.0 specification.

I am also including the deployment descriptor for ur consideration:
<entity id="Supplier">
<ejb-name>Supplier</ejb-name>
<local-home>com.abc.xyz.entity.SupplierLocalHome</local-home>
<local>com.abc.xyz.entity.SupplierLocal</local>
<ejb-class>com.abc.xyz.entity.SupplierBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Supplier</abstract-schema-name>
<cmp-field id="CMPAttribute_1128583285244">
<field-name>suppId</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1128583285254">
<field-name>suppName</field-name>
</cmp-field>
<primkey-field>suppId</primkey-field>
<query>
<description></description>
<query-method>
<method-name>findBySuppName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>select object(o) from Supplier o where o.suppName = '?1'</ejb-ql>
</query>
</entity>

Bye
Thanks,
Kalyan
[ October 10, 2005: Message edited by: Kalyan Akella ]
 
rajeev rana
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kalyan,
The details provided by you are insufficient, you also need to mention the details
1) how you map your DB Table to CMP fields mentioned above
2) Have you defined the datasource and mentioned datasource name in the rdbms-jar.xml?
etc..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic