what will happen if i use session beans for data storing?

Discussions

EJB design: what will happen if i use session beans for data storing?

  1. Hi,

    Please clarify my doubt any one.
    I want use session beans for data storing.
    Is it correct way?If not what's the problem?

    thanx
    rupali
  2.      Although this question may require much more indepth explanation here are some few points.
         I think a session object is a non-persistent object that implements some business logic running on the server.It also serves as a logical extension of the client program that runs on the server. A session object is not shared among multiple clients. It does not survive a crash and/or restart of the container, although a high-end container implementation can mask container and server crashes to the client. Therefore a session object is not meant to store any data other than that of a temporary requirement.
         Where as an entity bean is a component that represents an object-oriented view of some entities stored in a persistent storage, such as a database, or entities that are implemented by an existing enterprise application. Multiple clients can access an entity object concurrently.Each entity object has an identity which, in general, survives a crash and restart of the container in which the entity object has been created.
        If u use a session bean for data storage ..will that data survive a crash or is concurrently accessible etc etc..

    Ace.
        
        

  3. It depends what data you are storing.
    if you want to store data of that particular session it is okay to store it in the session. but if your server crashes in the mean time all the session details will be lost.

    and if you are using clusturing, it is not possible to pass this session details to another application server.

    but if you are using some permanent storage, it is possible for another appl.server to serve that client using the data available in the permanent storage.
    but this will become very costly,
    so the best way to store the data which are related to particular session is to store them in the session itself.