Skip to content

Instantly share code, notes, and snippets.

@jordanburke
Forked from voronaam/jsonsqueryl.scala
Created April 22, 2014 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanburke/11188422 to your computer and use it in GitHub Desktop.
Save jordanburke/11188422 to your computer and use it in GitHub Desktop.
trait XsnTypeMode extends PrimitiveTypeMode {
import com.codahale.jerkson.Json._
import scala.collection.mutable.HashMap
import scala.language.implicitConversions
implicit val jsonTEF = new NonPrimitiveJdbcMapper[String,HashMap[String, Any],TString](stringTEF, this) {
def convertFromJdbc(v: String) = if(v == null) null else parse[HashMap[String, Any]](v)
def convertToJdbc(v: HashMap[String, Any]) = if(v == null) null else generate(v)
override def sample = new HashMap[String, Any]()
}
implicit def mapToTE(s: HashMap[String, Any]) = jsonTEF.create(s)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment