Skip to content

Instantly share code, notes, and snippets.

@yangbajing
Created November 1, 2012 09:59
Show Gist options
  • Save yangbajing/3992836 to your computer and use it in GitHub Desktop.
Save yangbajing/3992836 to your computer and use it in GitHub Desktop.
Squery Helpers squeryUsing(不需要事物的帮助方法)
package com.teshengtech.persistence
import org.squeryl.Session
import org.squeryl.SessionFactory
import org.squeryl.PrimitiveTypeMode._
trait SqueryHelpers {
@inline
def squerylUsing[R](func: => R): R =
Session.currentSessionOption.map(using(_)(func))
.getOrElse(using(SessionFactory.newSession)(func))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment