• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Home Business Methods

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a real need for home business methods for Entity Beans? Would these methods not be better off in a Session Bean?
Most of what I have read has said that Entity Beans should be used to represent objects (or Nouns). And that Session Beans should be used to represent processes (or Verbs). Most of the examples of home business methods have been processe, e.g. update all Customers.
Thanks!
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HFE page 277
" A: Kind of. You're thinking of the session Facade J2EE design pattern. But even if you do put a session bean in front of an entity bean, the session bean is still a client. It might be a lot more efficient, because the session bean might not have as far to go on the network (and might even be on the same server as the entity). But if you'are keeping location-independence, then your session bean is still using the entity bean's Remote interface, so there's still a lot of overhead. "
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wasn't planning on responding to this post, but here goes.
In some instances home business methods are necessary to take advantage of certain EJB features like EJB-QL. When certain queries are applicable to a type of object versus an instance of an object, the home interface is a good place to put them. Then the method just delegates to ejbSelect methods taking advantage of the declarative nature of EJB-QL instead of having to work around it in some other manner. You certainly wouldn't want to spend all that time implementing the functionality in a SessionBean that you could do with one line of EJB-QL in your deployment descriptors.
I tend to think of home business methods are something analogous to static class methods. (It's not a perfect fit, but better than nothing.)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic