• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
  • salvin francis
  • Frits Walraven
  • Piet Souris

Home Business Methods

Posts: 4
  • Mark post as helpful
  • send pies
  • 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.
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • 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
  • 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.)
Do you want ants? Because that's how you get ants. And a tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic