[appengine-java] Re: Persist HashMap with sdk1.2.2 ?

2009-11-01 Thread barak
Think I found the solution, thanks to this: http://groups.google.com/group/google-appengine-java/browse_thread/thread/fb12ab60c68bf664/4179ae7a25931a53?lnk=gst&q=usersTemp#4179ae7a25931a53 Now I'm updating the counter using that method and everything is working as expected... public void updateQ

[appengine-java] Re: Persist HashMap with sdk1.2.2 ?

2009-11-01 Thread barak
Hi, Thanks for your answers. I'm doing my first steps in JDO and indeed relate it as another relational db... :-) Regarding your first comment - I'm not trying to persist a list, just a single UserStats object. A list is mentioned in the code since execute() returns list of objects. If list is e

[appengine-java] Re: Persist HashMap with sdk1.2.2 ?

2009-10-31 Thread Rusty Wright
Whoops, sorry; ignore my remark about UserStats not being persistable; I looked again at your code and saw that it has a key. I was confused and thinking that you're persisting the List, not an item in the List. But I think the problem with it becoming a root object still remains. Rusty Wri

[appengine-java] Re: Persist HashMap with sdk1.2.2 ?

2009-10-31 Thread Rusty Wright
1) In the case of result.isEmpty(), I don't see where you're adding the new UserStats to the result list. 2) When you do pm.makePersistent( stats ) I think you're going to have a problem adding the new stats to the List, because that makePersistent is going make a new stats a root/parent objec

[appengine-java] Re: Persist HashMap with sdk1.2.2 ?

2009-10-31 Thread barak
Here it is: PersistenceManager pm = PMF.get().getPersistenceManager(); List result = (List) pm.newQuery( "select from " + UserStats.class.getName() + " where id == '" + session.getId() + "'" ).execute(); if( result.isEmpty() ) stats = new UserStats( session.getId(), System.currentTimeMillis

[appengine-java] Re: Persist HashMap with sdk1.2.2 ?

2009-10-30 Thread Jason (Google)
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 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 t

[appengine-java] Re: Persist HashMap with sdk1.2.2 ?

2009-10-29 Thread barak
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 fetc

[appengine-java] Re: Persist HashMap with sdk1.2.2 ?

2009-10-29 Thread leszek
http://code.google.com/intl/pl/appengine/docs/java/datastore/dataclasses.html#Collections --~--~-~--~~~---~--~~ 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] Re: Persist HashMap with sdk1.2.2 ?

2009-10-29 Thread Patrizio Munzi
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 Cheers barak wrote: Hi, I'm trying to persist the following class: @PersistenceCapable(identityType = IdentityType