Database Reference
In-Depth Information
public Role(Artist artist, Movie movie, String
role_name){
//Invoke setters methods of artist, movie and
role_name
}
…
//Define getters and setters for all properties.
}
In the preceding code, we have annotated the relationship class with
@Relation-
shipEntity
and the type of relationship will be
ACTED_IN
, which indicates that this
bean is defining the relationship between two nodes, namely Artist and Movies. We have
also specified attributes for Artist and Movie and annotated them with
@StartNode
and
@EndNode
, which defines the
START
and
END
of the relationship between these two
nodes.
Until now, we have created two nodes and one relationship class, which defines the rela-
tionship between the nodes. Now it is time to configure these domain entities so that the
framework can identify and process these entities. So let's define the Spring configuration
file
Spring-Neo4j/src/main/resources/Application-Config.xml
.
1. Define the following schemas in your
Application-Config.xml
file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/
beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/
context"
xmlns:neo4j="http://www.springframework.org/schema/
data/neo4j"
xmlns:repository="http://www.springframework.org/
schema/data/repository"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/
spring-beans-3.2.xsd