diff options
author | krrrr38 <k.kaizu38@gmail.com> | 2015-08-09 21:42:53 +0900 |
---|---|---|
committer | krrrr38 <k.kaizu38@gmail.com> | 2015-08-09 22:33:15 +0900 |
commit | 76ee13c8818bb386ba94a5c02037deb0ed7046c9 (patch) | |
tree | 17e63ee59ff1f218e0692cd414a3d1b31a2930f1 /src/main | |
parent | b40dfa417eaf77216ebe5df7d2a80dd6f521dd02 (diff) | |
download | slick-codegen-example-76ee13c8818bb386ba94a5c02037deb0ed7046c9.tar.gz slick-codegen-example-76ee13c8818bb386ba94a5c02037deb0ed7046c9.tar.bz2 slick-codegen-example-76ee13c8818bb386ba94a5c02037deb0ed7046c9.zip |
Update build for 3.0.1
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/scala/Example.scala | 7 | ||||
-rw-r--r-- | src/main/sql/create.sql | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/main/scala/Example.scala b/src/main/scala/Example.scala index ffa964b..3eaf9d3 100644 --- a/src/main/scala/Example.scala +++ b/src/main/scala/Example.scala @@ -2,7 +2,8 @@ object Tables extends{ // or just use object demo.Tables, which is hard-wired to val profile = scala.slick.driver.H2Driver
} with demo.Tables
import Tables._
-import Tables.profile.simple._
+import Tables.profile.api._
+import scala.concurrent.ExecutionContext.Implicits.global
object Example extends App {
// connection info for a pre-populated throw-away, in-memory db for this demo, which is freshly initialized on every run
@@ -13,8 +14,8 @@ object Example extends App { val q = Companies.join(Computers).on(_.id === _.manufacturerId)
.map{ case (co,cp) => (co.name, cp.name) }
- db.withTransaction { implicit session =>
- println( q.run.groupBy{ case (co,cp) => co }
+ db.run(q.result).foreach { result =>
+ println(result.groupBy{ case (co,cp) => co }
.mapValues(_.map{ case (co,cp) => cp })
.mkString("\n")
)
diff --git a/src/main/sql/create.sql b/src/main/sql/create.sql index 27d5034..22f290e 100644 --- a/src/main/sql/create.sql +++ b/src/main/sql/create.sql @@ -1,5 +1,5 @@ -create table "COMPUTERS" ("ID" INTEGER NOT NULL,"NAME" VARCHAR NOT NULL,"MANUFACTURER_ID" INTEGER NOT NULL); -create table "COMPANIES" ("ID" INTEGER NOT NULL,"NAME" VARCHAR NOT NULL); +create table IF NOT EXISTS "COMPUTERS" ("ID" INTEGER NOT NULL,"NAME" VARCHAR NOT NULL,"MANUFACTURER_ID" INTEGER NOT NULL); +create table IF NOT EXISTS "COMPANIES" ("ID" INTEGER NOT NULL,"NAME" VARCHAR NOT NULL); insert into "COMPANIES" values (1,'Apple Inc.'); |