Hi,
I am trying to access 2 different datasources in my EAR. We have a MySQL database for all the standard operations, i am now trying to access a few tables from a differnt datasource.
The primary tables are accessed without a persistenceUnit, by using theDefaultDS configured. (i.e. I did not provide a unitName while creating the EntityManager)
So I added a persistence.xml to the META-INF with the following lines assuming the new entities and bean will use the unit-name provided in the persistence.xml. I have one entity called T1 and a bean to access it.
<?xml version="1.0" encoding="UTF-8"?> <persistence> <persistence-unit name="ragsDemo"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>com.rags.test.T1</class> <jta-data-source>java:/TestDS</jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <!-- <property name="hibernate.hbm2ddl.auto" value="create-drop"/> --> <!-- <property name="hibernate.hbm2ddl.auto" value="update"/> --> </properties> </persistence-unit> </persistence>
@PersistenceContext(unitName="ragsDemo") EntityManager em;
--- MBeans waiting for other MBeans --- ObjectName: jboss.j2ee:service=EJB3,name=com.rags.test.T1AccessBean State: FAILED Reason: java.lang.RuntimeException: unable to find: java:/managedEntityFactories/ragsDemo