JDO vs JPA for Java on Google App Engine

前端 未结 12 623
生来不讨喜
生来不讨喜 2020-12-12 12:22

I want to develop my project on Google App Engine with Struts2. For the database I have two options JPA and JDO. Will you guys please suggest me on it? Both are new for me a

12条回答
  •  抹茶落季
    2020-12-12 13:09

    Neither!

    Use Objectify, because is cheaper (use less resources) and is faster. FYI: http://paulonjava.blogspot.mx/2010/12/tuning-google-appengine.html

    Objectify is a Java data access API specifically designed for the Google App Engine datastore. It occupies a "middle ground"; easier to use and more transparent than JDO or JPA, but significantly more convenient than the Low-Level API. Objectify is designed to make novices immediately productive yet also expose the full power of the GAE datastore.

    Objectify lets you persist, retrieve, delete, and query your own typed objects.

    @Entity
    class Car {
        @Id String vin; // Can be Long, long, or String
        String color;
    }
    
    ofy().save().entity(new Car("123123", "red")).now();
    Car c = ofy().load().type(Car.class).id("123123").now();
    ofy().delete().entity(c);
    

提交回复
热议问题