[jboss-user] [JBoss Seam] - Re: how can I do optimistic locking with crud framework?

cja987 do-not-reply at jboss.com
Thu Oct 19 17:28:30 EDT 2006


I'm probably doing this completely wrong... I took contactHome out of components.xml and replaced it with this class:


  | @Name("contactHome")
  | @Scope(ScopeType.CONVERSATION)
  | public class ContactHome extends EntityHome<Contact> {
  | 	
  | 	@Logger
  | 	private Log log;
  | 
  | 	public ContactHome() {
  | 		super();
  | 		setCreatedMessage("New contact #{contact.firstName} #{contact.lastName} created");
  | 		setDeletedMessage("Contact #{contact.firstName} #{contact.lastName} deleted");
  | 		setUpdatedMessage("Contact #{contact.firstName} #{contact.lastName} updated");
  | 
  | 	}
  | 
  | 	@Begin
  | 	public String beginEdit() {
  | 		log.info("Conversation begun by beginEdit()");
  | 		return null;
  | 	}
  | 
  | 	@End
  | 	public String update() {
  | 		log.info("Conversation ended by update()");
  | 		return super.update();
  | 	}
  | 	
  | 	@Factory("contact")
  | 	public Contact initContact() {
  | 		return getInstance();
  | 	}
  | }
  | 
  | 


And I edited pages.xml to add the beginEdit action:


  |    <page view-id="/editContact.xhtml" action="#{contactHome.beginEdit}">
  |       <param name="contactId" value="#{contactHome.id}" converterId="javax.faces.Long"/>
  |    </page>
  | 



Everything works the way it did before (including "last edit wins") though now I get a traceback on the console after update:


  | 14:22:42,553 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) afterPhase
  | java.lang.IllegalStateException: EntityManager is closed
  |         at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:41)
  |         at org.hibernate.ejb.AbstractEntityManagerImpl.getReference(AbstractEntityManagerImpl.java:137)
  |         at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.entityIdsToRefs(ManagedEntityIdentityInterceptor.java:156)
  |         at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:76)
  | 



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

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



More information about the jboss-user mailing list