views:

64

answers:

1

On my User class I have a field that is a list of strings:

@Persistent
private List<String> openIds;

When I create a new user I do this:

User user = new User();
user.openIds.add(openid);
pm.makePersistent(user);

When I break after that last line and look, the openIds contains the openid I put in there. But, when I later call User user = pm.getObjectById(User.class, id); with the correct id, the openIds field is an empty list.

Anyone know what could cause that?

EDIT: BTW I'm running on the Google App Engine

UPDATE: Looking at the datastore viewer, I can see the openid was correctly stored in the database. So its just not getting it out correctly...

UPDATE 2: Its working fine now. I'm pretty sure I didn't change anything. I think what must have happened is that there was an old version of the user object being pulled from the database. A user object that was put in before I had the code that saves the openid. Once I wiped the database things worked fine.

A: 

Not putting that field in the fetch plan ? Accessing persistent fields directly, rather than going via setters ?

DataNucleus
Do I need to add it to the default fetch plan even though its just a list of strings?
Kyle
You mean "just a list of Strings" that isn't by default in the DFG ?
DataNucleus
Interested in how this pans out, as I'm having the same problem. I can't modify the list in the datastore as it's null. I've tried setting the fetchSize to 3, but no use. It'd be nice if someone had the time to do a comprehensive example..
Spedge
reading the GAE/J log (at DEBUG level) ?
DataNucleus
Setting a fetchSize to 3 is of no use since it is for something else. I said put the field in the fetch plan, which it isn't by default
DataNucleus