You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developer-guide/getting-started-with-persistence.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,23 +5,23 @@
5
5
This page contains explanations and code samples for developers who need to store their entities into the database.
6
6
7
7
The Strongbox project uses [JanusGraph](https://janusgraph.org/) as its internal persistent storage through the
8
-
corresponding [Gremlin](https://tinkerpop.apache.org/gremlin.html) implementation and [spring-data-neo4j](https://spring.io/projects/spring-data-neo4j#overview) middle tier. Also we use `JTA` for transaction management and `spring-tx` implementation module from Spring technology stack.
8
+
corresponding [Gremlin](https://tinkerpop.apache.org/gremlin.html) implementation and [spring-data-neo4j](https://spring.io/projects/spring-data-neo4j#overview) middle tier. Also we use `JTA` for transaction management and the `spring-tx` implementation module from the Spring technology stack.
9
9
10
10
## Persistence stack
11
11
12
-
We using following technology stack to deal with persistence:
12
+
We're using the following technology stack to deal with persistence:
13
13
14
-
- Embedded Cassandra as direct storage (`CassandraDaemon` allows to have the Cassandra instance inside same JVM as the application)
15
-
- JanusGraph as Graph DBMS (it is not directly a data storage, it just allows you to have access to data in the form of a graph)
16
-
-[Apache TinkerPop](http://tinkerpop.apache.org/docs/current/reference/)as a set of tools to interact with the database
17
-
-[spring-data-neo4j](https://github.com/spring-projects/spring-data-neo4j) to manage transactions in Spring with `Neo4jTransactionManager` and implement custom Cypher queries with Spring Data repositories (by custom queries means`@org.springframework.data.neo4j.annotation.Query` annotation)
18
-
-[cypher-for-gremlin](https://github.com/opencypher/cypher-for-gremlin) which translates Cypher queries into Gremlin traversals (it has some issues which prevents us to use it for `neo4j-ogm` CRUD operations, these issues will be explained below)
14
+
- Embedded Cassandra as direct storage (`CassandraDaemon` allows us to have the Cassandra instance inside the same JVM as the application)
15
+
- JanusGraph as our graph DBMS (it is not directly a data storage, it just allows you to have access to data in the form of a graph)
16
+
-[Apache TinkerPop](http://tinkerpop.apache.org/docs/current/reference/) as a set of tools to interact with the database
17
+
-[spring-data-neo4j](https://github.com/spring-projects/spring-data-neo4j) to manage transactions in Spring with `Neo4jTransactionManager` and implement custom Cypher queries with Spring Data repositories (by custom queries via the`@org.springframework.data.neo4j.annotation.Query` annotation)
18
+
-[cypher-for-gremlin](https://github.com/opencypher/cypher-for-gremlin) which translates Cypher queries into Gremlin traversals (it has some issues which prevent us from using it for `neo4j-ogm` CRUD operations, these issues will be explained below)
19
19
-[neo4j-ogm](https://github.com/neo4j/neo4j-ogm) to map Java POJOs into Vertices and Edges of Graph
20
-
-we also use custom `EntityTraversalAdapters`, which implements anonimous Gremlin traversals for CRUD operations under `neo4j-ogm` entities.
20
+
-We also use custom `EntityTraversalAdapters`, which implement anonimous Gremlin traversals for CRUD operations under `neo4j-ogm` entities.
21
21
22
22
# Vertices and Edges
23
23
24
-
Unlike a Relational DBMS, Graph DBMS have vertices and edges, not rows and tables. So in terms of Graph every persistent entity should be stored as Vertex or Edge. An example of a vertex might be `Artifact` or `AritfactCoordinates` and the relation between them would be an edge. It should be noted that, unlike RDBMS, object relations are represented by separate edge instead of just foreign key column in table. In addition to vertices, persistence objects can also be an edges, as an example the `ArtifactDependency` would be an edge between `ArtifactCoordinates` vertices.
24
+
Unlike a relational DBMS, Graph DBMS have vertices and edges, not rows and tables. So, in terms of Graph, every persistent entity should be stored as vertex or edge. An example of a vertex might be `Artifact` or `AritfactCoordinates` and the relation between them would be an edge. It should be noted that, unlike RDBMS, object relations are represented by a separate edge, instead of just a foreign key column in a table. In addition to vertices, persistence objects can also be edges -- for example, the `ArtifactDependency` would be an edge between `ArtifactCoordinates` vertices.
25
25
26
26
## Gremlin Server
27
27
@@ -30,7 +30,7 @@ Unlike a Relational DBMS, Graph DBMS have vertices and edges, not rows and table
30
30
31
31
## Adding Dependencies
32
32
33
-
Let's assume that you, as a Strongbox developer, need to create a new module or write some persistence code in an
33
+
Let's assume that you, as a Strongbox developer, need to create a new module, or write some persistence code in an
34
34
existing module that does not contain any persistence dependencies yet. (Otherwise you will already have the proper
35
35
`<dependencies/>` section in your `pom.xml`, similar to the one in the example below). You will need to add the
36
36
following code snippet to your module's `pom.xml` under the `<dependencies>` section:
@@ -54,9 +54,9 @@ package. For the sake of the example, let's pick `PetEntity` as the name of your
54
54
55
55
If you want to store that entity properly you need to adopt the following rules:
56
56
57
-
* Create the interface for your entity with all getters and setters that required to interact with the entity, according to the `JavaBeans` coding convention. This interface should extend `org.carlspring.strongbox.data.domain.DomainObject`. The need for an interface is due to hide the implementationspecific details depending on underlying database, such as inheritance strategy.
58
-
* Create the entity class which implements the above interface and have the`org.carlspring.strongbox.data.domain.DomainEntity` as the superclass.
59
-
* Declare entity class with `@NodeEntity` or `@RelationshipEntity`
57
+
* Create the interface for your entity with all the getters and setters that are required to interact with the entity, according to the `JavaBeans` coding convention. This interface should extend `org.carlspring.strongbox.data.domain.DomainObject`. We need an interface in order to hide the implementation-specific details that depend on the underlying database, such as inheritance strategy.
58
+
* Create the entity class which implements the above interface and extend to`org.carlspring.strongbox.data.domain.DomainEntity`.
59
+
* Declare an entity class with `@NodeEntity` or `@RelationshipEntity`.
60
60
* Define a default empty constructor, this would need to create entity instance from `neo4j-ogm` internals.
61
61
62
62
The complete source code example that follows all requirements should look something like this:
0 commit comments