Note that there are some explanatory texts on larger screens.

plurals
  1. POJDO basics: List or array won't retrieve or return with GWT RPC
    primarykey
    data
    text
    <p>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.</p> <p>I have a class FileInfoBatch (code indents lost here, don't know why) containing a List of FileInfo:</p> <pre><code>@PersistenceCapable public class FileInfoBatch implements Serializable{ private static final long serialVersionUID = 1L; @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private List&lt;FileInfo&gt; fileInfoList; @Persistent private String savedByUserEmail; public FileInfoBatch(){ fileInfoList=new ArrayList&lt;FileInfo&gt;(); } </code></pre> <p>Then I send a FileInfoBatch (called fib) containing just 1 FileInfo in the List, to my RPC impl class &amp; persist it, then query for it straight away for a test (in debugger)</p> <pre><code> PersistenceManager pm = PMF.get().getPersistenceManager(); pm.makePersistent(fib); Query query = pm.newQuery(FileInfoBatch.class, "savedByUserEmail == '"+ userEmail + "'"); List&lt;FileInfoBatch&gt; savedList = (List&lt;FileInfoBatch&gt;) query.execute(); FileInfoBatch persisted=savedList.get(0); </code></pre> <p>The persisted FileInfoBatch comes back with an empty FileInfo list. If I use a single Fileinfo member, this persists ok.</p> <p>I find no such basic problem reported on this site &amp; I've looked at the docs: <a href="https://developers.google.com/appengine/docs/java/datastore/jdo/dataclasses" rel="nofollow">https://developers.google.com/appengine/docs/java/datastore/jdo/dataclasses</a></p> <p>Does such a simple storage task require huge complexity? If so I will go back to using Objectify.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. COJudging by the comments below, everything is persisted and retrieved ok with Lists, which matches my experience; your only problem is in GWT and RPC and not using the current release. I'd suggest you update your question with that so others coming on here see the real situation
      singulars
    2. COEverything in my system is up to date. Other people are having same problem as me. See link below. They are having to copy List data on retrieval because the JDO enhanced classes won't return via RPC. I am using Objectify now again, as it is not problematic, for basic stuff like saving an object with a list.
      singulars
    3. COWell no it isn't; you are doing three things ... persist (which works), retrieve (which works), and RCP. The latter is the part where you have a problem. Your question (still) says something doesn't persist, which is wrong. I'd suggest you focus on individual problems, like I get these objects in my Java code, and then perform this RCP operation. That's what Stackoverflow is for, specific things. If you want to use Objectify then just do it without the bitching, lifes too short. If you want help getting JDO working then express things in simple questions about a specific step
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload