Hi All,

I have 2 'manager component' style beans.  One called the 'Accountant' and the 
other 'User'.  The idea is that in the session I store the id of these things 
and in my managers I get the real objects.  Both are ScopeType.CONVERSATION.  
Both also use SLSB's to make the call to get the data.

The idea is that I want it to be transparent to the application code that these 
objects are infact reread if they have not been cached in any current 
conversation.

The User manager is itself a SFSB while the Accountant is a POJO (I'm trying to 
see the results of both methods).

Now in another SFSB (my action handler) I get some odd results using the 
above...

My first question is:
1) If I Inject @In(value="User", required=true) I works first time the page is 
displayed, but second time get get a transaction not open exception.  If I 
change this to @In(value="User", create=true) it works ? 

2) If I Inject @In(value='Accountant', create=true) I get a 
6:23:48,343 WARN  [Contexts] Could not destroy component: accountantCRUDBean
  | javax.ejb.EJBNoSuchObjectException: Could not find Stateful bean: 
5c4o05-8pkcob-ezvcgh2q-1-ezvcx10a-2t
  |  but apart from that it works ? 

Here is my code:


  | @Stateful
  | @Name(UserComponentNames.User)
  | @Scope(ScopeType.CONVERSATION)
  | public class UserComponentManagerBean implements UserComponentManager {
  | 
  |     @In(value=UserComponentNames.UserId,required=false)
  |     private Long userId = null;
  |     
  |     @EJB
  |     private UserManagerLocal userManager; 
  |     
  |     @Logger private Log log;
  |     
  |     private User cachedUser=null;
  |     
  |     @Create
  |     public void create() {
  |             log.info("create");
  |     }
  |     
  |     @Unwrap
  |     public User getUserComponent() {
  |             if ( cachedUser!=null ) {
  |                     return cachedUser;
  |             }
  |             if ( userId!=null ) {
  |                     cachedUser = userManager.getUser(userId);
  |                     return cachedUser;
  |             }
  |             return null;
  |     }
  | 
  |     @Destroy  @Remove
  |     public void destroy() {
  |             log.info("destroy");
  |     }
  | }
  | 


  | @Name(AccountantComponentNames.Accountant)
  | @Scope(ScopeType.CONVERSATION)
  | public class AccountantComponentManager {
  | 
  |     @In(value=AccountantComponentNames.AccountantId,required=false)
  |     private Long accountantId = null;
  |     
  |     @In(create=true)
  |     private CompanyManagerLocal companyManagerLocal; 
  |     
  |     private Accountant cachedAccountant=null;
  |     
  |     @Unwrap
  |     public Accountant getAccountantComponent() {
  |             if ( cachedAccountant!=null ) {
  |                     return cachedAccountant;
  |             }
  |             if ( accountantId!=null ) {
  |                     cachedAccountant = 
companyManagerLocal.getAccountant(accountantId);
  |                     return cachedAccountant;
  |             }
  |             return null;
  |     }
  | }
  | 


  | @Stateful
  | @Scope(ScopeType.CONVERSATION)
  | @Name("accountantCRUDBean")
  | public class AccountantCRUDBean extends StandardCRUDBean<Accountant> 
implements AccountantCRUD, Serializable {
  |     private static final long serialVersionUID = 1L;
  | 
  |     @In(value=AccountantComponentNames.Accountant, create=true)
  |     private Accountant userLinkedAccountant=null;
  | 
  |     @In(value=UserComponentNames.User, create=true)
  |     private User user;
  | 
  |     @EJB
  |     private CompanyManagerLocal companyManager=null;
  |     
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032840#4032840

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032840
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to