1 Reply Latest reply on Mar 3, 2009 1:14 AM by shane.bryzak

    JPAIdentityStore and PC indirection

    torbenjaeger

      i had problems persisting a user to the database unless having my pc named entityManager:



      <persistence:managed-persistence-context 
       name="entityManager"
       auto-create="true"
       persistence-unit-jndi-name="java:/myEntityManagerFactory"/>
      
      <security:jpa-identity-store
       user-class="MyUser"
       role-class="MyRole"/>
      



      did i miss sth?



      what do you think about having some indirection like


      <persistence:managed-persistence-context 
       name="anotherNameForEntityManager"
       auto-create="true"
       persistence-unit-jndi-name="java:/myEntityManagerFactory"/>
      
      <security:jpa-identity-store
       entity-manager="anotherNameForEntityManager"
       user-class="MyUser"
       role-class="MyRole"/>
      



      so that you can map the identity store to whatever PC you'd like?


      it's all about init() in JPAIdentityStore.java, right?



         @Create
         public void init()
         {                  
            ...
      
            if (entityManager == null)
            {
               entityManager = Expressions.instance().createValueExpression("#{entityManager}", EntityManager.class);
            }      
            ...



      thx for your time.


      torben