Hi Caio,

You should post this in Google App Engine group: better chance for
responses.

regards
didier

On Nov 7, 2:42 am, Caio <caio.nery1...@yahoo.com.br> wrote:
> Hello, guys.
>
> I've been using JDO these weeks. I've followed the tutorial at GAE
> Docs, and I learned how to create and get entity objects.
>
> I've created a class 'User' for my system. This class has the
> attributes username(String), password(String), isOnline(boolean) and
> score(int).
>
> I've succeeded at updating the isOnline attribute, but when I tried to
> update the score attribute, I've failed. The return value of the
> setter is always true, but the score value is not updated. Could you
> give any help?
>
> @Override
>
> public boolean setScore(String userName, int increment) {
>
> PersistenceManager pm = PMF.get().getPersistenceManager();
>
> Transaction tx = pm.currentTransaction();
>
> User user;
>
> boolean returnValue;
>
> try {
>
> tx.begin();
>
> user = pm.getObjectById(User.class, userName);
>
> //--detaching-attaching
>
> pm.makePersistent(user);
>
> User auxUser = (User) pm.detachCopy(user);
>
> auxUser.setScore(increment);
>
> pm.makePersistent(auxUser);
>
> returnValue = true;
>
> tx.commit();
>
> //--detaching-attaching
>
> } catch (NullPointerException ex) {
>
> returnValue = false;
>
> } catch (JDOObjectNotFoundException ex) {
>
> user = null;
>
> returnValue = false;
>
> } finally {
>
> if (tx.isActive()) {
>
> tx.rollback();
>
> }
>
> pm.close();
>
> }
>
> return returnValue;

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to