aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Part II architecture question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Part II architecture question" Watch "Part II architecture question" New topic
Author

Part II architecture question

Gabriel Claramunt
Ranch Hand

Joined: May 26, 2007
Posts: 375
Suppose I have a order of products to store.
I can think on 2 main options:
Use a stateless session bean calling an OrderDAO and OrderedProductDAO or use CMP Entity beans with managed relationships: OrderEJB and OrderedProductEJB.
In the real world, I always saw the first option (SLSB + DAOs), but somehow I expect the SCEA be more "entity bean friendly", and give more consideration to the second option (also I can show I know where I can use Entity EJBs)
Somehow I feel that both options are almost equally balanced and I can't really decide (or justify my decision).
Cade's book "conveniently" avoids the issue in the case study part...
What are your thoughts?


Gabriel
Software Surgeon
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

I would go for the SLSB + DAO instead of the CMP + EJB. Its light weight and flexible and it allows me to shift to CMP later (if i want) thanks to the modularity of the DAO. I dont think the exam is entity bean friendly. You have to justify the design more than anything. So if you choose CMP you could argue about lesser development time and performance (EJB 2 and above) etc etc. Each method has its own pluses and minuses.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Landim
Greenhorn

Joined: Dec 04, 2006
Posts: 7
You can go on SLSB + DAO and justify as a Fast Lane Reader. It's a J2ee pattern.


Landim - Arthur Landim Carvalho Costa<br />SCJP<br />SCBCD<br />SCEA
Gabriel Claramunt
Ranch Hand

Joined: May 26, 2007
Posts: 375
Originally posted by Landim:
You can go on SLSB + DAO and justify as a Fast Lane Reader. It's a J2ee pattern.

Thanks, Landim.
But what when you need to *SAVE* the data?
(Like persist the shopping cart with all the item orders...)
I think Fast Lane reader doesn't apply
I'm decided to use CMP beans, at least I can claim less developing time :-)
I don't believe CMP beans are considered good practice in part I and bad in part II
Beppe Catanese
Greenhorn

Joined: Nov 07, 2006
Posts: 27
Hi guys

I am thinking of an approach where I have a CMP entity for the basic unexpensive methods (add/edit/delete/get) and have a DAO fon only the multi-record methods (e.g. listAll, listByFilter).
In this way you can avoid coding the add/edit/delete/get (since the EJB container takes care of those) and, at the same time, get the benefits of DAO for retrieving large set of records (applying Value List Handler).

Obviously I would hide those 2 separate Business Objects behind a Session Facade.

In this way I would (try to) combine the benefits of CMP and the performance of SLSB/DAO.
Does this make sense to you guys?
Landim
Greenhorn

Joined: Dec 04, 2006
Posts: 7
Originally posted by Gabriel Claramunt:

Thanks, Landim.
But what when you need to *SAVE* the data?
(Like persist the shopping cart with all the item orders...)
I think Fast Lane reader doesn't apply
I'm decided to use CMP beans, at least I can claim less developing time :-)
I don't believe CMP beans are considered good practice in part I and bad in part II


Gabriel,
When I suggeted to use Fast Lane Readers was only for purpose of read-only data. As Beppe Catanese said you can combine the two solutions to achieve better performance (in case of heavy statements) and less developing time (simple methods like save, delete, et cetera).
Mix the solutions and you will have the best of the both.
Of course, you (the architect) will have to decide whats the best solution in a specific part of the use case.
[ June 12, 2007: Message edited by: Landim ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Part II architecture question
 
Similar Threads
accessing an ENtity bean from web?
What if the PK is also a FK ???
Suggestion on templated page
CMP Entity bean and oracle function
HFE "Brain Power" on p. 269