This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Entity bean  RSS feed

 
ALaxmi Shankaran
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just started with the Entity bean....
Can anyone tell me regardig the finder methods that is the
findByPrimary key(object) is declared in the home interface....
So how the client get that???
 
sathish sathish
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
The finder Queries are used to find already existing data in the Persistent store.
If u use CMP entity beans, u don't need to implement any finder methods.
u have to specify them in the Home interface of the corresponding Entity bean and the appropriate EJB Query in the ejb-jar.xml file.
The container will implement the method for u.
But u should define an abstract method in the Entity bean class with return type as the primary key class or collection of such.
In case if u use BMP, then u should provide the implementation for the finder methods ur own data access logic.
Here again the return type should be primary key class or a collection of such.
Actually u return the primary key class to the container and the container in turn will create the required EJB objects and send it back to the client.
Remember, u can't access the EJB directly.
Also every entity bean should provide atleast one finder method called findByPrimarykey(Object) whether its CMP/BMP.
I hope u r a bit clear by now.
If u have any doubts, please do mail me at sathishkk@planetasia.com
Thanx
Sathish
Originally posted by ALaxmi Shankaran:
I just started with the Entity bean....
Can anyone tell me regardig the finder methods that is the
findByPrimary key(object) is declared in the home interface....
So how the client get that???
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!