[jboss-user] [Persistence] - Re: how to create PersistenceUnit and map to dataSource prog
javatwo
do-not-reply at jboss.com
Sun Nov 22 11:22:08 EST 2009
Thanks for help.
If one peristence unit is mapped to many data sources(with same tables), is there any problems with Hibernate caching?
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>
But the following works.
@PersistenceContext (unitName="unit1")
| protected EntityManager em;
What is the right way to create entityManagerFactory? Thanks!
Dave
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266927#4266927
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266927
More information about the jboss-user
mailing list