Here is what I came up with so far. This works, but not sure if it is the best way yet. I can now return the blobinfo entities.
http://code.google.com/p/gwt-examples/source/browse/trunk/DemoUpload/src/org/gonevertical/upload/server/BlobInfoJdo.java - see the source public class BlobInfoJdo { private PersistenceManager pm = PMF.get().getPersistenceManager(); public BlobData[] getBlobs(BlobDataFilter filter) { Entity[] entities = null; try { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); PreparedQuery pq = datastore.prepare(new Query("__BlobInfo__")); List<Entity> entList = pq.asList(FetchOptions.Builder.withLimit((int) filter.getRangeFinish()).offset((int) filter.getRangeStart())); entities = new Entity[entList.size()]; entList.toArray(entities); } finally { pm.close(); } BlobData[] blobData = convert(entities); return blobData; } private BlobData[] convert(Entity[] es) { if (es == null || es.length == 0) { return null; } BlobData[] b = new BlobData[es.length]; for (int i=0; i < es.length; i++) { Map<String, Object> p = es[i].getProperties(); long id = es[i].getKey().getId(); Key key = es[i].getKey(); String ct = (String) es[i].getProperty("content_type"); String fn = (String) es[i].getProperty("filename"); Long size = (Long) es[i].getProperty("size"); Date creation = (Date) es[i].getProperty("creation"); b[i] = new BlobData(); b[i].setKey(key.getName()); b[i].setContentType(ct); b[i].setFilename(fn); b[i].setSize(size); b[i].setCreation(creation); } return b; } } Also worth noting how to count the blobinfo entities. private void test() { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); PreparedQuery pq = datastore.prepare(new Query("__BlobInfo__")); int ce = pq.countEntities(); System.out.println("countEntities: " + ce); } On Aug 29, 4:08 pm, branflake2267 <[email protected]> wrote: > Can anybody get a custom BlobInfo JDO query to work? > > I can't figure out how to do a custom query on the > Blobs?http://code.google.com/p/gwt-examples/source/browse/trunk/DemoUpload/... > > This GQL works to query blobs: "SELECT * FROM > __BlobInfo__"http://code.google.com/appengine/docs/java/javadoc/com/google/appengi... > - api reference to custom querying > > Reference:http://demofileuploadgae.appspot.com/- This is my demo where someone > can test uploading a file to the > blobstore.http://gwt-examples.googlecode.com- my gwt examples > > Thanks for looking, > Brandon -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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-web-toolkit?hl=en.
