EJB Model Decision - Read-Only Access Pattern

Discussions

EJB design: EJB Model Decision - Read-Only Access Pattern

  1. EJB Model Decision - Read-Only Access Pattern (1 messages)

    Hi everyone,

    I am just joining the EJB community and have been looking for the appropriate pattern w/out luck.

    Here is the problem:

    I have content stored in a relational database that will be updated constantly by another application.

    I need to provide this content in the form of XML to large number of simulaneous clients at once (read-only). (I figured processing the list once from the database and building the DOM and XML, then pushing it out to the clients would be most efficient using EJBeans)

    So, I have routines that will check the database for updates and update the DOM. But, how do I manage the bean to consistently look for updates?

    USE: Entity Bean
    implement ejbCreate to build object
    implement ejbLoad to look for updates???
    don't implemnt ejbStore, ejbPassivate, ejbActivate (unnecessary)

    Any Suggestions?
  2. Hi,

    I would use a stateless session bean for this that caches the DOM tree but calls the database each time it's business method is called. If the database has been updated i reload the DOM tree (or rather the parts that have changed) cache it again and server it to the client..

    Of course you will need to get a reference to a datasource and use straight JDBC calls in your code, but it's definitely the fastest option,

    Cheers,

    Joost.