Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Part II architecture question

 
Gabriel Claramunt
Ranch Hand
Posts: 375
Monad Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Landim
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can go on SLSB + DAO and justify as a Fast Lane Reader. It's a J2ee pattern.
 
Gabriel Claramunt
Ranch Hand
Posts: 375
Monad Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic