-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate OGM provider for Spring configuration
PostPosted: Sat Aug 16, 2014 9:21 am 
Newbie

Joined: Sat Jul 26, 2014 6:15 am
Posts: 4
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.


Top
 Profile  
 
 Post subject: Re: Hibernate OGM provider for Spring configuration
PostPosted: Mon Aug 18, 2014 3:31 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi,

I don't think you need the JPA vendor adaptor, e.g. see this SO post: https://stackoverflow.com/questions/9684197/why-did-i-need-to-define-a-hibernate-jpa-vendor-adapter-in-my-spring-application. You still can drive your persistence configuration through persistence.xml, also when working with Spring.

Hth,

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.