0 Replies Latest reply on Oct 27, 2004 5:56 PM by sudhadoesnotexist

    EJB Remote interfaces and Caching

    sudhadoesnotexist

      Hello,

      I am rather new to this, so please excude my ignorance. I am developing an application that needs frequent read access to data in a database and infrequent write access. Hence I am using entity beans to access this data. For performance reasons, I will be using session beans as a wrapper around the entity beans. Now I have a few questions:

      1. I dont need a remote interface for my entity beans. If I do not specify the ejb-ref, will that suffice? How should my session beans instantiate the entity beans? Should the entity beans have ejb-local-ref mappings, and must the session beans use JNDI to instantiate the entity beans, or can the session beans directly call the constructor of the home interface - new MyEJBHome()?

      2. Can the home interface object be a singleton and simultaneously be used (without any synchronization) by multiple session beans?

      3. My application is a web application, servicing client requests. Though I can instantiate a session bean per request, this would be expensive since I do not want to have to refill properties from the entity bean/database for every request, unless there has been a change. I would like to share (stateful) session and entity beans across client requests (with proper synchronization, of course, so that one bean is used by one client at any point of time). How does JBoss manage the session/entity bean cache? Should I do application level caching (that sounds rather silly). I am using commit option A, btw, for the entity beans.