• Post Reply Bookmark Topic Watch Topic
  • New Topic

Finder Methods, Create for CMP Beans  RSS feed

 
Chandrasekhar Vidhyadharani
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we write finder methods for CMP2.0 beans? If so what is the procedure? Where can i find more about this? Do we make database calls for CMP beans?
The reason why i am aksing is coz i am trying to find a method where i can get all the methods of a table rather than for a particular record. For example i am trying to get all the catalog records for catalog table.
Can we write our own create methods for CMP2.0 beans? The reason is My CMP bean did not create a create method which will take foreign keys. I am just wondering how do i go about this.
Thanks in advance.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37253
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume from your other post that you are trying to this in WSAD.
Yes, you can write finder methods for CMP beans. You can search by a where clause, EJB-QL or a full SQL query. For CMP beans you write the finder clause and the container manages the database calls. You can also write a finder that does a findAll if you want all the rows in a table. For details on how to create a finder in WSAD, try looking at an IBM redbook.
You can add create methods as well. You add an ejbCreate method and an ejbPostCreate method with the same signature. In the ejbCreate method, you set the fields of the CMP.
 
Chandrasekhar Vidhyadharani
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. I guess It will help me a lot.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!