Spring Data Graph

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


@Retention(value=RUNTIME)
@Target(value=FIELD)
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
 Direction direction
           
 Class<? extends NodeBacked> 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 Direction direction
Returns:
direction for the relationship, by default outgoing
Default:
org.springframework.data.neo4j.core.Direction.OUTGOING

elementClass

public abstract Class<? extends NodeBacked> elementClass
Returns:
target class, required for collection based fields (no generic inferring)
Default:
org.springframework.data.neo4j.core.NodeBacked.class

Spring Data Graph

Copyright © 2011 SpringSource. All Rights Reserved.