Discussions

EJB design: What are the advantages to using EJBs for read-only data?

  1. The only advantages I can think of right now are caching
    and connection pooling. But since databases implement
    caching, and jsp/servlets can access connection pools, I
    don't think the above reasons count.

    What are the other advantages?
  2. IMHO there are none, always use data objects or direct jdbc if you have read-only data

    Joost.
  3. Read-only ejb's source code is the same as the read-write ones.

    so if you want to change the read-only one to another situation, you dont have to do other programming,
    just modify the deploy files.

    I think maybe this is the advantage
  4. There is a difference in caching. If you have coarse grained ejb spanning several tables, your ejb's will map closer to the actual business objects. So the ejb object cache is likely to be smarter compared to the page level caching in the database.

    With entity ejb, it also saves a round trip to the database, provided the database is not accessed by any other application and unnecessary calls to ejbLoad() is prevented.

    Pranab