i'm after what is "legal" according to the ejb 2.0 spec as far as what can a stateless session bean do in its ejbCreate method. the spec (section 7.8.2) says in the ejbCreate and ejbRemove (second s/b irrelevant for slsb) it can access: SessionContext methods: getEJBHome, getEJBLocalHome, getEJBObject, getEJBLocalObjectm and has JNDI access to java:comp/env.
it also says (just above the table there in 7.8.2), "If a session bean instance attempts to access a resource manager or an enterprise bean and the access is not allowed in Table 3, the behavior is undefined by the EJB architecture.".
so, this raises the question. it seems that i can do a jndi lookup to get a reference to the home of another bean, correct? but is calling the home.create() method to get a reference to another bean aloud per the specification? the home isn't an enterprise bean per se. it just gets me to the bean.
then how about calling home "business" methods on a entity bean? ( i don't think slsb's can have home business methods, correct?). maybe i have an entity bean that has a CoolEntityBeanHome.updateAllOrdersAccessDate() method in its home to "touch" the last access date for all orders in the db. can i call this home method from my ejbCreate of a slsb?
the table of section 7.8.2 is a little ambiguous, since it says what is alowd, but doesn't say vary many things that aren't alowd.
The slsb's create and remote method has unspecified tx context, so it is not allowed to call entity bean's home business method and create method.
SCJP, SCWCD, SCBCD, SCDJWS, OCA9i,<br />IBM Certified WAS5.0 Admin<br />IBM Certified Solution Developer - WebSphere Studio 5.0<br />IBM Certified Solution Developer - XML and related Technologies
posted 16 years ago
thanks for the response. am i aloud to call the create on the home of another slsb from the ejbCreate of a slsb? the spec lists what i can do, but it doesn't say that that's all i _can_ do. it lists that i can't access a resource manageer (get a db connection i assume), and it lists that i can't access an ejb, but it doesn't say that i can't call the home of a bean that i got from jndi, and it doesn't say that i can't call create on that home to get a reference to another slsb.