1 2 Previous Next 17 Replies Latest reply on Sep 20, 2012 6:38 PM by Andrew Wheeler

    Why @ViewScope and Seam Managed Persistence Context doesn't work?

    Rafael Meireles Newbie

      Hello friends,

       

      How I use Seam Managed Persistence Context with @ViewScope? When I put:

       

       

      @SuppressWarnings("unused")

      @ExtensionManaged

      @Produces

      @PersistenceUnit

      @ViewScope

      private EntityManagerFactory entityManagerFactory;

       

      This messege is showed: The annotation @ViewScoped is disallowed for this location

       

      So for test I use:

       

      @SuppressWarnings("unused")

      @ExtensionManaged

      @Produces

      @PersistenceUnit

      @ConversationScope

      private EntityManagerFactory entityManagerFactory;

       

      And my JSF Managed Bean:

       

      @Named

      @ViewScoped

      public class ClienteAction implements Serializable

       

      The EntityManager created by the seam is an EntityManager managed, it show like this: EntityManager$ManagedPersistenceContext$1828725225$Proxy$_$$_WeldClientProxy  (id=155)

      But when I test if an Entity is managed(entityManager.contains(entity)) the entity is managed only in the first ajax request, I think as, for each request a new conversation is created, therefore in the first ajax request the entity is managed by the entityManager.

        1 2 Previous Next