anorm Questions
3
Solved
How do you use Anorm outside of play in Scala? In the Anorm document for play, it simply uses something like:
DB.withConnection { implicit c =>
val result: Boolean = SQL("Select 1").execute() ...
Interactive asked 30/8, 2014 at 13:12
4
Solved
I am using PostgreSQL 9.4 and the awesome JSONB field type. I am trying to query against a field in a document. The following works in the psql CLI
SELECT id FROM program WHERE document -> 'dep...
Brade asked 19/12, 2014 at 20:56
3
This question is related to ( Why is there no string interpolation in Scala? ), but deals more specifically with multi-line strings.
I've just about bought into Martin's suggestion for simple stri...
Osis asked 1/5, 2011 at 21:17
2
Solved
What is the current sbt syntax for using a recent version (say, 2.3 or 2.4) of Play's anorm package in standalone mode (not part of a Play application)?
1
Solved
Almost all guides/tutorials that I've seen only show how to parse values from columns that are directly available in the database. For example, the following is a very common pattern, and I underst...
4
Solved
I found there is such a configuration in application.conf:
# If enabled, log SQL statements being executed.
db.default.logStatements=true
I've enabled it, but I can't find any log file which log...
Lithesome asked 21/2, 2012 at 3:48
2
Solved
Consider a repository/DAO method like this, which works great:
def countReports(customerId: Long, createdSince: ZonedDateTime) =
DB.withConnection {
implicit c =>
SQL"""SELECT COUNT(*)
FRO...
Disclaimer asked 4/12, 2015 at 0:38
2
With Play 2.4.0 Anorm got moved to an external package and logging got changed to LogBack (http://logback.qos.ch)
All well and good but nowhere are the class/package names obvious for tracing SQL ...
Abducent asked 4/6, 2015 at 14:46
0
I'm using Anorm 2.5 and the following snippet:
import anorm.SqlParser._
import anorm._
// Not really needed, but to be sure
import anorm.JavaTimeToStatement
import anorm.JavaTimeParameterMetaData
...
1
Solved
I'm using anorm 2.4 in play framework 2.3 backed postgresql 9.4
Give a model like this:
case class EmailQueue(id:UUID,
send_from:String,
send_to:String,
subject:String,
body:String,
created_...
Marrero asked 22/6, 2015 at 16:53
3
Solved
I'm trying to do a batch insert into a MySQL database table using Anorm (in the play framework 2.3.1). The application I'm building has a standard web front end in addition to requiring batch data ...
2
Solved
We are using Scala Play, and I am trying to ensure that all SQL queries are using Anorm's String Interpolation. It works with some queries, but many are not actually replacing the variables before ...
Lysander asked 10/1, 2015 at 0:46
0
Suppose I have the following two classes:
case class User(id: Long, name: String)
case class Message(id: Long, body: String, to: User, from: User)
The RowParsers might look something like this:...
Obey asked 26/12, 2014 at 4:6
2
Solved
I am really torn between two different stacks with which to build a large application. One the one hand there is this option:
Node.js
express
coffee script
coffeekup
mongoose/mongodb
or
presiste...
Washedup asked 3/10, 2011 at 19:32
2
Solved
I will be implementing a read-only web application in Play 2.1 (Scala). Since I'll only be doing reading and marshaling the data read to JSON I would like to avoid any other DSLs and mappings.
I'v...
Fairspoken asked 24/1, 2013 at 9:29
1
How can I pass a JsObject into a json data type field in a PostgreSQL 9.3 database with Anorm without having to cast it as a string?
Given a PostgreSQL 9.3 table such as:
create table profiles
(
...
Urgency asked 25/10, 2013 at 21:0
1
I have a table with one of the columns having ltree type, and the following code fetching data from it:
SQL("""select * from "queue"""")()
.map(
row =>
{
val queue =
Queue(
row[String]("pa...
1
Solved
Using scala 2.11.1 on play framework 2.3.
Because Anorm didn't support multi-value parameters in previous versions I used David's workaround. Anorm now supports multi-value parameters and I starte...
Whet asked 5/8, 2014 at 14:0
2
Solved
Since version 2.3.0 of the anorm library of play framework, the trait Pk is deprecated and it suggests the usage of its subclasses Id and NotAssigned (documentation).
But what if we have a variabl...
Herzen asked 12/6, 2014 at 19:15
3
Solved
Is it possible to dynamically create a list for anorm's "on" method?
I have a form with optional inputs and currently I check each Option and create a list with the defined Options and am trying ...
Hebraist asked 23/3, 2013 at 20:3
1
I have written a simple hit counter, that updates a MySQL database table using Anorm. I want the transaction to be atomic. I think that the best way would be to join all of the SQL strings together...
7
It seems no easy way to use "in" clause in anorm:
val ids = List("111", "222", "333")
val users = SQL("select * from users where id in ({ids})").on('ids-> ???).as(parser *)
How to replace the...
2
Solved
I have a postgres table -
CREATE TABLE "Contest"
(
id serial NOT NULL,
name varchar(100) NOT NULL,
type char(1) NOT NULL,
status char(1) NOT NULL,
...
)
I'm trying to get field values type...
Earleanearleen asked 16/11, 2013 at 21:52
2
Solved
I am thinking of learning and using the play framework with scala for building web apps. However, I would like real advice on choosing between anorm and slick. My reservation for slick is the...
Leathaleather asked 14/8, 2013 at 11:30
2
Solved
I am using Play 2.1.4 against a postgresql db. In the postgresql db, I am using uuid as my pk datatype, which correlates to java.util.UUID. The SqlParser.getT function in anorm doesn't have an impl...
Goldplate asked 16/9, 2013 at 22:20
1 Next >
© 2022 - 2024 — McMap. All rights reserved.