[jboss-user] [JBoss Seam] - Re: Lazy loading problem

xtia004 do-not-reply at jboss.com
Sun Jan 21 19:28:27 EST 2007


By further probing my code, I found it is actually caused by em.clear at another component. i.e. when I select a row at dataTable, the following code is executed:

  | InvoiceContacts invoiceContactsAction = (InvoiceContacts) Component.getInstance("invoiceContactsAction",
  | 				ScopeType.SESSION);
  | invoiceContactsAction.changeInvoice(getSelectedInvoice());
  | 

And code at component invoiceContactsAction is below:

  | @Stateful
  | @Name("invoiceContactsAction")
  | @Scope(ScopeType.SESSION)
  | public class InvoiceContactsAction implements InvoiceContacts {
  | 
  | 	@PersistenceContext
  | 	EntityManager em;
  | 	
  | 	...
  | 
  | 	public void changeInvoice(Invoice selectedInvoice) {
  | 		this.selectedInvoice = selectedInvoice;
  | 		tempList = null;
  | 		invContacts = null;
  | 		em.clear();
  | 	}
  | 	
  | 	...
  | }
  | 
So the question turn out to be: Why does clearing the entity manager at a component make the entity bean retrieved by another component detached under this situation?

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004664



More information about the jboss-user mailing list