Scala Database Access¶
Database Access / ORM Libraries¶
Comparison of multiple frameworks
Database Initialization / Migration¶
Modern Examples¶
Slick¶
import slick.jdbc.H2Profile.api._
import scala.concurrent.ExecutionContext.Implicits.global
class Coffees(tag: Tag) extends Table[(String, Int, Double, Int, Int)](tag, "COFFEES") {
def name = column[String]("COF_NAME", O.PrimaryKey)
def supID = column[Int]("SUP_ID")
def price = column[Double]("PRICE")
def sales = column[Int]("SALES")
def total = column[Int]("TOTAL")
def * = (name, supID, price, sales, total)
}
val coffees = TableQuery[Coffees]