title: How to pin an object in local datastore, as well as the object that is related to it?
body: <p>In the <a href="https://parse.com/docs/android_guide#objects-pointers" rel="nofollow">Parse SDK relation</a> section, it gives the following code:</p>
  
  <pre><code>// Create the post
  ParseObject myPost = new ParseObject("Post");
  myPost.put("title", "I'm Hungry");
  myPost.put("content", "Where should we go for lunch?");
  
  // Create the comment
  ParseObject myComment = new ParseObject("Comment");
  myComment.put("content", "Let's do Sushirrito.");
  
  // Add a relation between the Post and Comment
  myComment.put("parent", myPost);
  
  // This will save both myPost and myComment
  myComment.saveInBackground();
  </code></pre>
  
  <p>This is great, and it works.  If you pin the "MyComment" to the local datastore, it looks like it even saves the "MyPost" object as well.  There appears to be an issue though, and that is that the Parent Object (the Post) does not get pinned.</p>
  
  <p>I have the following code:</p>
  
  <pre><code> ParseQuery&lt;ParseObject&gt; bjjHistoryCheck = ParseQuery.getQuery("bjjMatchMoves");
        // bjjHistoryCheck.fromPin("bjjMatches");
        // bjjHistoryCheck.whereEqualTo("className", "bjjMatches");
        bjjHistoryCheck.fromLocalDatastore();
        // bjjHistoryCheck.whereEqualTo("matchLoser", "Debbie Sanchez");
        bjjHistoryCheck.countInBackground(new CountCallback() {
          public void done(int count, ParseException e) {
            Log.i("parse Exception", e.getMessage());&lt;---------
            long e1 = new DateTime().getMillis();
            Log.i("time to find user matches: ",
                            String.valueOf(e1 - s1) + " ms + count: " + String.valueOf(count));
            if (count &lt; 1) {
              noHistoryDialog();
            } else {
              final Intent intent = new Intent(getActivity(), Dialog_History.class);
              intent.putExtra("classToShow", 1);
              startActivity(intent);
            }
  </code></pre>
  
  <p>This works as intended, because I pinned the "bjjMatchMoves", just like I would the comment, and I get back a count of how many moves are in the local data store.  If I replace the moves query, with one for the matches (the posts) then it fails to find anything.   You can see a number of commented out lines...I tried searching every way I could think...nothing.   If I remove the localdatastore option, then it successfully finds the records in the cloud.</p>
  
  <p>The line with the arrow shows the following in LogCat:</p>
  
  <blockquote>
    <p>07-15 22:58:26.018: I/parse Exception(24145): Attempted to fetch an
    object offline which was never saved to the offline cache.</p>
  </blockquote>
  
  <p>So I ask you all...How would you pin both the Comment AND the Post?  Is it possible?  The only way I can think of doing this now, is a dirty way:   Create the Match object when the Activity firs starts, then immediately save it in background.  Once saved, re-retrieve it, then update it with any information entered, plus point any moves recorded towards it, but it would be much cleaner if there was a way to specify the match and moves are pinned.</p>