JPA for Graphdatabases - jpa

I thought about using a graph database for my new project. It's
a project with many social relations and many other things which
can easily be represented by a graph.
Graph-Databases are much faster so I started thinking about it.
However, I have a Java Enterprise Web Application and I have been using
(until now) a relational MySQL Database with JPA.
Now my question: Is there already the same JPA functionallity
for Graph-Databases like there is for relational Databases?
I would like to use Neo4j or OrientDB.

DataNucleus JPA provides persistence to Neo4j. Supports basic relationships and an amount of Cypher query capabilities, and there is a tutorial for use with JPA (as well as JDO). Open to contributions to push it further.
OrientDB also provides an amount of support for JPA annotations direct IIRC.

Related

Which is the best JPA practice in a production environment?

I have seen instances where developers create tables in the database then they use jpa tools to generate entities from the tables. There are also cases where entities are first created then the tables will be created by the JPA provider. Which is the best approach?
When I learnt java ee web I used the jpa provider to create entities for me in the database.
Both approaches work. This poll by JPA Buddy shows that 56% of developers manage their data model in the database and then synchronize DB tables with JPA entities, while 44% develop the data model as JPA entities and update the database in accordance with modifications in Java code.
So, there is no right answer to your question. If you fully control your database you can follow any path you prefer. Note, that JPA tools will fully regenerate your classes. You can use IntelliJ IDEA you can use JPA Buddy which provides a cherry-pick way to upgrade your entities.
If you follow the entity first approach, you will need to upgrade your database accordingly using some DB versioning framework like Flyway or Liquibase. Make sure you don't use auto-dll by hibernate in production as it is explained in this tutorial.
If you are given the database, you have no option other than reverse engineer tables into entities.

Using entity framework with cassandra database

I am working on a new project which is to use Asp.net MVC 5 and Cassandra.
I am very OK working with entity framework.
Is there a way of connecting entity framework to a Cassandra database?
If not, can anyone help me with the necessary structures to have my MVC 5 application work with a Cassandra database?
More especially is the fact that i want to work with the MVC 5 identity.
I'll really appreciate any help.
All the old versions of EF, up to version 6.x, don't support NoSQL databases like Cassandra.
EF7 is still under development, but it's being designed to be flexible enough to support NoSQL databases. As of today, (Nov 2015) there isn't still any support for a NoSQL database in the current EF7 beta8. But we can expect to see it in the future.
For example you can see it mentioned in this article of MSDN magazine: Looking ahed to Entity Framework 7:
Beyond Relational
When Entity Framework was first introduced, Microsoft had a vision of it being used for a variety of data stores, though the first pass focused on relational databases. Non-relational databases existed at that time, but were not widely used, unlike the NoSQL databases—especially document databases—that are so popular today.
While EF is an Object Relational Mapper (ORM), developers who use it want to be able to use the same constructs to interact with non-relational databases. EF7 will provide a high level of support for this, but keep in mind what high level really means. There are vast differences between relational databases and non-relational databases and EF will not make any attempt to mask those differences. But for basic querying and updates, you’ll be able to use the patterns with which you’re already familiar.

What are the differences between Spring Data Neo4j 4 and neo4j-ogm?

I notice SDN4 has the concept of repositories and annotations for cypher queries, but this seems not much more than programming style? Neo4j-OGM seems straight forward, easy to set up, with a really practical and efficient API. I'm wondering why both projects exist. Are there any real differences between the two?
Spring Data Neo4j
http://projects.spring.io/spring-data-neo4j/
Neo4j OGM
https://neo4j.com/docs/ogm-manual/current/introduction/
The idea behind having separate projects is to enable as many developers as possible to integrate their JVM-based applications easily with Neo4j.
The two projects are closely related: Spring Data Neo4j's implementation is actually backed by the Neo4j OGM codebase. The Spring Data Neo4j project extends the capabilities of the OGM by allowing developers to work with familiar concepts - Repositories, Transactions, Templates, Derived Queries and so on.
However for developers who don't want to (or cannot) use the Spring stack, having a separate OGM project means they do not get shut out from using Neo4j.

Hibernate OGM over Spring-Data is valid?

I want to create an project and using MongoDB and Neo4J, both databases are need to use. Now the day's Hibernate OGM concept was launch and support provide for all NoSQL databases. If i am go for Hibernate OGM they used JPA apis for implementation and it is easy user for Hibernate users. If i am go for Spring-Data, we need to configure both Spring-Data MongoDB and Spring-Data Neo4j and use Spring-Data apis for that. My team is confuse for which technology we go Hibernate OGM or Spring-Data. We focus on some points and Go for Spring-Data. Points are as below:
Spring-Data is a early concept, the support for Spring-Data is easily provide at online forums but Hibernate OGM is new.
Spring-Data have various features for NoSQL databases, but for Hibernate OGM we are not sure all feature are provided that mention in this slide.
Hibernate OGM use JPA queries and JPA queries translate according to NoSQL vendor query and i think this cause performance issue. But in Spring-Data we easily user Cypher Queries and Mongo Template.
I am also confuse for Hibernate OGM have full support for Graph Db feature like maintain attributes of relationship?
Please suggest me for which technology we need to go.
If you choose to use two different NoSQL databases on a same project, it's probably because you really really need of their uniq features (geo-spatial queries on MongoDB, being able to execute graph traversals for Neo4j, and so on).
So Hibernate OGM is clearly NOT for you. You can use directly native API of Mongo and Neo4j. Or you can use Spring Data that claims to provide a consistent programming model (but not a single API).

Difference between JPA and JDO?

want to develop my project on Google App Engine .I want to use google big table as database. For the database I have two options JPA and JDO. Will you guys please suggest me on it? Both are new for me and I need to learn them. So I will be focused on one after your replies.
Since you're using Data Nucleus, see their FAQ on JDO vs JPA. http://www.datanucleus.org/products/accessplatform_3_0/jdo_jpa_faq.html
DataNucleus AccessPlatform supports both JDO and JPA specifications of Java persistence. As such it has no "vested interest" in either technology, believing that it is for users to choose which they like best. There has been much FUD on the web about JDO and JPA, largely perpetrated by RDBMS vendors. This FAQ corrects many of these points
A key difference is that JDO support a rich domain model (logic together with data), in fact all persistent classes can have a reference to the current PersistenceManager, issue queries, and, I guess, it's possible not to have fields persistent by default.
JPA does not support such software design. In fact each Entity doesn't have a reference to the PersistenceManager, to have it you have to resort to ThreadLocal variables, which is not a very elegant and robust solution.
Since GAE BigTable is not an RDBMS, JDO is a better choice. There are some detailed comparision articles in Aphache JDO, it is helpful for me.
JPA persists java objects to relational data via ORM, while JDO is more general specification for java object persistence. So using JDO will give you more freedom in storage implementation options for your objects.
JPA is the leading java standard for persistence. So I'll say use JPA if you are using RDBMS and require ORM.
Hibernate is generally used as JPA implementation. If you need some extra features you can use hibernate specific annotations.
This question already looks to be discussed here JDO vs JPA for Java on Google App Engine