List of usage examples for org.springframework.data.neo4j.transaction SessionFactoryUtils closeSession
@Deprecated public static void closeSession(Session session)
From source file:org.springframework.data.neo4j.template.Neo4jTemplate.java
@Override public <T> T execute(Neo4jCallback<T> action) throws DataAccessException { Assert.notNull(action, "Callback object must not be null"); Session session = null;//from w w w. j a v a 2 s . com boolean isNew = false; try { session = SessionFactoryUtils.getSession(getSessionFactory()); } catch (IllegalStateException ex) { logger.debug("Could not retrieve pre-bound OGM session", ex); } if (session == null) { session = getSessionFactory().openSession(); isNew = true; } try { return action.doInNeo4jOgm(session); } catch (RuntimeException ex) { throw SessionFactoryUtils.convertOgmAccessException(ex); } finally { if (isNew) { SessionFactoryUtils.closeSession(session); } } }