Migrating queries
Since Neo4j supports ACID transactions, you won't need to change the infrastructure of your application to simulate a transaction (this will be required if we are migrating from SQL to a non-transactional database), but you will still need to rewrite your queries.
CRUD
First and foremost, we must migrate the Create, Read, Update, and Delete ( CRUD ) queries. We already did this step in the previous section, but we overlooked a point—how do we migrate auto-incremented IDs (identities) from SQL to Neo4j? You could use the node ID generated and autoincremented by Neo4j. Yet, as we noticed in Chapter 1, Querying Neo4j Effectively with Pattern Matching, Neo4j could recompute the node IDs, and you should not trust them. If you really need an auto-incremented reliable ID, you will have to simulate the creation of an auto-incremented ID. Suppose we want to create an Author
entity, and we want the application to set the next available ID. For this, we can write the following code...