Hello,
I created a Java application that can use SQL Server or Neo4j as a database without touching the application layer, I just modify the provider and the connection information, like follows:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
version="2.0">
<persistence-unit name="jpa-tutorial" transaction-type="RESOURCE_LOCAL">
<!--For SQL Server-->
<!--provider>org.hibernate.ejb.HibernatePersistence</provider>
<!--class>com.mycompany.hibernate.Atom</class-->
<!--For Neo4j-->
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<properties>
<!--For Neo4j-->
<property name="hibernate.ogm.datastore.provider" value="neo4j_embedded" />
<property name="hibernate.ogm.neo4j.database_path" value="D:/Stage/Neo4j/NEO4J_HOME_4/data/graph.db" />
<!--For SQL Server-->
<!--property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/atom" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="updatr" /-->
</properties>
</persistence-unit>
</persistence>
I have now to make the same thing but with a Spring application. I've started learning Spring but found a completely new logic. For example, there is a different provider of JPA:
Code:
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
Does that mean that there's no way to do the same as the first application? I mean there's no Hibernate OGM provider that I can just put in the place of HibernateJpaVendorAdapter in order to make the application running on Neo4j rather than SQL Server?
Thanks in advance.