cheers ... makes sense!
On Oct 20, 2:05 pm, "Jason (Google)" <[email protected]> wrote:
> No. The StreamingQueryResult class, which is a List used by DataNucleus to
> store query results, does not implement Serializable which is required for
> all objects stored in memcache. But you can create another List, i.e. an
> ArrayList, copy the (serializable) results into it, and cache this. You'll
> also need to do this if you want to send query results over the wire to a
> GWT-based application, for example.
> - Jason
>
>
>
> On Mon, Oct 19, 2009 at 2:03 PM, Larry Cable <[email protected]> wrote:
>
> > quick question: should I be able to directly serialize (Cache.put
> > (...)) results of JDO queries into Memcache?
>
> > It "appears" not ...
>
> > I have the following class(es):
>
> > @PersistenceCapable(identityType=IdentityType.APPLICATION,
> > objectIdClass=CityState.CityStateKey.class, cacheable="true",
> > detachable="true")
> > public class CityState implements Serializable {
> > public static class CityStateKey implements Serializable {
>
> > �...@notpersistent
> > private static Pattern p =
> > Pattern.compile("^(.*),\\s?([A-Za-z]{2})
> > $");
>
> > public CityStateKey() { }
>
> > public CityStateKey(String keyValue) {
> > final Matcher m = p.matcher(keyValue.trim());
> > if (m.matches()) {
> > city = m.group(1);
> > state = State.valueOf((m.group(2))).name();
> > } else
> > throw new
> > IllegalArgumentException(keyValue);
> > }
>
> > /* (non-Javadoc)
> > * @see java.lang.Object#hashCode()
> > */
> > �...@override
> > public int hashCode() {
> > // elided ...
> > }
>
> > /* (non-Javadoc)
> > * @see java.lang.Object#equals(java.lang.Object)
> > */
> > �...@override
> > public boolean equals(Object obj) {
> > // elided...
> > }
>
> > public String toString() { return (city + Address.COMMASPACE
> > +
> > state); }
>
> > public String state;
> > public String city;
> > }
>
> > public CityState(final String city, final String state) {
> > this.city = city.trim();
> > this.state = state;
> > }
>
> > �...@override
> > public String getCity() {
> > return city;
> > }
>
> > �...@override
> > public String getState() {
> > return state;
> > }
>
> > /* (non-Javadoc)
> > * @see java.lang.Object#hashCode()
> > */
> > �...@override
> > public int hashCode() {
> > // elided...
> > }
>
> > /* (non-Javadoc)
> > * @see java.lang.Object#equals(java.lang.Object)
> > */
> > �...@override
> > public boolean equals(Object obj) {
> > // elided...
> > }
>
> > �...@override
> > public String toString() { return city + Address.COMMASPACE +
> > state; }
>
> > �...@persistent(primaryKey="true") public String state; // should be
> > State GAE/JDO does not support...
> > �...@persistent(primaryKey="true") public String city;
> > }
>
> > when I query "select from CityState" via JDO I get a
> > StreamingQueryResult ...
>
> > if I attempt to put that as a value into memcache I get the typical
> > NotSerializableException indicating that
> > an object in the graph is not serializable ...
>
> > any thoughts/suggestions, clearly the (simple) app domain objects are
> > (both) serializable as are the
> > internal fields ...
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---