squeryl

Support of PostgreSQL specific array_agg function in scala frameworks?

♀尐吖头ヾ 提交于 2019-12-12 15:52:11
问题 Is there some scala relational database framework (anorm, squeryl, etc...) using postgres-like aggregators to produce lists after a group-by, or at least simulating its use? I would expect two levels of implementation: a "standard" one, where at least any SQL grouping with array_agg is translated to a List of the type which is being aggregated, and a "scala ORM powered" one where some type of join is allowed so that if the aggregation is a foreign key to other table, a List of elements of the

SBT not resolving Squeryl dependency

▼魔方 西西 提交于 2019-12-12 10:13:03
问题 I recently started a new project with the Play! Framework and Scala. I'm used to using Squeryl for my ORM, but for some reason it cannot resolve my dependency this time (Although it will resolve others, just not squeryl). The only thing I'm doing differently is that I'm on a different computer than I was before (Windows now, Arch before) and I'm using Play 2.1.1 instead of 2.1. EDIT: I am also behind a proxy, I thought this may have been resolved since I can resolve some dependencies, but I

squeryl date to long conversion

社会主义新天地 提交于 2019-12-12 02:28:03
问题 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 java/hibernate. Back in java/hibernate I could create user types and either register them globaly or use them localy on a field with an annotation. This user type defined methods for how to persist the object type to db and how to load it from the db. I read

How to do something on delete in Squeryl

♀尐吖头ヾ 提交于 2019-12-11 03:08:52
问题 I have A and B(a_id:Long) entities. B depends on A . So I've set constrainReference(onDelete cascade) . Everything works fine. But when I delete A I want to free some resources depending on B . Can somehow intercept B 's onDelete() and perform operations then with a Squeryl way or I have to do it manually? 回答1: In your Schema try: override def callbacks = Seq( afterDelete(table) call (record => logger.debug("afterDelete"))) 来源: https://stackoverflow.com/questions/12512941/how-to-do-something

Storing case object with squeryl

徘徊边缘 提交于 2019-12-10 22:06:29
问题 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 the Account class using Squeryl. Example code below: sealed trait Permission case object Administrator extends Permission case object NormalUser extends Permission case class Account( id: Long, email: String, permission: Permission ) extends

Squeryl - “CustomTypesMode is not a member of package org.squeryl.customtypes”?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 12:00:20
问题 I've built Squeryl framework with SBT and am trying to use it with Scala 2.8 and NetBeans 6.9. I've defined an entity model as it is desctibed in Squeryl intro, but the IDE and compiler complain that "CustomTypesMode is not a member of package org.squeryl.customtypes". What might the reason be? 回答1: You don't have to build Squeryl, you can download the jar from http://github.com/max-l/Squeryl/downloads. If you use sbt, you can drop the jar in the lib directory (I just tried and was able to

Squeryl: Run query explicitly

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 06:35:11
问题 When I create a query in squeryl, it returns a Query[T] object. The query was not yet executed and will be, when I iterate over the Query object (Query[T] extends Iterable[T]). Around the execution of a query there has to be either a transaction{} or a inTransaction{} block. I'm just speaking of SELECT queries and transactions wouldn't be necessary, but the squeryl framework needs them. I'd like to create a query in the model of my application and pass it directly to the view where a view

Scala reflection and Squeryl

心已入冬 提交于 2019-12-06 16:15:19
I'm working on my first substantial project using Scala, Scalatra, and Squeryl, and happened upon the following problem: I wanted to have an abstract base class for my DAOs that provided a simple implementation of the basic CRUD operations (create, read, update, delete), so I needed a way for said abstract base class to be aware of which table to reference. With Squeryl, you map your data classes to actual tables in a singleton object that extends squeryl.Schema, and your DAOs are generally companion objects for each class. I came up with the following solution using type tags: First, an

Squeryl fails to reflect in debug mode only

ⅰ亾dé卋堺 提交于 2019-12-06 03:57:15
I can't debug (simple run works fine) my unit tests. Squeryl fails with the following exception: error while reflecting on metadata for (Some(private scala.Option com.company.play.model.db.mapping.Position.orgUnit2id),Some(public scala.Option com.company.play.model.db.mapping.Position.orgUnit2id()),None,Set(@org.squeryl.annotations.ColumnBase(optionType=class java.lang.Object, name=, length=-1, scale=-1, value=ORG_UNIT2ID))) of class com.company.play.model.db.mapping.Position java.lang.RuntimeException: error while reflecting on metadata for (Some(private scala.Option com.company.play.model.db

How to make Squeryl work with the Play! Framework?

北城余情 提交于 2019-12-05 22:45:37
问题 I'm trying to learn how to make a simple database app with Play and Squeryl. I've made the Tasks app from the Play tutorial, but I want to change the model / schema so that it uses Squeryl instead of Anorm. I've been looking at different tutorials, examples and answers, but I haven't really figured out how to do this. So, given the source code from the Play Tutorial (ScalaTodoList); how do I proceed to make it work with Squeryl? More specifically: How do I implement the all() , create() , and