Yeah, but I'm not explictly calling @Start or @End on any of my methods.  How 
does Seam determine when I'm finished with this session bean?


  | package org.domain.myProject.session;
  | 
  | import static javax.persistence.PersistenceContextType.EXTENDED;
  | 
  | import java.util.List;
  | 
  | import javax.ejb.Remove;
  | import javax.ejb.Stateful;
  | import javax.ejb.Stateless;
  | import javax.persistence.EntityManager;
  | 
  | import javax.persistence.PersistenceContext;
  | 
  | import org.domain.myProject.entity.EmailAddress;
  | import org.domain.myProject.entity.Person;
  | import org.domain.myProject.session.local.EditPersonLocal;
  | import org.jboss.seam.ScopeType;
  | import org.jboss.seam.annotations.Destroy;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | import org.jboss.seam.annotations.Scope;
  | import org.jboss.seam.contexts.Context;
  | import org.jboss.seam.contexts.Contexts;
  | import org.jboss.seam.faces.FacesMessages;
  | import org.jboss.seam.log.Log;
  | 
  | @Stateful
  | @Name("editPerson")
  | //@Scope(ScopeType.EVENT)
  | public class EditPersonForm implements EditPersonLocal {
  | 
  |     @Logger
  |     private Log log;
  |     
  |     @In
  |     FacesMessages facesMessages;
  | 
  |     @PersistenceContext(type = EXTENDED)
  |     private EntityManager em;
  |     
  |     @In(required=false)
  |     @Out(scope=ScopeType.PAGE)
  |     private Person person;
  | 
  |     @In(required=false)
  |     @Out(required=false)
  |     private EmailAddress emailAddress;
  |     
  |     public void addEmail() {
  |             person.addEmailAddress(emailAddress);
  |     
  |             log.info("Email address " +emailAddress.getUrl() + " Added to 
"+ person.getName());
  |             
  |             emailAddress = new EmailAddress();
  |     }
  |     
  |     public void removeEmail(EmailAddress emailAddress) {
  |             log.info("Removing Email address " +emailAddress.getUrl());
  |             person.removeEmailAddress(emailAddress);
  |     }
  |     
  |     public void savePerson() {
  |             if (person.getId()!=null)
  |                     em.merge(person);
  |             else
  |                     em.persist(person);
  |             
  |             //Note that the id of our person was generated and populated.  
  |             facesMessages.add("Person was saved with an id of "+ 
person.getId());
  |             
  |             log.info(person.getName() +" was saved.");
  |     }
  |     
  |     public void editPerson(Person person) {
  |             log.info("Getting Id: " + person.getId());
  |             person = (Person) em.createQuery("from Person p where p.id =" 
+person.getId()).getSingleResult();
  |     }
  | 
  |      @Destroy @Remove                                                       
               
  |    public void destroy() {}
  |     
  | }
  | 

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

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

Reply via email to