• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I run findByPrimaryKey method with CMP 2.0?  RSS feed

 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm deploying a local entity bean. I know that I can run any finder method with CMP 2.x by declaring it as abtract in the bean implementation class and then by defining the query in the deployment descriptor. My question is: how do I run the findByPrimaryKey method? Shall I write a query element in the dd? How do I execute it from the client?
Regards,
Marco
 
Sujatha Ranganathan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Here is a complete and basic tutorial on ejb ql -
http://otn.oracle.com/sample_code/tutorials/fbs/eql/toc.htm
Sujatha.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Container provides an implementation of ejbFindByPrimaryKey() for each CMP Bean without additional work on the part of the Bean Developer. All you have to do (and are required to do) is include an ejbFindByPrimaryKey method in your CMP's local home or remote home interface. This of course is assuming you got all the CMP deployment descriptor jazz correct.
To use the findByPrimaryKey method you just need to lookup the home interface and call findByPrimaryKey(). It would look similar to the following (ExampleHome and Example are the local home and local interfaces the the ejb)...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!