1 Reply Latest reply on Jul 9, 2007 2:51 PM by pmuir

    Renamed entity managers and s:convertEntity problem.

    delphi'sghost

      Hey all, I came across something and I don't know whether this is by design or not so I thought I'd check, and create a JIRA if needed. I'm using Seam 2.0 Beta.

      I create a new app and since I connect to two databases, I have custom named entity managers in components.xml :

       <persistence:managed-persistence-context name="myEntityManager"
       auto-create="true"
       persistence-unit-jndi-name="java:/myEntityManagerFactory"/>
      
      


      So, all works well, I can inject the entity manager using :

      @In
      private EntityManager myEntityManager;
      


      All works great, but I tried to use s:convertEntity with a select items, and ran into an NPE :

      SEVERE: Error Rendering View
      java.lang.NullPointerException
       at org.jboss.seam.persistence.HibernatePersistenceProvider.getSession(HibernatePersistenceProvider.java:157)
       at org.jboss.seam.persistence.HibernatePersistenceProvider.getId(HibernatePersistenceProvider.java:114)
       at org.jboss.seam.framework.EntityIdentifier.<init>(EntityIdentifier.java:15)
       at org.jboss.seam.ui.converter.EntityConverterStore.put(EntityConverterStore.java:60)
       at org.jboss.seam.ui.converter.EntityConverter.getAsString(EntityConverter.java:69)
      


      Looking through the source, the PersistenceController class has an abstract method called getPersistenceContextName(), which in the MutableEntityController returns the String "entityManager".
      The EntityConverterStore is inherited from the MutableEntityController.

      So, based on the source, I'm assuming everything is working as planned, but is there any way to use s:convertEntity, or do I need to derive my own converters, probably one for each database?