Questions tagged [slick-2.0]

Slick is a modern database query and access library for Scala by Typesafe. Use this tag for specific issues with features introduced in 2.0. Otherwise use the generic [tag:slick]

Use this tag if your question describes issues with features introduced in 2.0 (January 2014).

Specific Features for 2.0 that might require this tag above the generic :

  • Code generator for reverse-engineering the database schema and code generation
  • Driver architecture to allow support for non-SQL, non-JDBC databases.
  • Syntax in the Lifted Embedding in Table definitions
  • Table definitions (and their * projections)
  • HList abstraction for records of arbitrary size
  • Soft inserts
  • The new model for pre-compiled queries
  • dynamicSession (replaced threadLocalSession)
  • server-side Option conversions
  • Changes to the API for Scala Collections syntax.
  • direct embedding (improved)
  • Query scheduling
  • The code generator phase
  • Full type information available in query ASTs

Adapted from the release notes

195 questions
1
vote
1 answer

What is the best way to go about referencing multiple tables using slick 2.0?

I have these tables: USERS, USER_ROLES, ROLES, PERMISSIONS, ROLE_PERMISSIONS I am implementing the: AssignedRoles (M): returns the set of roles assigned to a given user; So, if I was going to write the query for this function it would like…
James Little
  • 601
  • 7
  • 24
1
vote
2 answers

Play slick session connection timeout

I'm having a problem with the session and connection handling in play with Slick 2.0.1 and play-slick 0.6.0.1 The error is [SQLException: Timed out waiting for a free available connection.] [...] Caused by: java.sql.SQLException: Timed out waiting…
mattanja
  • 1,442
  • 14
  • 21
1
vote
1 answer

Filtering in Slick with foreign key field

Is it possible to use a foreign key field in a Slick where or filter statement? Something like (where the user field is a foreign key to a Table for which User is its mapped projection) (this does not compile): def findByUser(user: User)(implicit s:…
Artur Soler
  • 2,974
  • 2
  • 23
  • 24
0
votes
1 answer

How to manage application.config file to minimize code in play framework

For example: I have written database config in application.config as follows: storedb{ url = "jdbc:mysql://localhost/storedb" slick.driver = scala.slick.deiver.MySQLDriver user = "user" pass = "pass" } I have multiple…
0
votes
1 answer

Slick:Insert into a Table from Raw SQL Select

Insert into a Table from Raw SQL Select val rawSql: DBIO[Vector[(String, String)]] = sql"SELECT id, name FROM SomeTable".as[(String, String)] val myTable :TableQuery[MyClass] // with columns id (String), name(String) and some other columns Is there…
Larry
  • 71
  • 5
0
votes
0 answers

How to prepare data for bulk insert in scala slick 2.1.0

I'm using Slick 2.1.0. I'm trying to perform insertAll from a case class. The structure of case class is case class ClassA(field1: Int, field2: ClassB) case class ClassB(field3: String, field4: String) There's a function def bulkInsert(param:…
Sujit Baniya
  • 895
  • 9
  • 27
0
votes
0 answers

Java Lwjgl 2 : How to store textures

So how can I store textures within lwjgl so that when I call a texture it does not have to go and open the file to get the texture, as this is time consuming and inefficient. I am going to be creating an animation and need several images from a…
GilbertN
  • 37
  • 5
0
votes
1 answer

Column type not defined while upgrading from slick 2.1 to slick 3.2 in scala

The following block of code was working on slick 2.1 but when I upgraded the slick version, the code is not working. import slick.lifted.Column trait IntegerId { def id: Column[Int] } The error received: Cannot resolve symbol Column Is there any…
Sujit Baniya
  • 895
  • 9
  • 27
0
votes
1 answer

Create multiple databases using scala slick

Is it possible to create multiple databases using a single query using slick? sqlu"""CREATE DATABASE if not exists students;CREATE DATABASE if NOT professors""" I'm running the above slick query but getting…
Sheshank Kodam
  • 515
  • 5
  • 17
0
votes
0 answers

why it returns 0 records with slick and playframework

There is a users table in the database. However, when i use the following scala code in playframework, it returns 0 records. case class User(id: Option[Int], username: String, email: String, password: String, role: String) class Users(tag: Tag)…
0
votes
1 answer

How does scala slick determin which rows to update in this query

I was asked how scala slick determines which rows need to update given this code def updateFromLegacy(criteria: CertificateGenerationState, fieldA: CertificateGenerationState, fieldB: Option[CertificateNotification]) = { val a:…
Th 00 mÄ s
  • 3,776
  • 1
  • 27
  • 46
0
votes
2 answers

Is it possible to return a custom column value from the sql database table using slick?

There is a scenario when the requestType="HR" (which comes from the HTTP PUT request), it should return all the students information but return title as "EMPLOYEE" For example, consider a "student" table with columns name,id, and title …
Sheshank Kodam
  • 515
  • 5
  • 17
0
votes
0 answers

Correctly joining tables and interating over results using Slick 2.1.0

I'm maintaing an old legacy application on Slick 2.1.0. When writing one piece, I ran into trouble with joins and made a query per each row in a query with the intent of fixing it later, but forgot to add a //TODO row.code.flatMap(code =>…
djsumdog
  • 2,560
  • 1
  • 29
  • 55
0
votes
1 answer

Slick 2.1.x Invalid query because of `

I am working on legacy code which was written in slick 2.1 (can't upgrade right now). val query = foo.filter(x => x.d >= input._1).filter(x => x.d < input._2) println(query.selectStatement) query.list I can see that this generate the…
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
0
votes
1 answer

Slick - Join Table with Rows Limit

I'm using Slick 2.1 and am doing a fairly standard JOIN. However when I try to limit the number of rows returned using "take()" I get a compile error. Query... var samples = for { (sample, user) <- this .join(users) on (_.userId === _.id) if…
fatlog
  • 1,182
  • 2
  • 14
  • 28