hibernate/hibernate-ogm — pull request #226 by DavideD (2013-10-03 12:44:42+00:00)
Title: OGM-182 Support Neo4j as Datastore

https://hibernate.atlassian.net/browse/OGM-182

Neo4jGridDialect freshly rebased.

It seems to work but the only way I've found to syncronize transactions between OGM and Neo4j is by creating an implementation of ```JtaPlatform``` interface (```org.hibernate.ogm.dialect.neo4j.Neo4jJtaPlatform```) and assign it to the application that uses OGM with the property ```hibernate.transaction.jta.platform```. I'm not sure if this is the right approach but it was the only one that worked. I'm very open to suggestions.

At the moment only the emebedded version of Neo4j is supported. At the time I didn't find an existing working solution to connect to a remote Neo4j. I will probably create a new one that uses the restful API. It should be easy to plug that in since there is a common interface for the execution of the operation on the datastore (GraphDatabaseService).

Right now I'm using Neo4j 2.0.0-M03, If I use the latest version (2.0.0-M05) and I run the build it get stuck during the tests. I haven't checked yet what is the problem, it seems a lock that is not released.

As a reminder, the dialect converts every entity into a node and the attributes of the entity become the properties of the node.
A unidrectional associatoin between two entities is mapped with a relationship that starts from the node owning the relationship. The type of the relationship is the name of the association.
A bidirectional association is mapped with two relationships, one per direction.
It would be easier to see with some graph, do you know any nice tools to do this kind of things?

Every time I create a node for an entity, I add a property to the node that contains the name of the table representing the entity. In the latest realeses of Neo4j is possible to add labels to a node. Using labels it should be possible to remove the additional property and simplify the code. I need to investigate about it