Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-23-2021 04:34 PM
Dear all,
I work on a Neo4j server with java, so I develop codes based on org.neo4j.driver.Session.beginTransaction() (Java driver).
My methods are written as follows:
public doSomething(arg) {
Transaction tx = this.getTransaction();
tx.run(command);
tx.commit();
tx.close();
}
I want to use the same methods doSomething for embedded database.
I would like to write a method
// Server Db
private Session session;
// Embedded Db
private GraphDatabaseService graphDb;
private Transaction getTransaction(boolean servertype) {
if (servertype) {
return session.beginTransaction();
} else {
System.out.println("Mode Embedded");
return (Transaction) graphDb.beginTx();
}
}
Transaction is returned class but it is two different classes in fact,
How to convert/use one for the other and vice-versa ?
Best regards,
Alexandre
All the sessions of the conference are now available online