It seems that all the sample applications provided by the Play! framework make use of anorm for persistence. What is the reason for choosing anorm over an ORM? If you are using an ORM, what are you using and why?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I think most of the arguments for anorm are listed on the corresponding page in the documentation.
For the time being I personally prefer a Scala and Play independent data access layer, thus I am using Ebean (and would be using JPA, if it was the recommended default).
Being able to use the Models without any Play-dependencies is a huge plus, in my opinion. Also Anorm does not seem to offer much database independence, since the queries are expressed in native SQL.
回答2:
anorm is a meta acronym for Anorm is Not an Object Relational Mapper, hence it is not an ORM.
And therein lies the answer--it's for those of us who want to be hands-on with their SQL queries.