I've been using Objectify up till now, but now I have to deal with some code using JDO. I'm having problems with basic stuff that is easy with Objectify, specifically: if an object has either a List or an array as a member, I can't get that to persist.
I have a class FileInfoBatch (code indents lost here, don't know why) containing a List of FileInfo:
@PersistenceCapable
public class FileInfoBatch implements Serializable{
private static final long serialVersionUID = 1L;
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private List<FileInfo> fileInfoList;
@Persistent
private String savedByUserEmail;
public FileInfoBatch(){
fileInfoList=new ArrayList<FileInfo>();
}
Then I send a FileInfoBatch (called fib) containing just 1 FileInfo in the List, to my RPC impl class & persist it, then query for it straight away for a test (in debugger)
PersistenceManager pm = PMF.get().getPersistenceManager();
pm.makePersistent(fib);
Query query = pm.newQuery(FileInfoBatch.class, "savedByUserEmail == '"+ userEmail + "'");
List<FileInfoBatch> savedList = (List<FileInfoBatch>) query.execute();
FileInfoBatch persisted=savedList.get(0);
The persisted FileInfoBatch comes back with an empty FileInfo list. If I use a single Fileinfo member, this persists ok.
I find no such basic problem reported on this site & I've looked at the docs: https://developers.google.com/appengine/docs/java/datastore/jdo/dataclasses
Does such a simple storage task require huge complexity? If so I will go back to using Objectify.