• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Finder Methods, Create for CMP Beans

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot. I guess It will help me a lot.
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic