[jboss-user] [JBoss Seam] - Re: Seam 1.3.0.ALPHA UI example doubt

petemuir do-not-reply at jboss.com
Sun Jun 17 16:55:31 EDT 2007


Using a managed rather than detached entity causes the UOE to go away.

@Name("personAction")
  | @Scope(ScopeType.CONVERSATION)
  | public class PersonAction {
  | 
  |     @In(create=true)
  |     private EntityManager entityManager;
  | 
  |     private Person person;
  | 
  |     private Integer id;
  | 
  | 
  |     @Transactional
  |     public String update() {
  |         entityManager.joinTransaction();
  |         //entityManager.merge(person);
  |         entityManager.flush();
  |         return "Success";
  |     }
  | 
  |     @Transactional
  |     public Person getInstance() {
  |         if (person != null && entityManager.contains(person)) {
  |             return person;
  |         } else {
  |             entityManager.joinTransaction();
  |             person = entityManager.find(Person.class, id);
  |             return person;
  |         }
  |     }
  | 
  |     public Integer getId() {
  |         return id;
  |     }
  | 
  |     public void setId(Integer id) {
  |         this.id = id;
  |     }
  | 
  | }

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

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



More information about the jboss-user mailing list