Spring Data Neo4j

org.springframework.data.neo4j.annotation
Annotation Type RelatedTo


@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD})
public @interface RelatedTo

Annotation for NodeEntity fields that relate to other entities via relationships. Works for one-to-one and one-to-many relationships. It is optionally possible to define the relationship type, relationship direction and target class (required for one-many-relationships). Collection based one-to-many relationships return managed collections that reflect addition and removal to the underlying relationships. Examples:

 @RelatedTo(elementClass=Person.class)
 Collection<Person> friends;
 @RelatedTo(type="partner")
 Person spouse;
 

Since:
27.08.2010
Author:
Michael Hunger

Optional Element Summary
 org.neo4j.graphdb.Direction direction
           
 Class<?> elementClass
           
 String type
           
 

type

public abstract String type
Returns:
name of the relationship type, optional, can be inferred from the field name
Default:
""

direction

public abstract org.neo4j.graphdb.Direction direction
Returns:
direction for the relationship, by default outgoing
Default:
org.neo4j.graphdb.Direction.OUTGOING

elementClass

public abstract Class<?> elementClass
Returns:
target class, required for collection based fields (no generic inferring)
Default:
java.lang.Object.class

Spring Data Neo4j

Copyright © 2011 SpringSource. All Rights Reserved.