I had following error from Google App Engine when I was trying to iterate list in JSP page with EL.
Object Manager has been closed
I solved problem with following code, but I don't think that it is very good solution to this problem:
public List<Item> getItems() {
PersistenceManager pm = getPersistenceManager();
Query query = pm.newQuery("select from " + Item.class.getName());
List<Item> items = (List<Items>) query.execute();
List<Item> items2 = new ArrayList<Item>(); // This line solved my problem
Collections.copy(items, items2); // and this also
pm.close();
return (List<Item>) items;
}
When I tried to use pm.detachCopyAll(items) it gave same error. I understood that detachCopyAll() method should do same what I did, but that method should be part of data nucelus, so it should be used instead of my owm methods. So why dosen't detachCopyAll() work at all?