SQL insert and select statements generator based on Scala case class.
- Provide simple tool for generating SQL inserts based on Scala case classes
- Provide easy API to query JDBC table and map result to Scala case class
"com.github.piotr-kalanski" % "class2sql_2.11" % "0.1.0"
or
<dependency>
<groupId>com.github.piotr-kalanski</groupId>
<artifactId>class2sql_2.11</artifactId>
<version>0.1.0</version>
</dependency>
import com.datawizards.class2jdbc._
case class Person(name: String, age: Int)
val data = Seq(Person("p1", 1), Person("p2", 2))
generateInserts(data)
INSERT INTO Person(name,age) VALUES('p1',1)
INSERT INTO Person(name,age) VALUES('p2',2)
import com.datawizards.jdbc2class._
case class Person(name: String, age: Int)
val connectionString = "jdbc:h2:mem:test"
val connection = DriverManager.getConnection(connectionString, "", "")
selectTable[Person](connection, "people")