UsageJust like all of the other store plugins we aim to make its usage as seamless and transparent as possible so that you, the user, has a high level of portability for your application. In simple terms you just mark your model classes with JDO or JPA metadata (annotations or XML) just as you would do for RDBMS (or any other datastore), and write your JDO or JPA persistence code in the normal way. The only difference is that the data is persisted into Neo4j transparently. I've not had time to write up a tutorial yet, but the model and persistence code would be identical to persisting to any other datastore, just that in the definition of the datastore "URL" it would be something like
Refer to the DataNucleus docs for more details. Note that the plugin is not yet released, but is available as a nightly build for anyone wishing to give it a try
- Each object of a class becomes a Neo4j Node.
- Supports datastore identity, application identity, and nondurable identity
- Supports versioned objects
- Fields of all primitive and primitive wrappers can be persisted
- Fields of many other standard Java types can be persisted (Date, URL, URI, Locale, Currency, JodaTime, javax.time, plus many more)
- 1-1, 1-N, M-N, N-1 relation is persisted as a Neo4j Relationship (doesn't support Map fields currently)
- JDOQL/JPQL queries can be performed, and the operators &&, ||, ==, !=, >, >=, <, <= are processed using Cypher, with any remaining syntax handled in-memory currently.
- Support for using Neo4j-assigned "node id" for "identity" value strategy.
- Checks for duplicate object identity
- Embedded (and nested embedded) 1-1 fields, and querying of these fields
Likely supported soon
- Processing of more JDOQL/JPQL syntaxis in Cypher to minimise any in-memory processing
- Support for backed SCO collection wrappers allowing more efficient Relationship management.
Feedback is welcome (over on the DataNucleus Forum, or below in the comments). Additionally if anyone with more experience in Neo4j who would like this plugins capabilities to be enhanced why not get involved? You contribute a few patches for example - the source code is available here, and the issue tracker is a good place to start