Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

db access: entity bean vs stateless sb

 
tom walters
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when we need access to database tables in our business logic, we use a dao in the stateless session bean containing the business logic instead of creating an entity bean and having the stateless session bean access the entity bean. when would an entity bean be the prefered solution? what are the advantages of using them instead of a dao in a slsb?
 
pjoisha
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We opted to do the same ... slsb + daos ... IMHO, one would need entity beans if you have a transactional requirement ...for readonly data I would stick with slsb + daos. One classic article which enlightens this subject would be
http://www7.software.ibm.com/vad.nsf/Data/Document2361?OpenDocument&p=1&BCT=66
PJ
[ October 02, 2002: Message edited by: Prashanth Joisha ]
 
Jim Baiter
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think with EJB 2.0, entity beans are becoming more popular because many of the performance problems have been solved. As Prashanth noted, they are more inline with using declarative services such as persistence and transactions.
 
John Carnell
Author
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I originally wrote most of my DAOs using Stateless session beans. However, even with the release of the EJB 2.0 spec, for most of the work I do I find a lot of the OS OR mapping tools like Torque or OJB are just too darn easy to use?
What are your opinions? :,>
 
Edward Farrow
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i too prefer
slsb --> dao
instead of
slsb --> entity bean --> dao
what are the effects on performance and scaleability? would the entity bean solution have better performance and scaleability? are there any articles or whitepapers discussing the tradeoffs?
 
Jim Baiter
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the entity bean camp argues now to
slsb --> entity bean (CMP)
instead of
slsb --> dao
or
slsb --> entity bean (BMP) --> dao
The CMP entity beans will be clustered by most containers so the scalability might be higher with them (although since it is recommended to use a session facade with local references I'm not really sure how this pans out). I don't see any general performance rationale, the benchmark would probably depend upon how well the container vendor implements the CMP.
[ October 06, 2002: Message edited by: Jim Baiter ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic