I'm a total n00b here and just getting started trying to figure out how the 
datastore works, mostly by reading the documentation.  Here are the 
assumptions I am making, please tell me if I'm saying anything incorrect:

1) To define persistent entities, one must either create persistent JDO 
classes as mentioned here (http://goo.gl/w9fno) or use JPA
2) Once data is loaded to the entities, the queries explained here 
(http://goo.gl/lHO3S) are the best approach to take for querying the 
datastore as they will query any entity regardless of how it was defined.
3) The bulkloader tool can be used to upload data to an entity

So far, I have defined some entities using JDO classes, and then I used the 
bulkloader to upload data for the entities from a csv file.  The data shows 
up when viewed from the admin console, but when I run the simple flavor of 
queries as mentioned in #2 above, I am getting no results.  Any help or 
introductory advice would be much appreciated.  Thanks.


Here is an example of a class I have defined:

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Rec {

    @PrimaryKey
    @Persistent
    private String code;
    @Persistent
    private String name;
    @Persistent
    private Double value;

    public String getCode() {
        return this.code;
    }
    public String getName() {
        return this.name;
    }
    public Double getValue() {
        return this.value;
    }
}

And here is an example of the query I am trying, just trying to grab the 
stored data and populate new object for runtime:

        Vector<Rec2> Rec2V = new Vector<Rec2>();
        DatastoreService datastore = 
DatastoreServiceFactory.getDatastoreService();
        Query q = new Query(Rec.class.getName());
        q.addSort("value", Query.SortDirection.DESCENDING);
        PreparedQuery pq = datastore.prepare(q);
        for (Entity result : pq.asIterable()) {
            Rec2V.add(new Rec2(
                    (String) result.getProperty("code"), 
                    (String) result.getProperty("name"),
                    (Double) result.getProperty("value")
                    ));
        }

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to