I am developing my App with GWT + GAE. today i met a strange thing.
I am using Eclipse Galileo with GWT 1.7 and Google plugin 1.26.
i have a class A, which is defined like the following one;
public Class A {
protected Long id;
protected ArrayList<String> usernames;
public ArrayList<String> getUsernames()
return usernames;
}
public void setUsernames(ArrayList<String> usernames) {
this.usernames = usernames;
}
public void addUsername(String username) {
if(!this.usernames.contains(username)) {
this.usernames.add(username);
}
}
}
on the Server side i have method called share.
public void share(A a, String username) {
PersistenceManager pm = PMF.get().getPersistenceManager();
try {
A a1 = pm.getObjectById(A.class, a.getId());
a1.addUsername(username);
System.out.println(tag.getUsernames());
} catch (Exception e) {
LOG.logp(Level.FINE, "WorkitemServiceImpl", "save",
e.toString());
} finally {
pm.close();
}
}
public void share(A a, String username) {
PersistenceManager pm = PMF.get().getPersistenceManager();
try {
A a1 = pm.getObjectById(A.class, a.getId());
a1.getUsernames().add(username);
System.out.println(tag.getUsernames());
} catch (Exception e) {
LOG.logp(Level.FINE, "WorkitemServiceImpl", "save",
e.toString());
} finally {
pm.close();
}
}
when i call the method share on the client side, like share(a, "test"); the
first one prints "[]", the second one prints "[test]". can anybody explain
why this happens?
thanks in advance!
ray
--
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.