Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateful bean mock ques..

 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NEed some clarification on this question..any help appreciated.

which of the following requiremtns make it mandatory to use stateful session bean instead of stateless session benas.

1.The container should be able to use any instance from the pool to process client's request.
2. session bean reads and updates the database on behalf of the client.
3.The client wants to control the lifecycle of the session bean.
4.The session bean should be notified of transaction boundary events.

Ans according me was 2,3
But the given answers are 3,4

Why is 2 wrong??

mallika
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mallika shah:
NEed some clarification on this question..any help appreciated.

which of the following requiremtns make it mandatory to use stateful session bean instead of stateless session benas.

1.The container should be able to use any instance from the pool to process client's request.
2. session bean reads and updates the database on behalf of the client.
3.The client wants to control the lifecycle of the session bean.
4.The session bean should be notified of transaction boundary events.

Ans according me was 2,3
But the given answers are 3,4

Why is 2 wrong??

mallika


Hi,

You can read and update the database in stateless sessions beans too. To control the creation and destruction of session bean is required stateful session beans. Also,transaction boundary events notification is only possible if stateful session implements SessionSynchronization interface.

Thanks
 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Narendra
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic