Questions tagged [slick-3.0]

Slick is a modern database query and access library for Scala by Typesafe.

Slick is a modern database query and access library for Scala. It allows you to work with stored data almost as if you were using Scala collections while at the same time giving you full control over when a database access happens and which data is transferred. You can write your database queries in Scala instead of SQL, thus profiting from the static checking, compile-time safety and compositionality of Scala. Slick features an extensible query compiler which can generate code for different backends.

New in Slick 3.0.0-M1

These are the major new features in this miletone:

  • A new API for composing and executing database actions.
  • Improved configuration of database connections via Typesafe Config, including built-in support for HikariCP.
  • Support for nested Option types and non-primtive Option types in the Lifted Embedding.
  • Properly typed outer join operators based on the improved Option support.

Useful Links

488 questions
7
votes
1 answer

Transactional method in Scala Play with Slick (similar to Spring @Transactional, maybe?)

I know scala, as a funcional language, is supposed to work differently from a common OO language, such as Java, but I'm sure there has to be a way to wrap a group of database changes in a single transaction, ensuring atomicity as well as every other…
redwulf
  • 1,317
  • 3
  • 13
  • 35
7
votes
1 answer

Slick 3 java.time.LocalDate mapping

I am using Slick 3.1.0 and need to persist the field of type java.time.LocalDate. I have the model class: case class Position(companyName: String, title: String, startDate: Option[LocalDate], endDate: Option[LocalDate], positionId: Option[Int] =…
Ilya Zinkovich
  • 4,082
  • 4
  • 25
  • 43
7
votes
2 answers

Scala+Slick 3: Inserting the result of one query into another table

This question is about slick 3.0 or 3.1 (I am flexible about that) I have an intermediate query which I process with map, for, etc. to obtain the result I want. In the end I have a val foo: DBIOAction[Seq[MySchema.Bar], NoStream, Effect.Read] Now…
masgo
  • 480
  • 1
  • 5
  • 20
7
votes
1 answer

Get user and fill all permissions

I am new to Scala and even what I am trying to achieve is too simple with Java, i feel confused with Scala. What I want is to get a User and then fill his Permission using another query and based to his Role and his individual Permissions. Until…
glarkou
  • 7,023
  • 12
  • 68
  • 118
7
votes
2 answers

Testing Play + Slick app

I've a simple CRUD app built with Scala Play 2.4.3 and Play-slick 1.1.0 (slick 3.1.0) that uses a MySQL database for persistent storage. I was trying to create the tests for my app and I saw 2 main options: mocking database access, that as far as…
pedrorijo91
  • 7,635
  • 9
  • 44
  • 82
7
votes
2 answers

Slick 3.0 many-to-many query with the join as an iterable

I've created a many-to-many collection using Slick 3.0, but I'm struggling to retrieve data in the way I want. There is a many-to-many relationship between Events and Interests. Here are my tables: case class EventDao(title: String, …
jbrown
  • 7,518
  • 16
  • 69
  • 117
6
votes
3 answers

How to return full row using Slick's insertOrUpdate

I am currently learning Play2, Scala and Slick 3.1, and am pretty stuck with the syntax for using insertOrUpdate and wonder if anyone can please help me. What I want to do is to return the full row when using insertOrUpdate including the auto inc…
jnhamilton
  • 123
  • 2
  • 6
6
votes
1 answer

Returning db connection to HikariCP pool with Slick 3.1.x

I'm setting up a slick Database object from typesafe config like so: import com.typesafe.config.Config class DatabaseService(configKey: String, config: Config) { val driver = slick.driver.MySQLDriver import driver.api._ val db =…
novon
  • 973
  • 3
  • 15
  • 30
6
votes
2 answers

Does evolution create automatically database and table?

I have class GroupTable that makes schema of table. As I saw, in other projects there are at conf/evolution/default folder file 1.sql, that is automatically generated from code (as I assume). But when I start my application - nothing creates.…
Azula
  • 457
  • 2
  • 5
  • 13
6
votes
4 answers

combining slick queries into single query

Using Slick 3.1, how do I combine multiple Queries into a single query for the same type? This is not a join or a union, but combining query "segments" to create a single query request. These "segments" can be any individually valid query. val…
IUnknown
  • 2,596
  • 4
  • 35
  • 52
6
votes
1 answer

Can't convert MappedProjection to ProvenShape due to ambiguous implicit

Could you please explain to me how I can convert MappedProjection to ProvenShape which currently fails due to ambiguous implicit? I use slick-pg for support of jsonb types in Postgres DB. I have simple case class that I want to store as json and…
expert
  • 29,290
  • 30
  • 110
  • 214
6
votes
1 answer

Check if element exists in database using Slick 3 and Play

I am new to Scala, Slick and Play but I am trying to do some little service using this technology. I have a problem with a proper way how to check existence of item in DB. Play action -- simple to see output in Browser: val id = 5 val name =…
leemonix
  • 105
  • 1
  • 5
6
votes
0 answers

Column with default date with Slick 3.1.0

I have an events table with these columns _________________________ |___name_____|___time_____| | | | |____________|____________| The value of time column is auto generated with the current date at creation…
Khanetor
  • 11,595
  • 8
  • 40
  • 76
6
votes
4 answers

Slick 3.0.0 - How to sortBy on a query with joinLeft

This question is related to another. I'm also trying to sort on a query with a joinLeft but in slick 3.0.0. And as the Option Rep are automatically lifted how would I do the exact same thing ?: def list(filter: String, orderBy:…
Camille Wanty
  • 76
  • 1
  • 5
6
votes
3 answers

Slick 3.0 how to update variable column list, which number is know only in Runtime

Is it possible to update variable column list, which number is know only in runtime by slick 3.0? Below is example what I want to do (won't compile) var q: Query[UserTable, UserTable#TableElementType, Seq] = userTable var columns = List[Any]() var…
user2860204
  • 151
  • 9
1 2
3
32 33