caching the results in webtier

Discussions

EJB design: caching the results in webtier

  1. caching the results in webtier (2 messages)

    can anybody tell me how can i store the results form a DB on the webtier..so that i can minimize the overlaod on the DB.Assume the request to the DB is specific. and let me know how the webtier gets updated when the DB gets changed. i am supposed to use j2ee and the DB cane be either DB2 or ORACLE

    thanks in advance.. gopikrishna.
  2. You can use the RowSet class, basically it works like a ResulSet, but you can store it, for a later use.

    i remenber, that i download an implemantation of a RowSet two years ago from java.sun.com/jdbc.
  3. You can use any object you like to store the data - but its bad design to pass jdbc objects such as a RowSet out of the data tier.

    Caching in the webtier can be done easily in the session scope using the Session object, but you probably want a global cache. This is a ubiquitous problem in j2ee.

    Options include:
    singleton design pattern: but this does not work in a cluster as singletons are usually implemented per jvm
    custom rmi cache: rmi application serving bound to the global jndi tree in the j2ee server, or bound to an external jndi tree
    3rd party cache solution: e.g. Oracle Objectcache or Tangosol
    See also read-mostly ejb pattern for a reasonable solution.