This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes J2EE - Pattern - Business Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply locked New topic
Author

J2EE - Pattern - Business Objects

Nithi Rajan
Greenhorn

Joined: Oct 30, 2005
Posts: 29
Dear Friends,

Can you please tell me if the usuage of Business Object in the following sequence is correct?

StatelessSession Bean ----> Business Object ----> Entity ----> EntityManager ----> DB

Basically, I'm confused on Business Object. SUN's Core J2ee Patterns Map says
Business Object implements Entity link -> [http://www.corej2eepatterns.com/Patterns2ndEd/index.htm]

But can I have Entity [as in EJB3] outside Business Object and have the Business Logic
in Business Object. For Example say a method in the StatelessSessionBean needs to
change the Status of two different Entities, can I use Business Object to change the status of
the Entities [like below]?

StatelessSessionBean.endProcess() ----> BusinessObject1.setEntity1StatusClosed() ----> Entity1.setStatus(1)
StatelessSessionBean.endProcess() ---> BusinessObject2.setEntity2StatusClosed() ----> Entity2.setStatus(1)

The StatelessSessionBean will pass the id of Entity1 to BusinessObject1 and the BusinessObject1
will look up for Entity1 in EntityManager and set the status and persist in the DB
And again StatelessSessionBean will pass the id of Entity2 to BusinessObject2 and the BusinessObject2
will look up for Entity2 in EntityManager and set the status and persist in the DB

Is this the correct usuage of Business Object? (i.e) Business Objects are used to perform
certain task on Entities [like changing the status].

OR is the above implementation Wrong in the sense that Business Object are the Entities themselves
and they should implement the Entities. Business Objects cannot be separate from Entities.

Please help me understand Business Objects and what are they used for and where to use them.

Also, kindly let me know if my question is not clear.

Thanks & Regards!
Nithiraj.


SCEA5
Nithi Rajan
Greenhorn

Joined: Oct 30, 2005
Posts: 29
This thread has already been discussed here -> http://www.coderanch.com/t/461755/Architect-Certification-SCEA/certification/J-EE-Pattern-Business-Objects
 
Consider Paul's rocket mass heater.
 
subject: J2EE - Pattern - Business Objects
 
Similar Threads
EJB3 Beta Certification - EntityManager BASIC notes.
question on entityManager's merge/refresh/flush
Displaying different entity data in a vector on a page
EJB3 Beta Certification - Help =))
J2EE - Pattern - Business Objects