I would like to define some relationship type between some typed node. When I look example always they use a String to define relationship type, as in this example . By using:
@RelationshipEntity(type = "ACTED_IN")
I tried to use org.neo4j.graphdb.RelationshipType but RelationshipEntity.type expect a string.
public enum PersonMovieRelationshipType implements RelationshipType {
ACTED_IN("ACTED_IN"),
AUTHOR("AUTHOR");
private String type;
PersonMovieRelationshipType( String type ){
this.type = type;
}
public String getType() {
return type;
}
}
RelationshipType enum provide a method "name()" what to do with ?
I do not like free text way, is it possible use an enum ?
Any full example will be appreciated.
Regards
You can't due to the way annotations work. What you could do is declaring the relation names as constants.
interface RelationNames{
String ACTED_IN = "ACTED_IN";
}
And then use those constants in your code
@RelationshipEntity(type = RelationNames.ACTED_IN)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With