Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6088399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:58:49+00:00 2026-05-23T11:58:49+00:00

I am dusting off my google app-engine / datastore skills … and getting stuck

  • 0

I am dusting off my google app-engine / datastore skills … and getting stuck on something very simple.

As per the example on the GAE documentation I am trying to update an entity as follows:

// persistence and business logic
PersistenceManager pm = PMF.get().getPersistenceManager();

// get it
NickName n = pm.getObjectById(NickName.class, nicknameId);

// update fields
n.givenName = "new name";
n.nickName = "new nickname";
n.timeStamp = new Date();               

// close manager to persist changes
pm.close();

This doesn’t work (as in the changes are not persisted, but no errors or anything else)!

At the same time I found that if I create a new entity with the same ID the changes get persisted:

// persistence and business logic
PersistenceManager pm = PMF.get().getPersistenceManager();

NickName n = new NickName("new name", "new nickname", new Date());

// set id
n.id = nicknameId;

pm.makePersistent(n);

pm.close();

I have the feeling I already solved this the 1st time I approached app engine and the data-store.

This is what my entity looks like:

@PersistenceCapable
public class NickName {

    public NickName(String name, String nickname, Date timestamp) {
        this.givenName = name;
        this.nickName = nickname;
        this.timeStamp = timestamp;
    }

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    public String id;

    @Persistent
    public String givenName;

    @Persistent
    public String nickName;

    @Persistent
    public Date timeStamp;
}

Any help appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:58:49+00:00Added an answer on May 23, 2026 at 11:58 am

    One issue may be that you are setting the fields directly instead of going through the setter methods. I’m fairly certain that JDO works by instrumenting the field setters so that they notify the persistence layer of any changes that occur. It has no way of directly monitoring changes to the backing field values themselves. So maybe try:

    n.setGivenName("new name");
    n.setNickName("new nickname");
    n.setTimeStamp(new Date()); 
    

    You’re able to get away with setting the field directly when you create the object because the makePersistent() call tells the persistence manager that is needs to inspect the field values and save them. Though it’s worth noting that setting field values directly like this is generally considered to be poor coding style.

    Also, have you tried using the JPA interface instead of the JDO interface? In GAE they should be interchangeable:

    EntityManager em = EMF.get();
    
    NickName n = em.find(NickName.class, nicknameId);
    
    n.givenName = "new name";
    n.nickName = "new nickname";
    n.timeStamp = new Date();    
    
    em.merge(n);
    
    em.close();
    

    This gives you an explicit merge() call which should work even with setting the field values directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm dusting off an old project of mine which calculates a number of simple
I'm dusting off an old project of mine. One of the things it had
I'm learning ruby on rails on a linux box and dusting off my VIM
I'm struggling to understand something about GIT. We've got a repository with a number
Attempting to learn functional C#, I ported Dustin Campbell's fibonacci example to C#3. My
My question basically says it all. I am getting this: C:\DOCUME~1\frew\MYDOCU~1\Code\AIRCRA~1\lib\ACD\VALIDA~1.PM and I want
I seem to be getting conflicting advice in the books I read on this
My current problem is not so much a blackberry issue as it is a
After I've seen this PDC session I wanted to try to learn a bit
Templates are a pretty healthy business in established programming languages, but are there any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.