Chapter 3. Using Neo4j embedded in Java applications

This chapter describes how to use Neo4j embedded in Java applications, from setting up the environment to doing something useful with your data.

This chapter describes the following:

When running your own code and Neo4j in the same JVM, there are a few things you should keep in mind:

  • Do not create or retain more objects than you strictly need to. Large caches in particular tend to promote more objects to the old generation, thus increasing the need for expensive full garbage collections.
  • Do not use internal Neo4j APIs. They are internal to Neo4j and subject to change without notice, which may break or change the behavior of your code.
  • Do not enable the -XX:+TrustFinalNonStaticFields JVM flag when running in embedded mode.