Need to access read-only data: can I just use session beans?

Discussions

EJB design: Need to access read-only data: can I just use session beans?

  1. Folks:

    I need to aggreate read-only data from a variety of data sources. Can I just use stateless session beans for now and avoid all the complexity of entity beans entirely?

    Regards,

    - Dan -
  2. Hi
    there
    this is best solution to use stateless session beans to read data you can also use DAO classes with Session beans
    which encapsulates data in this class objects and then pass it the Session benas method.

    ANy more doubts feel free to talk to me on

    ext-manoj dot sharma at nokia dot com

    Regrds
    Manoj
  3. Hi,

    Yep. If anyone else was using EJB for update then this would be an issue because of EJB caching causing problems.

    However, if you are going to code statless session beans using jdbc to access data then I'd seriously wonder about using EJB at all. All you risk doing is adding network and coding overhead. There is no evil in writing utility classes to access the database and to simple call these within the web layer.

    Any arguments about object re-use are pretty irrelevant as its a statless session bean. For speed and simplicity use a util class.

    If however, you think you may start using EJB for update at any time then you will be stuck. The EJB caching means write to the database may not happen for some time, meaning that any direct query on to the underlying database may return out of date information. You can configure the app server to write back all the time, but doing so means you lose performance...may not be an issue for low update volumes.

    I guess the answer is 'depends...'

    Jonathan