Java AppEngine: JDO or JPA, How to choose?

14,519

Solution 1

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)

Solution 2

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.

Solution 3

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.

Solution 4

[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.

Share:
14,519
zotherstupidguy
Author by

zotherstupidguy

all about ruby and learning new things fast fast fast........

Updated on June 11, 2022

Comments

  • zotherstupidguy
    zotherstupidguy about 2 years

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

  • nate_weldon
    nate_weldon about 12 years
    hibernate does not work with the GAE so you are stuck using some form of JDO or JPA