bebop o'saurus
2005-02-08 07:53:10 UTC
hello,
i'm new to ejbs; new to weblogic; using weblogic 8.1; playing around with
workshop. got a page flow that uses two ejb controls:
i) one ejb control for a stateful session bean
ii) one ejb control for an entity bean.
i read the e-docs section titled, "Using an EJB Control" and it tells me:
"...If the target EJB is a stateful session bean you must first invoke (one
of) its create method(s) to obtain a reference..."
"...After a reference is obtained, it is cached in the EJB control and is
used for any subsequent calls to the EJB within the method invocation in
which the initial call was made..."
"...For page flows and both stateful and stateless session EJBs, if the
session EJB is defined in the controller class, the lifetime of the
reference is the lifetime of the page flow..."
here are some snippets of my code:
// MyPageFlow.jpf
1. // get a reference to an entity bean from the control
2. EntityBean entity = entityBeanCtrl.create("username", "password");
3. // create new Stateful Session Bean Control
4. sessionBeanCtrl.create(entity, resources);
5. sessionBeanCtrl.setEntity(entity);
6. sessionBeanCtrl.setResources(resources);
7. sessionBeanCtrl.setUpAccount(signUpInfo);
.
.
.
the implementation of the ejbCreate() method for line 4 looks like this:
// MyStateFulSessionBean.ejb
8. // an ejbCreate() method of the MyStateFulSessionBean
9. public void ejbCreate ( EntityBean entity, ResourceBundle resources ){
10. // an instance method setting an instance var
11. setEntity(entity);
.
.
.
12. }
the implementation of the setUpAccount() method at line 7 looks like this:
13. // a business method of the MyStateFulSessionBean
14. public void setUpAccount(List accountInfo) {
15. // entity is the same instance variable set at line 9
16. if (entity == null ) {
17. throw new EJBException("entity cannot be null");
18. }
.
.
.
19. }
given that i have explicitly set the MyStateFulSessionBean's entity instance
variable from ejbCreate() with the setEntity(entity) call at line 11 from
the session bean, how come the entity instance variable at line 16 (which is
the same instance variable that was set at line 11) evaluates to null when
setUpAccount() is called from line 7 in the page flow?
likewise, even though i call setEntity(entity) and setResources(resources)
from lines 5 & 6 respectively, the instance variables that were set in those
two calls have been somehow reset back to null by the time
setUpAccount(signUpInfo) at line 7 is called from the page flow. what's
going on here?
contrary to what the e-docs say, the control is not caching the stateful
session bean's reference. i'm expecting the conversational state to still be
intact from method-call-to-method-call. but it seems like i'm getting a
brand new session bean reference with nulled-out instance variables with
each different method call from the page flow. does anyone know what i'm
overlooking? thanks in advance for your help.
i'm new to ejbs; new to weblogic; using weblogic 8.1; playing around with
workshop. got a page flow that uses two ejb controls:
i) one ejb control for a stateful session bean
ii) one ejb control for an entity bean.
i read the e-docs section titled, "Using an EJB Control" and it tells me:
"...If the target EJB is a stateful session bean you must first invoke (one
of) its create method(s) to obtain a reference..."
"...After a reference is obtained, it is cached in the EJB control and is
used for any subsequent calls to the EJB within the method invocation in
which the initial call was made..."
"...For page flows and both stateful and stateless session EJBs, if the
session EJB is defined in the controller class, the lifetime of the
reference is the lifetime of the page flow..."
here are some snippets of my code:
// MyPageFlow.jpf
1. // get a reference to an entity bean from the control
2. EntityBean entity = entityBeanCtrl.create("username", "password");
3. // create new Stateful Session Bean Control
4. sessionBeanCtrl.create(entity, resources);
5. sessionBeanCtrl.setEntity(entity);
6. sessionBeanCtrl.setResources(resources);
7. sessionBeanCtrl.setUpAccount(signUpInfo);
.
.
.
the implementation of the ejbCreate() method for line 4 looks like this:
// MyStateFulSessionBean.ejb
8. // an ejbCreate() method of the MyStateFulSessionBean
9. public void ejbCreate ( EntityBean entity, ResourceBundle resources ){
10. // an instance method setting an instance var
11. setEntity(entity);
.
.
.
12. }
the implementation of the setUpAccount() method at line 7 looks like this:
13. // a business method of the MyStateFulSessionBean
14. public void setUpAccount(List accountInfo) {
15. // entity is the same instance variable set at line 9
16. if (entity == null ) {
17. throw new EJBException("entity cannot be null");
18. }
.
.
.
19. }
given that i have explicitly set the MyStateFulSessionBean's entity instance
variable from ejbCreate() with the setEntity(entity) call at line 11 from
the session bean, how come the entity instance variable at line 16 (which is
the same instance variable that was set at line 11) evaluates to null when
setUpAccount() is called from line 7 in the page flow?
likewise, even though i call setEntity(entity) and setResources(resources)
from lines 5 & 6 respectively, the instance variables that were set in those
two calls have been somehow reset back to null by the time
setUpAccount(signUpInfo) at line 7 is called from the page flow. what's
going on here?
contrary to what the e-docs say, the control is not caching the stateful
session bean's reference. i'm expecting the conversational state to still be
intact from method-call-to-method-call. but it seems like i'm getting a
brand new session bean reference with nulled-out instance variables with
each different method call from the page flow. does anyone know what i'm
overlooking? thanks in advance for your help.