Hey ,
why do you want to close the persistance manager here, you are not
saving or updating any entities.
You should use a static PMF class to get the entity manager und you
feed class should have something like this ...
class FEED {
private static PersistenceManager pm;
// this fetches the persistance manager when u need it.
private static PersistenceManager getPM() {
if (pm == null) {
pm = PMF.get().getPersistenceManager();
} else if (pm.isClosed()) {
pm = PMF.get().getPersistenceManager();
}
return pm;
}
@SuppressWarnings("unchecked")
public static List<FEED> getAll() {
PersistenceManager pm = getPM();
String sqlFetch = "SELECT FROM " + FEED.class.getName();
Query query = pm.newQuery(sqlFetch);
query.setOrdering("name asc");
query.setRange(0, 50);
List<FEED> feeds = (List<FEED>)query.execute();
return feeds;
}
Convinienty in your handleRequestInternal calss u can get the results -
>
List<Feed> feeds = FEEDS.getAll();
--
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.