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
0
votes
2 answers

Squeryl: Insert if not exists?

How can I do insert if an entry not yet exists using Squeryl? I tried to catch a PSQLException if an insert statement is executed on an already-existing tuple, but it does not work (the PSQLException is not catched). In fact it would be better to…
ideaboxer
  • 3,863
  • 8
  • 43
  • 62
0
votes
1 answer

named database in Play and Squeryl test gave error

I followed this link “Test the Model” part to write a test in Play and Squeryl. But I am using a named database "test" rather than "default". The following code does not work import models.{AppDB, Bar} import org.scalatest.FlatSpec import…
user1096734
0
votes
1 answer

Sub Query in select clause with Squeryl

I'm trying to replicate the following query usine Squeryl. SELECT c.order_number,p.customer,p.base,( SELECT sum(quantity) FROM "Stock" s where s.base = p.base ) as stock FROM "Card" c, "Part" p WHERE c."partId" = p."idField"; I have the…
Alex
  • 1,322
  • 1
  • 20
  • 44
0
votes
1 answer

squeryl ORM in Play with SHA1 password encryption

I am trying to insert username and encrypted password pairs into database table using squeryl ORM framework. My code basically looks like the following: class SHA1(e: StringExpression[String], m:OutMapper[String]) extends…
user1096734
0
votes
1 answer

Squeryl get value of serial

I insert a new row into a database and its id is auto-incremented ("serial"). How can I get the value of the id after insertion? Currently, I am using the following workaround: inTransaction { Schema.table.insert(new Entry( content = "..." …
ideaboxer
  • 3,863
  • 8
  • 43
  • 62
0
votes
1 answer

Inserting an entry into MySQL using Squeryl in Play! framework 2.0

So I'm new to the Play! Framework, and even newer to Scala and Squeryl, but I'm trying to do a simple REST application. Right now I'm testing and trying to get setup with Squeryl. I followed this tutorial for getting setup with Squeryl and…
Ron
  • 513
  • 1
  • 4
  • 22
0
votes
2 answers

Strange result when using squeryl and scala

I'm trying to select the coupled user by getting the correct linkedAccount. The query that is created is correct but when trying to use a property on dbuser e.g dbuser.lastName I get a compile error since dbuser is not of type User but Query1…
jakob
  • 5,979
  • 7
  • 64
  • 103
0
votes
1 answer

squeryl date to long conversion - query hangs on simple operation

kind of a follow up question to my previous one: squeryl date to long conversion I implemented a DateTime(model) to Long(DB) conversion as mentioned in that thread. I wrote a simple query to delete all records with an expired…
samz
  • 1,592
  • 3
  • 21
  • 37
0
votes
1 answer

squeryl date to long conversion

I want to store java.util.Date (or Timestamp) as an int (or Long) in my db using Squeryl. I'd like to control how the date is transformed to the number and vice versa. How can I achieve this? I'm pretty new to scala/squeryl, coming from…
samz
  • 1,592
  • 3
  • 21
  • 37
0
votes
1 answer

KeyedEntity in Squeryl 0.9.6

Version 0.9.6 of Squeryl introduces a new way to declare classes that have an associated primary key, through the use of the KeyedEntityDef typeclass. Still the old way to declare import org.squeryl.KeyedEntity case class Foo(id: Long, myField:…
Andrea
  • 20,253
  • 23
  • 114
  • 183
0
votes
1 answer

Relations and Foreign Keys in Squeryl

Im using Scala, Squeryl and MySql to build a web app. I found it easy to persist simple data as strings or integers. But what about when i have relations between objects and i need to use foreign keys. In my app i have areas, and sub areas which…
Guillermo Zooby
  • 582
  • 2
  • 15
  • 32
0
votes
1 answer

Squeryl and PGObjects

I'm facing a quite difficult to solve problem... I have an existing database that is using a lot of postgresql enum. Now... I don't really know how to retrieve those fields with postgresql. Does anybody manage to do something like that? I have tried…
0
votes
1 answer

Squeryl custom field types

I am trying to create a custom field type in Squeryl. This field represents an Isin code, so it is backed up by a string field. Following the example on the documentation, I have added a simple validation before creating a new isin (never mind what…
Andrea
  • 20,253
  • 23
  • 114
  • 183
0
votes
1 answer

How to convert Squeryl query object to JSON - Play Framework

Case This case are using Scala, Play Framework, Jerkson and Squeryl. I'm trying to convert the query resultset to JSON but the result presents just the 'persisted' field. Question Why the Json.generate() is not printing all entity fields? …
flapjack
  • 704
  • 1
  • 8
  • 13
0
votes
1 answer

How do I implement User validations in Play!?

I have a User model, the scheme for which looks like this: # --- First database schema # --- !Ups create sequence s_user_id; create table user ( id bigint DEFAULT nextval('s_user_id'), firstName varchar(128), lastName varchar(128), …
LuxuryMode
  • 33,401
  • 34
  • 117
  • 188
1 2 3
13
14