This page is no longer maintained — Please continue to the home page at

MapperDao: A new ORM library for Scala

No replies
Konstantine Kougios
Joined: 2011-04-08,
User offline. Last seen 47 weeks 2 days ago.

Hi all,

I am happy to announce the 1st release of a new ORM library for
Scala. MapperDao maps domain classes to database tables. It currently
supports mysql, postgresql (oracle driver to be available soon), one-
to-one, many-to-one, one-to-many, many-to-many relationships,
autogenerated keys, transactions and optionally integrates nicely with
spring framework. It allows freedom on the design of the domain
classes which are not affected by persistence details, encourages
immutability and is type safe. The library is not based on reflection
but rather on good Scala design principles and contains a DSL to query
data, which closely resembles select queries. It doesn't require
implementation of equals() or hashCode() methods which can be
problematic for persisted entities. Mapping is done using type safe
Scala code.

Details and usage instructions can be found at the mapperdao's site:

The library is available for download on the above site and also as a
maven dependency (documentation contains details on how to use it via

Examples can be found at:

Very brief introduction of the library via code sample:

class Product(val name: String, val attributes: Set[Attribute])
class Attribute(val name: String, val value: String)

val product = new Product("blue jean", Set(new Attribute("colour",
"blue"), new Attribute("size", "medium")))
val inserted = mapperDao.insert(ProductEntity, product)
// the persisted entity has an id property:
println("%d : %s".format(,inserted))

Querying is very familiar:

val o=OrderEntity

import Query._
val orders = query(select from o where o.totalAmount >= 20.0 and
o.totalAmount <= 30.0)
println(orders) // a list of orders

I encourage everybody to use the library and give feedback. The
documentation is currently quite extensive, with setup and usage
instructions. Please feel free to comment and get in touch with me at
kostas dot kougios at googlemail dot com.


Kostantinos Kougios

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland