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
1
vote
1 answer

How to use the "exists" function of Squeryl?

I found there is a exists function in the document of Squeryl, but I can't find an example of how to use it. Would someone give me an example of "exists"?
Freewind
  • 193,756
  • 157
  • 432
  • 708
1
vote
1 answer

Join multiple tables with aggregation in Squeryl

I'm trying to join a Card with a Part and left join a summed Stock value to a part (some parts won't have a stock row). I have the following which I thought would work.. def stockPerBase = from(stock)(s => groupBy(s.base)…
Alex
  • 1,322
  • 1
  • 20
  • 44
1
vote
1 answer

Squeryl: how to toggle a boolean column using a partial update

Suppose I have an entity class like that: case class MyEntity(some_flag: Boolean) extends KeyedEntity[Long] I want to perform the following SQL update using Squeryl: update table_name set some_flag = not some_flag where id = 1 What is the related…
Erich Schreiner
  • 2,038
  • 1
  • 14
  • 24
1
vote
1 answer

How to set up intermediary table in MySQL for ManyToMany relations in squeryl for Play 2 framework?

I'm still learning all the ins and outs of web development, scala, play 2.0, and squeryl and I'm trying to set up a ManyToMany relation between two of my tables. I've looked over the information found here but I'm having trouble with the…
Charles Daily
  • 345
  • 1
  • 3
  • 6
1
vote
2 answers

Pattern matching in squeryl queries

I have just started with squeryl and have no answer for how write a query like that SELECT ref label FROM x_table WHERE ref like x% or lable like x% where x is some value from the user, especially I haven't found analog of the sign % in squeryl…
arussinov
  • 1,237
  • 11
  • 16
1
vote
1 answer

Squeryl: from not found

Which import is needed for Squeryl's from statement? Erroneous statement: def users = from(MySchema.users)(u => where(u.id === user.id.id) select(u)) Error message: "not found: value from"
ideaboxer
  • 3,863
  • 8
  • 43
  • 62
1
vote
1 answer

Migrating from Squeryl 0.9.5 to 0.9.6

I am trying to migrate an existing application fron SQueryl 0.9.5 to 0.9.6, in order to make use of the new extended field types. I am now to the point where the application and its tests compile, but I get a runtime error as soon as I try to load a…
Andrea
  • 20,253
  • 23
  • 114
  • 183
1
vote
1 answer

ClassCastException when trying to insert with Squeryl

This may be due to my misunderstanding of how Squeryl works. My entity is defined as: case class Wallet(userid: Int, amount: Long) extends KeyedEntity[Int] with Optimistic { def id = userid } My table variable is defined as: val…
Mark
  • 5,286
  • 5
  • 42
  • 73
1
vote
1 answer

Squeryl - Means of combinations of queries

I have the need to perform some queries that may depend on external supplied parameters via a REST interface. For instance a client may require an URL of the form some/entities?foo=12&bar=17 The parameters, say foo, bar and quux are all optional.…
Andrea
  • 20,253
  • 23
  • 114
  • 183
1
vote
2 answers

How to retrieve multiple rows from stored procedure with Scala?

Say you have a stored procedure or function returning multiple rows, as discussed in How to return multiple rows from the stored procedure? (Oracle PL/SQL) What would be a good way, using Scala, to "select * from table (all_emps);" (taken from URL…
Dr.Haribo
  • 1,778
  • 1
  • 31
  • 43
1
vote
3 answers

Squeryl and PostgreSQL's autoincrement

When I try to insert a new record in a PostgreSQL table using Squeryl's Table.insert, it fires this query: insert into "users" ("id", "email", "fullname") values (nextval('"s_users_id"'),?,?) This doesn't work, as I did not define a sequence and…
Jeroen Kransen
  • 1,379
  • 3
  • 19
  • 45
1
vote
1 answer

Implementing Externalizable in Scala with SerialVersionUID

I have an app that is deployed to Tomcat 7 and is currently clustered among two nodes. I am running into a small issue that occurs when the container tries to deserialize a class which has changed. The read and write methods should handle this…
jcern
  • 7,798
  • 4
  • 39
  • 47
1
vote
1 answer

Avoiding Squeryl transaction in Play! controllers

I am learning Play! and I have followed the To do List tutorial. Now, I would like to use Squeryl in place of Anorm, so I tried to translate the tutorial, and actually it works. Still, there is one little thing that irks me. Here is the relevant…
Andrea
  • 20,253
  • 23
  • 114
  • 183
1
vote
1 answer

Squeryl: KeyedEntity.id isn't updated on insert

I have a table definition class Transaction( val ... ) extends KeyedEntity[Long] { val id:Long = 0 } val transaction = table[Transaction]("transactions") on(transaction) {t => declare( t.id is unique ... (other fields) …
Heinzi
  • 5,793
  • 4
  • 40
  • 69
1
vote
1 answer

Using gt, gte, etc. in WHERE subquery in Squeryl ORM

I've recently started evaluating Squeryl ORM and it looks great but finally I came to an SQL query that seems to be problematic to "build" with Squeryl. I'd like to get all products that have a quantity which is higher than the average quantity of…
sebastian_oe
  • 7,186
  • 2
  • 18
  • 20