Google App Engine Text Datastore Object not Saving with AMF

July 2nd, 2009 by Ben

I've been working with creating a Flex app with Google App Engine and AMF based on Sekhar Ravinutala's blog post about using GraniteDS and the new Java framework for GAE. Everything was going smoothly until I needed to use a datastore Text object instead of a standard string property because a string can only contain 500 characters. Anytime I would save my item class to the datastore the text property would always come back null on subsequent requests to retrieve the item from the database. Turns out all you have to do is add the following line above your text property's declaration like so:

@Persistent(defaultFetchGroup="true")
Text description;

I was able to find this solution in a Google groups thread here. Apparently, for optimization reasons not all fields are retrieved when an object is requested from the database. With the line of code above, we force the description property to be retrieved.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • DZone
  • Fark
  • LinkedIn
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • RSS
  • email

2 Responses to “Google App Engine Text Datastore Object not Saving with AMF”

  1. [...] here to see the original: Google App Engine Text Datastore Object not Saving with AMF « The … Posted in News | Tags: a-framework-for, about-using, and-the, based-on-sekhar, datastore-, [...]

  2. Junket says:

    Thanks for this – I’d been hit by this problem when using Text and User types and wasn’t sure what was going on… I think they changed the default behaviour for those in Java SDK 1.2.6

Leave a Reply