| Here is the persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="60Capital-ejbPU" transaction-type="RESOURCE_LOCAL"> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /> <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/capital60" /> <property name="hibernate.connection.username" value="stephen" /> <property name="hibernate.connection.password" value="demo2016" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /> </properties> </persistence-unit> <persistence-unit name="60Capital-neo4j-ejbPU" transaction-type="RESOURCE_LOCAL"> <!-- Use the Hibernate OGM provider: configuration will be transparent --> <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="hibernate.ogm.datastore.provider" value="neo4j_http" /> <property name="hibernate.ogm.datastore.host" value="localhost:7474" /> <property name="hibernate.ogm.datastore.username" value="neo4j" /> <property name="hibernate.ogm.datastore.password" value="demo2017" /> <property name="hibernate.ogm.neo4j.database_path" value="C:/neo4j/database/tutorial" /> <!-- http://docs.jboss.org/hibernate/core/4.0/javadocs/org/hibernate/service/jta/platform/internal/package-summary.html <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.SunOneJtaPlatform" /> --> </properties> </persistence-unit> </persistence> The issue is Hibernate does not allow an application to have more than 1 instance of an entity manager/entity manager factory like other JPA frameworks eg EclipseLink. For example I am able to create and use multiple instances in EclipseLink but not in Hibernate like so: define @Bean(name="entityManagerFactory") public EntityManagerFactory entityManagerFactory() { return entityManagerFactoryJpaMysqlLocal().getObject(); } @Bean(name="entityManagerFactoryNeo4j") public EntityManagerFactory entityManagerFactoryNeo4j() { return entityManagerFactoryJpaNeo4jLocal().getObject(); } Use @Autowired @Qualifier("entityManagerFactory") EntityManagerFactory emfMysql; @Autowired @Qualifier("entityManagerFactoryNeo4j") EntityManagerFactory emfNeo4j; |