• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

DAO with statefull session bean

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
105 When would you use the DAO pattern in regards to a Stateful Session Bean?
DAO = Date Access Object CMP = Container Managed Persistence BMP = Bean Managed Persistence

A When using CMP to reduce dependence on underlying data store.

B When using BMP to reduce dependence on underlying data store.

C When using BMP to increase performance.

D When using CMP to increase performance.

E You wouldn't use a DAO with Stateful Session Beans.

F When writing to a temporary store when ejbPassivate() is called

Ans: Choice E is correct.

But I have doubt why can't we use DAO for Statufull Session beans?
If we can use DAO with Statufull Session beans we can tick the answer B.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even I choose B as the answer. After I went through the answers, the only 2 reasons I could think of are
- DAO's make more sense when used with BMP entity beans (hence the question would read more like which type of beans would you possibly use DAO with)
- Stateful session beans would possibly instantiate 1 instance per usage (unless using some singleton DAO, which has another set of problems such as concurrency issues etc).

Anyone has other comments ?
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm...lets' see.


A When using CMP to reduce dependence on underlying data store.


Not correct. Needs no explanation.



B When using BMP to reduce dependence on underlying data store.


Yes. In fact use of a DAO pattern is encouraged with BMPs.


C When using BMP to increase performance.


Yes. Heard about bi-modal data access or fast lane readers?



D When using CMP to increase performance.


Nope.


E You wouldn't use a DAO with Stateful Session Beans.


Vague answer. The statement is too broad. What if you are not using entity beans? What if I use a SLSB layer between the DAO and the SFSB? Does the answer preclude this option or is it trying to imply nothing in between the SFSB and the DAO?



F When writing to a temporary store when ejbPassivate() is called


Again, a totally unrelated option. It appears as though some one threw this one just because they wanted to have a fifth option


HTH
 
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me add my 2 cents as well...

Stateful Session Bean is used to maintain the conversational state on behalf of the user across different activities (may be screen/workflow).

These activities would map to atleast 1 or more use cases. By this logic the SFSB would be implemented based on Session Facade.

Typically Session Facade uses one or more Business Objects (POJO or Entity Beans) to complete the business process.

In this context Answer E is correct.

Now one can argue that Session Facade can straight away use the DAO like in case of ValueListHandler design pattern.
 
I wasn't selected to go to mars. This tiny ad got in ahead of me:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic