Google App Engine update an object from servlet not working ?
Posted
by Frank
on Stack Overflow
See other posts from Stack Overflow
or by Frank
Published on 2010-05-13T16:04:21Z
Indexed on
2010/05/13
20:24 UTC
Read the original article
Hit count: 265
I use the following code to update an object from servlet in Google App Engine :
String Time_Stamp=Get_Date_Format(6),query="select from "+Contact_Info_Entry.class.getName()+" where Contact_Id == '"+Contact_Id+"' order by Contact_Id desc";
PersistenceManager pm=null;
try
{
pm=PMF.get().getPersistenceManager();
// note that this returns a list, there could be multiple, DataStore does not ensure uniqueness for non-primary key fields
List<Contact_Info_Entry> results=(List<Contact_Info_Entry>)pm.newQuery(query).execute();
Contact_Info_Entry A_Contact_Entry=results.get(0);
A_Contact_Entry.Extra_10=Time_Stamp;
pm.makePersistent(A_Contact_Entry);
}
catch (Exception e) { Send_Email(Email_From,Email_To,"Check_License_Servlet Error [ "+Time_Stamp+" ]",new Text(e.toString()+"\n"+Get_Stack_Trace(e)),null); }
finally { pm.close(); }
The value "[ 2010-05-13 Thu 15:58:31 ]" was in A_Contact_Entry.Extra_10, but it seems "pm.makePersistent(A_Contact_Entry);" was not executed. The object was not updated and there was no error message, why ? How to fix it ?
© Stack Overflow or respective owner