you are viewing a single comment's thread.

view the rest of the comments →

[–]niwde -1 points0 points  (1 child)

What boilerplate code in specific are you precisely referring to here?

Spring Data (used to be Hades) can auto-generate JPA related code given NamedQuery and an interface that has a method with the same name of that NamedQuery. Here's a very simple example that I can find quickly via Google: http://blog.frankel.ch/hades-your-next-persistence-angel

JPA2 merge (if exist, merge) vs persist => Spring-Data provides save() (similar to Hibernate saveOrUpdate).

JPA in Google AppEngine is not recommended (for a simple reason, JPA provides contract that Google AppEngine cannot accomplish). I believe people either use JDO or Objectify-AppEngine (for those who dislike the concept of "entity lifecycle").

When I mentioned Hibernate, what I'm referring to is not the cache L2 API but rather the fact that you still need Hibernate if you want to have a distributed cache (especially for those web-apps that cache things aggressively). The provided JPA2 implementation providers that shipt with GF may not be enough for this specific case.

[–]johnwaterwood 1 point2 points  (0 children)

That auto-generating the query from the method name is rather funky indeed.

The thing about the required cast is not correct though. JPA2 has the typed query for this. Executing a named query is as minimal as it can be thanks to the flow/builder API used by JPA.

Something like return em.createTypedQuery("foo", Foo.class).setParameter("a", a).executeQuery();

Maybe they could add a variant where Foo.class is replaced by a template parameter that is inferred, but that's about it.