create EntityManager error
--------------------------
Key: JBAS-8036
URL:
https://jira.jboss.org/browse/JBAS-8036
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public (Everyone can see)
Environment: JBoss 5.1.0 GA
Reporter: Dave Chen
create a new persistence unit programmatically and map it to a new datasource without
redeploy or server restart.
We tried the following in a stateless session bean:
Map configOverrides = new HashMap();
EntityManagerFacotry emf = Persistence.createEntityManagerFactory("unit1",
configOverrides);
But got exception:
javax.persistence.PersistenceException: [PersistenceUnit: unit1] Unable to build
EntityManagerFactory
<persistence-unit name="unit1">
<jta-data-source>java:/dataSource1</jta-data-source>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>
08:17:58,204 ERROR [STDERR] javax.persistence.PersistenceException: [PersistenceUnit:
defaultDataSource] Unable to build EntityManagerFactory
08:17:58,205 ERROR [STDERR] at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
08:17:58,205 ERROR [STDERR] at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
08:17:58,205 ERROR [STDERR] at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira