Question

In a single execution thread, I need to persist certain data objects to Google DataStore using DataNucleus JDO model and other few objects to Cloud SQL using hibernate. I have read few posts stating that hibernate would require DataNucleus jars to be removed. Is there any way to make this work,

Thanks Sreejith

Was it helpful?

Solution

Did these "few posts" actually mention a reason? or was it just a bit of gossip? Like maybe the person involved was using an ancient version of GAE/Datastore that was for JPA 1.0 so had a persistence-api.jar for JPA 1 (it's been supported with JPA 2 for several years now, not that Google have changed the default to that yet, but anyway ...) which wouldn't work with Hibernate JPA (presumably requiring v2.0)? That is pure guesswork. The only way to answer that is for you to present facts.

If you have DataNucleus JDO then you don't need "datanucleus-api-jpa" in the CLASSPATH, so the only JPA impl in the CLASSPATH is Hibernate, so DataNucleus code is never called.

Even if you have DataNucleus JPA and Hibernate JPA in the CLASSPATH at the same time that is what the "persistence-provider" element is for in persistence.xml, to tell JPA "Persistence" class which provider is to be used.

Obviously DataNucleus JPA is also a compliant JPA (2.1) implementation so would itself work perfectly happily with RDBMS datastores.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top