Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Adapt transactions to create sessions #19
Browse files Browse the repository at this point in the history
  • Loading branch information
tdauth committed Apr 10, 2019
1 parent 7a6f13e commit 31c8899
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ resolvers += "sonatype-snapshots" at "https://oss.sonatype.org/content/repositor
libraryDependencies += "org.neo4j" % "neo4j" % "3.5.4"
libraryDependencies += "org.neo4j" % "neo4j-ogm-core" % "3.1.8"
libraryDependencies += "org.neo4j" % "neo4j-ogm-embedded-driver" % "3.1.8"
libraryDependencies += "org.neo4j" % "neo4j-bolt" % "3.5.4"

// Dependencies to represent states and actions:
libraryDependencies += "de.retest" % "surili-commons" % "0.1.0-SNAPSHOT" withSources () withJavadoc () changing ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ object Neo4jSessionFactory {
sessionFactory
}

def transaction[A](f: => A)(implicit session: Session): A = {
def transaction[A](f: Session => A)(implicit uri: String): A = {
// We have to create a session for every transaction since sessions are not thread-safe.
val session = Neo4jSessionFactory.getSessionFactory(uri).openSession() // TODO #19 Close the session at some point?
var txn: Option[Transaction] = None
try {
val transaction = session.beginTransaction()
Expand Down

0 comments on commit 31c8899

Please sign in to comment.