asolfre / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
0 stars 0 forks source link

Objectify 4 and App Engine Memcache (key serialization) #133

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Problems with Key Serialization at Objectify 4 and Memcache.

CODE: (This code works well with Ofy 3.1)

//CacheManager: memcache app engine low level wrapper

CacheManager.put(cacheKey, postalCodeKeyList, 500, CacheAPI.NAMESPACE_LOCATION);

Error:

: java.lang.IllegalArgumentException: Cannot use as value: 
'[Key<?>(PostalCode("48001")), Key<?>(PostalCode("48002")), 
Key<?>(PostalCode("48004")), Key<?>(PostalCode("48005")), 
Key<?>(PostalCode("48006")), Key<?>(PostalCode("48007")), 
Key<?>(PostalCode("48008")), Key<?>(PostalCode("48009")), 
Key<?>(PostalCode("48010")), Key<?>(PostalCode("48011")), 
Key<?>(PostalCode("48012")), Key<?>(PostalCode("48013")), 
Key<?>(PostalCode("48014")), Key<?>(PostalCode("48015")), 
Key<?>(PostalCode("48070")), Key<?>(PostalCode("48071")), 
Key<?>(PostalCode("48080"))]'

Original issue reported on code.google.com by hiri...@gmail.com on 7 Sep 2012 at 9:40

GoogleCodeExporter commented 9 years ago
Sorry, this behaviour occurs with Ofy 4.0a3 and 4.0.a4 jars at 

http://code.google.com/p/objectify-appengine/source/browse/com/googlecode/object
ify/objectify/4.0a4/objectify-4.0a4.jar?repo=maven

Original comment by hiri...@gmail.com on 8 Sep 2012 at 9:23

GoogleCodeExporter commented 9 years ago
Ok.... If you see Issue 120: ResultProxy not serializable....

You can solve this, just creating new instance of ArrayList.

Be carefull, because this behaviour occurs only when you obtain an Array List 
from query.keys().

CacheManager.put(cacheKey, new ArrayList<PostalCode>(postalCodeKeyList), 500, 
CacheAPI.NAMESPACE_LOCATION);

Original comment by hiri...@gmail.com on 8 Sep 2012 at 11:35

GoogleCodeExporter commented 9 years ago
At some point we need to figure out how to get proxies to auto-serialize to 
arraylist.  Merging this into the previous issue.

Original comment by lhori...@gmail.com on 9 Sep 2012 at 3:27