I was getting this problem on the local appengine development server too! I code in GWT, so I needed a modified version of Mr. Tung's fine creation {attribution in code!}; particularly with the blob class in a seperate package from the file meta-data class, and all jsp files converted to jarrable servlets without being in war {drop-in gwt modules should exist wholly in jar}. As soon as I changed the List<Blob> to List<Long>, where long = id of Blobs, to completely separate the packages, .getExtent() and SELECT * would fail.
I could get individual files if I knew their id, but I couldn't get a list of the files using queries or extents.
I would upload a couple files, play with the datastore indexes or the class files, check the /ls servlet for "all files", and see "There are no uploaded files". Checking /dl?id=fileID {download.jsp?}, the files are there and download fine.
Then, after uploading many files, wiping the WEB-INF/appengine-generated/local_db.bin, deleting all datastore indexes and uploading a bunch more files... It eventually just "started" working. The very first time it started working, there were many files in the datastore viewer { localhost:xyz/_ah/admin }, all with every column of data not-null, but only the most recent upload was showing. This was AFTER I had added defaultFetchGroup="true" to all data fields.
The relevant portions of my derived class are as follows, NOTE: This is specialized for GWT.:
/**Derived from GoogleFileService, by Ty Tung, <
tyt...@gmail.com>*/
@PersistenceCapable(identityType = IdentityType.APPLICATION,detachable="false")
public class xFile implements IsSerializable,Serializable{
private static final long serialVersionUID = -1417186764297902980L;
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private String name;
@Persistent
private String title;
@Transient
@Persistent(defaultFetchGroup="true")
@Extension(vendorName = "datanucleus", key = "gae.unindexed", value="true")
private ArrayList<Long> chunks;
@Persistent(defaultFetchGroup="true")
private Date date;
@Persistent(defaultFetchGroup="true")
private String owner;
}
Once I get the code cleaned up a little, I'm going to stick it on
code.google.com, possible with a primed local_db.bin so users don't get this, "can't see files" bug. Basically, if any fields are not properly set and accounted for, queries fail, but getObjectById works. DELETE your manual datastore-index.xml, unless you really need some specific queries... It takes time to get all the right queries set up every time you add a field or class, and an incorrect file seems to invalidate existing db entries.
...Even after "fixing" {overcoming} this bug once when switching to servlets and gwt, it happened again when I split the file and blob classes into different packages. Upload lots of files, add defaultFetchGroup to everything, delete your indexes and appengine-generated, and try accessing all of the fields, whether you need them or not.
xFile x = ...;
x.setFileUnits(x.getFileUnits);//trick
is there for a reason.
I'm a little unsure, but my guess is that detached objects with fields that are never referenced anywhere but the class file describing them are treated like "unused imports"... They are present in the raw datastore, but without ever being "needed" / accessed, they are accidentally trimmed somewhere along the way. Ty's example accesses all fields in file_list.jsp, even the internal keys.
Remember, the real Appengine is a cloud of computers,
The dev server is an abstract mockup of the real thing.
If you can't get it, I could send some source with a primed db. I check x _AT_ aiyx _DOT_ info more often than this email...