This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

EntityBean

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all,
This is my first post to the forum..I'll appreciate if someone help me out on this..My question is:
Can an EntityBean's Finder methods(defined with prefix ejbFind) access instance variables of the bean ??
 
author & internet detective
Posts: 42022
916
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
Maria,
Welcome to JavaRanch!

The finder methods are on the home interface and help to find the requested beans. They do not have access to the bean at all while doing their job. Therefore, they would not have access to instance variables on the bean.
 
Ranch Hand
Posts: 502
jQuery Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The finder methods are on the home interface and help to find the requested beans. They do not have access to the bean at all while doing their job. Therefore, they would not have access to instance variables on the bean.



Jeanne Boyarsky,

Correct me, If I'm wrong.

For BMP(Bean Managed Persistence) beans, ejbFind..() methods are implemented by Bean developer, so he can access Beans instance variable. But for CMP(Container Managed Persistence) beans, ejbFind..() methods are implemented by container.
 
Maria George
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replies..but i'm still confused ... i can't differentiate clearly between ejbHome and ejbFind methods...
According to the sun tutorials:
The Home Methods
A home method contains the business logic that applies to all entity beans of a particular class. In contrast, the logic in a business method applies to a single entity bean, an instance with a unique identity. During a home method invocation, the instance has neither a unique identity nor a state that represents a business object. Consequently, a home method must not access the bean's persistence state (instance variables). (For container-managed persistence, a home method also must not access relationships.)

The Finder Methods
The finder methods allow clients to locate entity beans.

Does that mean finder methods are only used to fetch some beans without doing any transactions on them and that home methods are meant to do some transactions on some particular beans??
Also I'm not clear on my above question yet as the tutorial doesn't say anything about it..
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Correct me, If I'm wrong.

For BMP(Bean Managed Persistence) beans, ejbFind..() methods are implemented by Bean developer, so he can access Beans instance variable. But for CMP(Container Managed Persistence) beans, ejbFind..() methods are implemented by container.



The finders run when the bean is pooled so I guess it wont make much sense to use their instance variables when one instance is trying to represent all other instances in the pool. However with home business methods and ejbSelect methods, they can run when the bean has full beaness and is out of the pool. So I think it might make more sense there. The home business methods and ejbSelect methods can run when the bean is pooled also.

I think you "can" access the instance variables but they would not have any persistence state, which kinda defeats the whole purpose of using them.
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic