I have the following code [in doPost()] to edit existing record. It does not give any error but record not saved. Any idea? or what is best way to update exsting record based on a single unique field?
if(sAction.compareToIgnoreCase("S")==0)
{
String email = req.getParameter("Email");
PersistenceManager pm = PMF.get().getPersistenceManager();
Query query = pm.newQuery(SMSUser.class);
query.setFilter("Email == pEmail");
query.declareParameters("String pEmail");
List<SMSUser> users = (List<SMSUser>) query.execute(email);
if(!users.isEmpty())
{
Iterator it = users.iterator();
SMSUser u = (SMSUser) it.next();
u.ContractPerson = req.getParameter("ContractPerson");
u.Company = req.getParameter("Company");
u.Address = req.getParameter("Address");
u.Phone = req.getParameter("Phone");
u.Aid = req.getParameter("Aid");
u.Pin = req.getParameter("Pin");
u.SenderId = req.getParameter("SenderId");
u.Url = req.getParameter("Url");
u.Operater = Integer.parseInt(req.getParameter("Operater"));
pm.makePersistent(u);
}
return;
}