Actually I intended to write:

>
>    - JPA: I practice it on a daily base and it's very good but I feel like
>    there is *a mismatch *between JPA and lift / scala. Not that I have
>    thought a lot about it, it's just a feeling.
>
>
Your input just confirms my feelings.

Thanks.

On Sun, Nov 22, 2009 at 8:11 PM, Chris Lewis <burningodzi...@gmail.com>wrote:

> I'm writing an app to deploy to googele app engine, and so I'm using
> JPA. Here are the cons I've encountered:
>
> 1) JPA mandates conventions on model class code. In scala this usually
> means any persistent fields are public vars, which is theoretically
> dangerous (and generally frowned upon). I personally have mixed feelings
> on mutability in domain entity classes (Mapper entities are also
> mutable), and there is ongoing discussion on this topic.
>
> 2) Collections in JPA are java.util, not scala. This means that you
> can't transform them as you can with the usual higher order functions
> found scala collections (map, filter, etc), unless you use implicit
> conversions (usually via jcl). Implicits make your code feel like scala
> code, but I'm not a fan of having conversions rampant for this, and I
> don't like to explicitly pollute my namespaces by importing jcl.
>
> 3) JPA is not monadic. JPA entities are from java land, and in java land
> you represent optional members with null. Idiomatic scala doesn't do
> nulls because they wreak havoc at runtime. Always. Consider an entity
> Person with a member "middleName." In your domain it isn't required, and
> so you allow null at the database level. In a JPA impl you allow this to
> be null, and now everywhere you reference middleName, you absolutely
> must test for null. In scala you use the Option monad, so middleName is
> no longer of type String but Option[String]. NPEs are now effectively
> impossible.
>
> chris
>
> Oscar Picasso wrote:
> > I am starting to (re)learn lift and wondering which persistence
> > mechanism I should use: Mapper, Record or JPA?
> >
> > It should be ready for for prime time and fit perfectly with the lift /
> > scala way of doing things but still be powerful enough.
> >
> >     * I have read that Mapper has some limitations like when dealing
> >       with complex object graphs, many to many relationships etc.
> >     * I don't know Record but I have two concern with it: is it mature
> >       enough? I have read that David is not satisfied with Record
> >       especially on the mutability front. What are the practical
> >       implications of not having immutability for Record?
> >     * JPA: I practice it on a daily base and it's very good but I feel
> >       like there is between JPA and lisft / scala. Not that I have
> >       thought a lot about it, it's just a feeling. I have also read
> >       there are some issues with the Hibernate Validators.
> >
> > Could some people on the list be kind enough to summarize the pros and
> > cons of using any of these solutions at this stage?
> >
> > --
> >
> > You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> > For more options, visit this group at
> > http://groups.google.com/group/liftweb?hl=.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=.


Reply via email to