trait Transactions extends AnyRef
- Alphabetic
- By Inheritance
- Transactions
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def transaction[T](f: (Client) => Future[T]): Future[T]
Execute
f
in a transaction.Execute
f
in a transaction.If
f
throws an exception, the transaction is rolled back. Otherwise, the transaction is committed.client.transaction[Foo] { c => for { r0 <- c.query(q0) r1 <- c.query(q1) response: Foo <- buildResponse(r1, r2) } yield response }
- Note
we use a ServiceFactory that returns the same Service repeatedly to the client. This is to assure that a new MySQL connection (i.e. Service) from the connection pool (i.e., ServiceFactory) will be used for each new transaction. Only upon completion of the transaction is the connection returned to the pool for re-use.
Example: - abstract def transactionWithIsolation[T](isolationLevel: IsolationLevel)(f: (Client) => Future[T]): Future[T]
Execute
f
in a transaction using the given Isolation Level for this transaction only.Execute
f
in a transaction using the given Isolation Level for this transaction only. This Isolation Level overrides the session and global database settings for the transaction.If
f
throws an exception, the transaction is rolled back. Otherwise, the transaction is committed.client.transactionWithIsolation[Foo](IsolationLevel.RepeatableRead) { c => for { r0 <- c.query(q0) r1 <- c.query(q1) response: Foo <- buildResponse(r1, r2) } yield response }
- Note
we use a ServiceFactory that returns the same Service repeatedly to the client. This is to assure that a new MySQL connection (i.e. Service) from the connection pool (i.e., ServiceFactory) will be used for each new transaction. Only upon completion of the transaction is the connection returned to the pool for re-use.
Example:
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()