Same Java code for server database and for embedded database

Dear all,

I would like to know if some guys have developped Java codes running correclty on a server database AND an embedded database.
I have a server with a neo4j database, I have developped some Java codes using Cypher (no OGM). My idea is to create an sandbox using embedded neo4j database in Java.
I want to re-use my Java code on the embedded database.
But I have a problem, my codes is written like that:

		Transaction tx = session.beginTransaction();
		String command = "MATCH ()-[r:REL]-() WHERE id(r) = " + id + " DELETE r";
		tx.run(command);
		tx.commit();
		tx.close();

where
driver = GraphDatabase.driver(uri, AuthTokens.basic(user, password), config);
session = driver.session();

I have the following code for embedded part:
File databaseDirectory = new File(home+"/Downloads/NEO4J");
DatabaseManagementService managementService = new DatabaseManagementServiceBuilder( databaseDirectory.toPath() ).build();
graphDb = managementService.database( DEFAULT_DATABASE_NAME );

The problem is that graphDb has a method beginTx() returning a Transaction,
as session.beginTransaction(), but there is not the same class:
server version uses: org.neo4j.graphdb.Transaction
embedded version uses: org.neo4j.driver.Transaction

Do you have any idea ?

Thanks

Hi,

I cannot directly solve your problem, however, I stumbled upon some code that uses and exectues a cypher-file for an embedded database. Maybe that might help you.

neo4j-procedure-template/TraverseDemoTest.java at 4.2 · neo4j-examples/neo4j-procedure-template · GitHub (ll. 29-37)

Regards,
Elena