• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB OOAD??

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in the book Mastering EJB II, it states that a OO system should contains 2 types of components.
1. Application logic component (action)
2. Persistant data component (data)
that really confuses me because in OO, aren't we suppose to have behavior+data in the same object? is that because of the fact that we are using EJB.. we have to separate them in Session bean and entity bean???
pls clarify.
 
Greenhorn
Posts: 9
Mac VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ernest,
the separation between session and entity bean is no break with OO. Okay, let me explain it...
A session bean should represent the business logic, i.e. createEmployee, deleteEmployee, etc.
The entity bean represents the data. The employee itself. It's only methods should be the getter/setter ones.
So, the data is clearly and cleanly seperated from business logic and that's no affront to OOA/D.
Have fun,
Ralf
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An Entity bean can have behavior (business methods other than get/set), but they should be methods appropriate for a single Entity instance.
An Entity bean (in EJB 2.0) can also have Home methods that are appropriate for acting on Entities of that "type" (not instance-specific), but should generally not deal with entities of other types.
In a system, you are most likely dealing with several Entity (data) types. For example you may have Employee, Customer, Manager, Address, Product, etc. The Application Logic generally deals with multiple entities - actions, interactions, relationships, etc.
If you think about MVC, the entities are the Model (data), the session beans are usually used to implement a Controler, and the View is the user interface (whatever that is - outside EJB usually).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic