Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ORM for Lift: Mapper or JPA?

Tags:

jpa

scala

lift

I'm creating a small application for my company in Lift. I'm quite a newbie in Scala/Lift so I'm using this chance to practice. Now, I have a question on what ORM system to use.

On one hand, Mapper is the Lift default. On the other hand, I've read it's not good in certain areas and will be replaced by Record (which is not yet well documented, so hard to follow by a new user like me).

Opposite to Mapper we have JPA: standard Java, tested and robust ORM with trusted implementations like Hibernate, but not quite "scala-ish" and you loose the capabilities provided by default by Mapper due to its integration with Lift.

I've read on the mailing lists some assertions that JPA is becoming the way to go for Lift, but it doesn't seem a widespread opinion. Somebody can bring some light into the matter?

Thanks!

like image 898
Pere Villega Avatar asked Jan 29 '10 14:01

Pere Villega


2 Answers

Now I facing the same dilema:) Take into consideration that Mapper/Record are not more Scalish then JPA/Hibernate (E.g. in both Mapper and Record you use mutable entities). Check snippets Use of "immutable" Scala entities with Hibernate and Mapping of scala's Option in Hibernate to see how you can use Hibernate in quite scalish way. So if you already know Hibernate and comfortable with it you'd better go this way. Otherwise for small project you can try Mapper.

like image 58
Alexey Avatar answered Sep 30 '22 20:09

Alexey


It depends on what you need. If you have a model that is heavily using inheritance and one/many-to-many relationships then you might be better off with JPA.

However if you want rapid turnaround, Mapper is the way to go. Mapper/Crudify are a great scaffolding pair, and that power is hard to beat.

like image 25
Jim Barrows Avatar answered Sep 30 '22 18:09

Jim Barrows