I think you've misunderstood where problem is.
I don't have a problem with persisting items, I have a problem with
changing item and getting my changes back.
Problem is in this code.
public void changeItems(Key containerKey, Key itemKey) {
// START TRANSACTION
Container container = jpaTemplate.find(Container.class,
containerKey);
Item changedItem = jpaTemplate.find(Item.class, itemKey);
changedItem.setValue("xxx"); // <------ CHANGE ITEM VALUE
jpaTemplate.flush();
logger.fatal("changed item: " + changedItem);
for (Item item : container.getItems()) {
// Query returns items and one of the items has beed
changed above
logger.fatal("list item: " + item); // <------ ITEM
DOES NOT CONTAIN CHANGES MADE ABOVE
}
// COMMIT TRANSACTION
}
On Apr 9, 3:53 pm, datanucleus <[email protected]> wrote:
> I refer to your method "generateItems(Key containerKey)" where you do
>
> Item item = new Item();
> item.setContainer(container);
> item.setValue(Integer.toString(i));
> em.persist(item);
>
> Where did you put the item in the List exactly? You set the owner of
> the item as this container, great, but it's not in the List. Any List
> has ordering and the above will at best have it in the List
> "somewhere", and at worst just not be present in the List ... since
> you didn't add it. i.e container.getItems().add(item)
--
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.