开发者

JDO - List of Strings not being retrieved from database

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 h开发者_如何学编程ave 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜