[jboss-user] [JBoss Seam] - Re: Seam-Managed Persistence Context

pete.muir@jboss.org do-not-reply at jboss.com
Tue Sep 4 16:00:23 EDT 2007


I would do something like - obviously you need to deal with the case your id is null better...

@Name("currentUserManager")
  | @Scope(CONVERSATION)
  | public class CurrentUserManager {
  | 
  |    @In(required="false", value="currentUserId") @Out(scope=SESSION, value="currentUserId")
  |    private Object id;
  | 
  |    @In
  |    EntityManager entityManager;
  | 
  |    @Factory
  |    public User getCurrentUser() {
  |       if (id != null) {
  |          return entitymanager.find(User.class, id);
  |       }
  |       return new User("noone");
  |    }
  | 
  | }

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

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



More information about the jboss-user mailing list