[jboss-user] [JBoss Seam] - Renamed entity managers and s:convertEntity problem.

Delphi's Ghost do-not-reply at jboss.com
Mon Jul 9 14:37:19 EDT 2007

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?

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

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

More information about the jboss-user mailing list