Win a copy of Design for the Mind this week in the Design forum!
    Bookmark Topic Watch Topic
  • New Topic

J2EE - Pattern - Business Objects

 
Nithi Rajan
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Nithi Rajan
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Report post to moderator
This thread has already been discussed here -> http://www.coderanch.com/t/461755/Architect-Certification-SCEA/certification/J-EE-Pattern-Business-Objects
 
    Bookmark Topic Watch Topic
  • New Topic