Initial Context in Session Facades

Discussions

EJB design: Initial Context in Session Facades

  1. Initial Context in Session Facades (3 messages)

    I've several references to other local entity beans in my session facade. It's better for me to lookup the home interface in setSessionContext() method or lookup up individually based on demand?

    public void setSessionContext(SessionContext ctx) {
    _ctx = ctx;
    try {
    Context initial = new InitialContext();
    _lookupLocalHome = (LookupLocalHome)initial.lookup(ServiceConstants.LOOKUP_LOCAL_JNDI);
    _idLocatorLocalHome = (IdLocatorLocalHome)initial.lookup(ServiceConstants.IDLOCATOR_LOCAL_JNDI);
    } catch (NamingException ne) {
    throw new EJBException(ne);
    }
    }

    Threaded Messages (3)

  2. Initial Context in Session Facades[ Go to top ]

    I think this might help you.


    Wrap your entity beans with one or more session beans. Each session bean should contain application logic to fulfill business use-cases. Each session bean performs bulk operations on entity beans on behalf of a single client request. Clients should have access to session beans only, not entity beans.
  3. Initial Context in Session Facades[ Go to top ]

    But how about Client's retrieving entity bean's properties?
    To write Value Object is a tedious work, which brings potential inconsistency in updating an entity bean.
  4. Initial Context in Session Facades[ Go to top ]

    Personally, I would get the references as needed. In fact, I would move the code somewhere else entirely...the petstore example has a helper class with static methods to do the lookups, which I think works reasonably well.