Questions tagged [squeryl]

Squeryl is a strongly typed, declarative and SQL like DSL for manipulating database objects from within the Scala language.

Squeryl is a strongly typed, declarative and SQL like DSL for manipulating database objects from within the Scala language.

201 questions
3
votes
2 answers

Scala Macros, generating type parameter calls

I'm trying to generalize setting up Squeryl (Slick poses the same problems AFAIK). I want to avoid having to name every case class explicitly for a number of general methods. table[Person] table[Bookmark] etc. This also goes for generating indexes,…
3
votes
1 answer

How can I delete all records from a table with squeryl?

I've looked at ways to use squeryl to delete all records from a table. The only thing I could come up with is myTable.deleteWhere(r => r.id.isNotNull) //id is the primary key This seems strange and possibly inefficient. What is the cleanest way to…
iwein
  • 25,788
  • 10
  • 70
  • 111
3
votes
1 answer

Mapper versus Record/Squeryl

I am about to start my first project in the Lift framework and I have to decide which persistence library to choose. I am about to use relational backend so both Mapper and Record may come in play. In case of Mapper - the thing I miss the most is…
Karel Horak
  • 1,022
  • 1
  • 8
  • 19
3
votes
2 answers

Storing case object with squeryl

How do I store user case objects with squeryl? I have an Account object with a permission field of type Permission (defined as a sealed trait). I also have 2 case objects (Administrator and NormalUser) extending from Permission. How can I persist…
jorgenfb
  • 2,215
  • 1
  • 21
  • 31
2
votes
1 answer

How to migrate existing data managed with sqeryl?

There is a small project of mine reaching its release, based on squeryl - typesafe relational database framework for Scala (JVM based language). I foresee multiple updates after initial deployment. The data entered in the database should be…
Basilevs
  • 22,440
  • 15
  • 57
  • 102
2
votes
2 answers

How To:Transaction Rollback in squeryl

Can anybody please tell me how to handle a transaction rollback in squeryl explicitly? And also how can we add or remove columns in squeryl dynamically? Thanx...
psaw.mora
  • 868
  • 1
  • 7
  • 18
2
votes
1 answer

Squeryl Query containing greaterThanEqual (gte) or lessThanEqual (lte) give wrong/no results

I'm trying to do a simple query with squeryl. however it doesn't work! the code compiles but the query returns no results, but it should! the same query in blank SQL works perfectly. SELECT * FROM tablename WHERE position <= 83172924 val qryResult =…
dforce
  • 2,136
  • 3
  • 20
  • 36
2
votes
1 answer

Could not initialize class exception on scala(possibly squeryl bug)

I am developing a web application with scala 2.8.1, scalatra 2.0.0.M2, squeryl 2.8.0 and scalate 2.0.0 and sbt I am having a problem with, apparently a model or the schema class. When I run my tests I get a: java.lang.NoClassDefFoundError: Could not…
Marcelo Lacerda
  • 847
  • 1
  • 15
  • 30
2
votes
1 answer

How can I encapsulate the session/transaction acquisition into the lazy-init of relations in Squeryl?

I am trying to implement a One-To-Many relation using Squeryl, and following the instructions on their site. The documentation gives the following example: object SchoolDb extends Schema { val courses = table[Course] val subjects =…
pkaeding
  • 36,513
  • 30
  • 103
  • 141
2
votes
1 answer

Migrating Play Framework 2.5 - moving from Global.onStart to Dependency Injection

So I am trying to migrate a PlayFramework application from version 2.4.3 to 2.5.6. I am using Squeryl and akka-quartz-scheduler, and Squeryl requires setting up a session manually and akka-quartz-scheduler runs as its own entity, as none of the…
mpartan
  • 1,296
  • 1
  • 14
  • 30
2
votes
0 answers

Unable to use Option for a custom type in squeryl

Say I have a case class that maps to table with two Timestamp fields in my database, one of which can be null. I want to define my own custom DateTime class to map to the timestamp fields: case class DateTime(val time: Long) extends…
user79074
  • 4,937
  • 5
  • 29
  • 57
2
votes
1 answer

Squeryl geo queries with a postgres backend?

How can I perform geo queries using Squeryl with a postgres backend? The sort of queries I want to run are "return all users within x kilometres", etc. If geo queries aren't supported directly/through a plugin, how can I run raw SQL queries? I saw…
jbrown
  • 7,518
  • 16
  • 69
  • 117
2
votes
2 answers

Squeryl JDK 1.8

We recently hit the same issue as discussed here - Squeryl fails to reflect in debug mode only And it was also solved by changing to use JDK 1.7 As Java 7 support life-cycle has ended; we would like to move to Java 8. Does squeryl support Java 8? Is…
brent
  • 1,095
  • 1
  • 11
  • 27
2
votes
1 answer

Squeryl: How to create an aggregate query using postgres' date_trunc() function on a date column

Given following entity class and a postgres database with a related table: case class Statistics(name: String, measure: Long, datetime: Timestamp = new Timestamp(System.currentTimeMillis)) How can I…
Erich Schreiner
  • 2,038
  • 1
  • 14
  • 24
2
votes
3 answers

How can I count a query from squeryl

I have a method which return a Query: def list:Query[User] = from(users)(u => where(u.age>20) select(u)) Now I want to count the list, but this method: list.count(_ => true) will get and loop all elements in the list. I want to find a solution to…
Freewind
  • 193,756
  • 157
  • 432
  • 708
1 2
3
13 14