On Thu, Sep 6, 2012 at 2:14 PM, Cecil Westerhof <cldwes...@gmail.com> wrote:I want to work with databases in scala. I want to start with sqlite3, but in the future I could switch (to for example H2). Anyone good starting points?
I have only good things to say about Squeryl (http://squeryl.org/) --- it supports H2 (but currently not sqlite3, but you could try to write an adapter).
I'd second SLICK. I'm using it in it's 2.9 incarnation as scalaquery and it's excellent.
What's this about sbt being deprecated though?
I'd second SLICK. I'm using it in it's 2.9 incarnation as scalaquery and it's excellent.
What's this about sbt being deprecated though?
There doesn't seem to be other ORM tools for Scala.
Thanks for the example Flavio, ok I see. Why the emphasis on transactional memory and efficient memory usage? What apps are you targeting?
Also what's your naming conventions for mapping to the tables?
mapperdao uses a different approach and your example would look like
class Stock(val code:String,val categories:Set[Category]) // or List[Category] etc
class Category(val name:String,val stocks:Set[Stock])
You can too use an intermediate StockCategory entity if you prefer.
MapperDao gives direct control on persistence and transactions to client code, i.e.
val tx = Transaction.get(txManager, Propagation.Nested, Isolation.ReadCommited, -1)
// will insert category and insert/update related Stock in 1 transaction
val inserted = tx { () =>
mapperDao.insert(CategoryEntity, category)
}
MapperDao supports nested transactions too along with updates/deletes.
All web frameworks are supported as mapperdao only needs a DataSource to work.
A major feature of mapperdao is support for immutable classes, something that i.e. hibernate doesn't support, along with a typesafe DSL for querying.