version 1.3.0

@seratch seratch released this Aug 24, 2014

Migration Guide

Deprecated joda-time methods in WrappedResultSet are removed. If you you're using rs.dateTime(...), just rename it to rs.jodaDateTime(...).

scalikejdbc/scalikejdbc@7112a70

Topics

autoConstruct

ScalikeJDBC 2.1.0 supports #autoConstruct macro for value extraction from ResultSet.

import scalikejdbc._
import skinny.orm._

case class Member(id: Long, name: Option[String])

object Member extends SkinnyCRUDMapper[Member] {
  override def extract(rs: WrappedResultSet, m: ResutName[Member]) = 
    autoConstruct(rs, m)
}

Member.findAll()

Skinny ORM mappers have relationships. Fields to exclude should be defined like this.

case class Member(
  id: Long, 
  name: Option[String], 
  companyId: Long, 
  company: Option[Company] = None)

object Member extends SkinnyCRUDMapper[Member] {
  override def extract(rs: WrappedResultSet, m: ResutName[Member]) = 
    autoConstruct(rs, m, "company")

  val companyRef = belongsTo[Company](
    Company, 
    (member, company) => member.copy(company = company))
}

Member.findAll()
Member.joins(Member.companyRef).where('id -> 123).apply()

Changes

  • [framework] Replace Scalatra's isDevelopmentMode with SkinnyEnv
  • [framework] setAsParams add date and time parts when property is a DateTime by @namutaka
  • [orm] #181 Add support autoConstruct from ScalikeJDBC 2.1.0
  • [task] scaffold ssp templates improvement by @namutaka