Can you post the code that you're using to re-persist the updated HashMap? - Jason
On Thu, Oct 29, 2009 at 6:07 AM, barak <barak.ya...@gmail.com> wrote: > > Thanks, did that and the map is indeed serialized now. But now, the > enitity is fetched, seems like the state is not always kept. > > For example, I would like to store some attribute from an HttpSession > using the UserStats instance. Every time a user in a session press > some button, a instance is fetched (using the session id as an > identifier) and update a counter in the HashMap. The problem I faced > is even that the object is found by the JDO, the counter updated and > the object persisted again, next fetch does not return the instance > with the updated counter. Can you help please debugging this? > > This is the data object: > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > public class UserStats > { > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Key key; > > @Persistent > private String id; > > @Persistent > private Long time; > > @Persistent( serialized ="true" ) > private HashMap<String, Integer> queries; > > public UserStats( String id, Long time ) > { > this.id = id; > > this.time = time; > > queries = new HashMap<String, Integer>(); > } > > public Key getKey() > { > return key; > } > > public String getId() > { > return id; > } > > public void setId( String id ) > { > this.id = id; > } > > public Long getTime() > { > return time; > } > > public void setTime( Long time ) > { > this.time = time; > } > > public HashMap<String, Integer> getQueries() > { > return queries; > } > > public void setQueries( HashMap<String, Integer> queries ) > { > this.queries = queries; > } > } > > On Oct 29, 10:38 am, Patrizio Munzi <patrizio.mu...@eris4.com> wrote: > > HashMap isn't supported as a persistable type. > > The only way you've got to persist it is serialize it: > http://gae-java-persistence.blogspot.com/2009/10/serialized-fields.html > > 1KViewDownload > > > --~--~---------~--~----~------------~-------~--~----~ 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 google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~----------~----~----~----~------~----~------~--~---