Google App Engine PersistenceManager can process multiple objects ?
Posted
by Frank
on Stack Overflow
See other posts from Stack Overflow
or by Frank
Published on 2010-04-25T01:53:00Z
Indexed on
2010/04/25
2:03 UTC
Read the original article
Hit count: 251
google-app-engine
|persistencemanager
I have some code like this :
PersistenceManager pm=PMF.get().getPersistenceManager();
String query="select from "+PayPal_Message.class.getName()+" where processed == false order by time desc";
List<PayPal_Message> messages=(List<PayPal_Message>)pm.newQuery(query).execute();
if (messages.isEmpty())
{
}
else
{
for (PayPal_Message g : messages)
{
Contact_Info_Entry A_Contact_Entry=Process_PayPal_Message_To_Get_A_License(g.getContent().getValue());
pm=PMF.get().getPersistenceManager();
try
{
pm.makePersistent(A_Contact_Entry);
g.setProcessed(true);
pm.makePersistent(g);
}
catch (Exception e)
{
Send_Email(Email_From,"[email protected]","Servlet Error Message [ "+time+" ]",new Text(e.toString()));
}
// finally { pm.close(); }
}
}
pm.close();
I wonder if it's ok to use the pm above to process multiple objects before closing it. Or do I have to get and close pm for processing each object ?
© Stack Overflow or respective owner