views:

5008

answers:

5

Pros and Cons of choosing JDO or JPA for a Grails Application that will run on Google AppEngine

+2  A: 

By the way, Grails have its data persistence build on top of Hibernate. How do you think JDO would help you in something Hibernate will not? I don't see why one would choose JDO over the default.

As far as JPA is concerned, I would recommend you to use JPA, Hibernate implementation of JPA which comes handy with Grails, and not any of the Hibernate specific feature, unless otherwise compelling.

[No more relevant after a significant change in question]

Thats perfectly fine to have CRUD operations in your entity itself. But there are cases where you may find yourself operating over multiple entities, in that case a layer comes handy and clean, IMHO. Again, its the matter of requirement.

Adeel Ansari
+2  A: 

[No longer relevant after a significant change in question]

Take a look at the following articles:

http://www.infoq.com/news/2007/09/jpa-dao

Sounds like it really depends on the nature of your application and the size of it. JPA is simpler so I'd stick with that and try to avoid a DAO layer in your application, provided it's a fairly small and simple application.

Jon
Nice link, Jon. +1
Adeel Ansari
+12  A: 

I do see why you would choose JDO. Don't know what is the "default" referred to by other poster. JDO is datastore-agnostic. JPA isn't. JDO allows fetch groups. JPA doesn't. JDO allows datastore identity. JPA doesn't. JDO allows datastore transactions. JPA doesn't. All of this is public record http://db.apache.org/jdo/jdo_v_jpa.html

JDO and JPA don't fill the same problem space. They overlap only for RDBMS. JPA is only designed for RDBMS.JPA is not simpler, as evidenced by the API comparison at http://db.apache.org/jdo/jdo_v_jpa_api.html

--Andy (DataNucleus)

DataNucleus
+2  A: 

I think this discussion may complement Andy's previous answer, although it might contradicts at points. http://groups.google.com/group/google-appengine-java/browse%5Fthread/thread/d14e8b11f7b78a19

nadersoliman
+2  A: 

If you are building for AppEngine the road is shorter and there are less hiccups if you use JDO. Else, you will have a JPA layer around your JDO engine.

icoloma