use of org.neo4j.ogm.transaction.Transaction in project neo4j-ogm by neo4j.
the class BaseAutoIndexManagerTestClass method executeDrop.
void executeDrop(String... statements) {
Session session = sessionFactory.openSession();
for (String statement : statements) {
try (Transaction transaction = session.beginTransaction()) {
// it does not clean up the tx resources, leading to deadlock later
try {
session.query("DROP " + statement, emptyMap());
transaction.commit();
} catch (Exception e) {
logger.trace("Could not execute drop for statement (this is likely expected) {}", statement, e);
transaction.rollback();
}
}
}
}
use of org.neo4j.ogm.transaction.Transaction in project neo4j-ogm by neo4j.
the class KnowledgeTest method shouldBeAbleToRollbackObjectWithDifferentKnowledges.
/**
* @see 351
*/
@Test
public void shouldBeAbleToRollbackObjectWithDifferentKnowledges() {
Person john = new Person("John");
Person mary = new Person("Mary");
Language java = new Language("Java");
Language scala = new Language("Scala");
john.knows(mary);
john.knows(java);
john.knows(scala);
try (Transaction tx = session.beginTransaction()) {
session.save(john);
tx.rollback();
}
}
Aggregations