Open PostgreSQL and Create a table student
in database student
.
CREATE EXTENSION hstore;
CREATE TABLE student (
id int,
name varchar(254) NOT NULL,
hobbies text[],
marks hstore
);
To use slick-pg
in sbt project, add the following to your project file:
libraryDependencies += "com.github.tminglei" %% "slick-pg" % "0.8.1"
To run
sbt run
In this example, we have inserted only Scala List and Map in PostgreSQL table. To insert other types, please go here https://github.com/tminglei/slick-pg.
What happens if hobbies is Null, even if I used O.Default(Nil) it throws [SlickException: Read NULL value (null) for ResultSet column ]