[JBoss Seam] - Renamed entity managers and s:convertEntity problem.
by Delphi's Ghost
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
18Â years, 10Â months
[JBoss Getting Started Documentation] - Could not bind factory to JNDI
by rrrr
Very Urgent........
i use Jboss application server, i want to use hibernate of one class
when i do so, there are exception occurs
WARNING: Could not bind factory to JNDI
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getNameParser(Unknown Source)
at org.hibernate.util.NamingHelper.bind(NamingHelper.java:52)
at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:90)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:306)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at com.asal.Util.HibernateUtil.(HibernateUtil.java:20)
at com.asal.person.PersonHome.getSessionFactory(PersonHome.java:42)
at com.asal.person.PersonHome.(PersonHome.java:20)
at com.myapp.runit.main(runit.java:15)
1...3......................5
1
Exception in thread "main" org.hibernate.HibernateException: saveOrUpdate is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
at $Proxy0.saveOrUpdate(Unknown Source)
at com.asal.person.PersonHome.savePerson(PersonHome.java:51)
at com.myapp.runit.main(runit.java:17)
i need detialed information about how can i bind it with JNDI...
can any one Help? please reply me on rshakhsheer(a)asaltech.com
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062089#4062089
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062089
18Â years, 10Â months