GeeCON Prague 2014*
The moose likes EJB and other Java EE Technologies and the fly likes findByPrimaryKey() returns null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "findByPrimaryKey() returns null" Watch "findByPrimaryKey() returns null" New topic
Author

findByPrimaryKey() returns null

Kalyan Akella
Greenhorn

Joined: Oct 10, 2005
Posts: 1
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

Joined: Dec 30, 2004
Posts: 5
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..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: findByPrimaryKey() returns null