I would like to understand what are the use cases, advantages and inconveniences of choosing to use Record , Mapper or even both, in a Liftweb application.
This question came up when I tried to:
I'm putting the use cases here just for the record. You can answer in a more general way.
Mapper has been part of Lift before Lift was Lift. It's a simple "Active Record" style bridge between the database and Scala. I built Mapper based on ideas outlined here: http://web.archive.org/web/20070303054927/http://blog.lostlake.org/index.php?/archives/19-Keeping-the-meaning-with-the-bytes.html
Mapper is intimately tied to JDBC and thus relational databases. Mapper has a reasonable mechanism for building simple queries, but for complex stuff one has to hand-write SQL.
Mapper is solid but crufty.
Record is a more generic abstraction between backing store and Scala. It has weaker implementations of the ideas outlined in "Keeping the meaning with the Bytes"... and very few people notice or care.
There are Record implementations for MongoDB, CouchDB, Squeryl and other storage mechanisms. Writing a new back-end is a few days of work.
Record has a lot of "anomalies" and each back end has its own quirks. The current Record owner has embarked on a wholesale refactoring of Record.
I do not think either Record or Mapper will give you tree-like structures "out of the box" unless you're using the MongoDB backend and in that case, your tree structures will be based on JSON documents rather than relations.
Well, the Mapper and Record libraries are only different abstractions for the database access in Lift applications. Record is the newer one and is considered to substitute Mapper one day. At the moment Record supports NoSQL databases like CouchDB and MongoDB. If your data model fits into the NoSQL world, try Record. Otherwise you can use Mapper in connection with a typical relational database.
I hopefully mentioned some interesting points for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With