jo4neo is a simple Java object mapping for Neo4j. No byte code interweaving, just plain old reflection and plain old objects.
jo4neo has been developed by Taylor Cowan, all credit goes to him. The old repository is retired, please refer here to future questions.
public class Person {
//used by jo4neo
transient Nodeid node;
//simple property
@neo String firstName;
//helps you store a java.util.Date to neo4j
@neo Date date;
// jo4neo will index for you
@neo(index=true) String email;
// many to many relation
@neo Collection<Role> roles;
/* normal class oriented
* programming stuff goes here
*/
}
Annotating Java Object Properties @neo String name; Persist me to the graph as a property @neo Person friend; Persist me to the graph as a node and relation String misc; Don’t bother to persist me @neo(index=true) String name; Persist and index this field for me @neo(fulltext=true) String content; Persist and full text index @neo("HAS_JOB") Job job; Persist using a given relation, by name @embed Address address; Persist as serialized byte array Locating Java Objects in the graph If you ask jo4neo to index a property…
public class User {
@neo(index=true) public String screenName;
...}
you may find it like this:
ObjectGraph graph = ...
User user = new User();
user = graph.find(user).where(user.screenName).is(screenName).result();