web applications - When to use Mapper or Record in Lift? -
i understand use cases, advantages , inconveniences of choosing use record , mapper or both, in liftweb application.
this question came when tried to:
- create tree structure model classes
- create similar tree structure rendering of classes in page
- ensure different classes in tree can in different states @ same time. 1 in edit or create state , other in visualize state example.
- model classes can created, read or saved restful web service functioning.
i'm putting use cases here record. can answer in more general way.
mapper has been part of lift before lift lift. it's simple "active record" style bridge between database , scala. 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 intimately tied jdbc , relational databases. mapper has reasonable mechanism building simple queries, complex stuff 1 has hand-write sql.
mapper solid crufty.
record more generic abstraction between backing store , scala. has weaker implementations of ideas outlined in "keeping meaning bytes"... , few people notice or care.
there record implementations mongodb, couchdb, squeryl , other storage mechanisms. writing new back-end few days of work.
record has lot of "anomalies" , each end has own quirks. current record owner has embarked on wholesale refactoring of record.
i not think either record or mapper give tree-like structures "out of box" unless you're using mongodb backend , in case, tree structures based on json documents rather relations.
Comments
Post a Comment