[As community content, this post reflects the views and opinions of the particular author and does not necessarily reflect the official stance of Neo4j. This was originally posted on the Knoldus blog and was used with permission.]Editor’s Note: For more information on the Scala driver for Neo4j – AnormCypher – check out our developer page here.
In my last blog post, Getting Started with Neo4j with Scala: An Introduction, we discussed about how to use Neo4j with Scala. Now we are going to take it one step further.
As you likely know from using a relational database (RDBMS), procedures provide the advantages of better performance, scalability, productivity, ease of use and security. In Neo4j, we can use APOC and user-defined procedures which provide the same advantages which we get from a relational database.
In some of my previous posts, we used user-defined procedures in a relational database which we store in the database and call from there whenever needed. In Neo4j, we also do the same thing. Here we create procedure method with the
When we annotate with
@Procedure, it takes any Cypher type as parameters and returns a stream of Data Transfer Objects (DTO).
When procedures write to the database, we should also use the
@PerformWrites annotation. We should use user-defined procedures only for common tasks or for those tasks which you use more frequently, because we can’t create procedures for every single purpose.
Read the rest of this blog post on Scala for Neo4j by Anurag Srivastava on the Knoldus blog.
Take the Course