I have following code, which sometimes stores values in the database perfectly but sometimes it truncates some part of the textarea input field content coming through request parameter. It does not save the complete string given by user in textarea. This problem is occuring for 5% of the users in our production application. Can anybody please help me understand what exactly can be wrong ?
Code given has only the functions that are related to the saving part.
CODE GETTING THE VALUES FROM REQUEST.
GoalItemDAO gDAO = new GoalItemDAO();
goalItem.setGoal_Desc(request.getParameter("txtDelivDesc"));
goalItem.setMeasure(request.getParameter("txtMeasure"));
if(request.getParameter("txtSelfAssist") != null)
goalItem.setSelf_Assesment(request.getParameter("txtSelfAssist"));
if(request.getParameter("textfield") != null)
goalItem.setAL_Comment(request.getParameter("textfield"));
gDAO.saveGoalItem(goalItem);
METHOD IN LAST LINE in ABOVE PART OF CODE
public GoalItem saveGoalItem(GoalItem t)
throws DAOException
{
log.debug("Entering METHOD : saveGoalItem(GoalItem)");
GoalItem oGoalItem = getGoalItem(t.getId());
if(oGoalItem == null)
storeObj(t);
else
updateObj(t);
return (GoalItem)retrieveObj(com.ge.corporate.lpapp.business.deliverables.GoalItem.class, t.getId());
}
MAIN UPDATE METHOD USED IN ABOVE CODE
protected void updateObj(Object obj)
throws DAOException
{
try
{
Session session = HibernateSession.currentSession();
session.update(obj);
session.flush();
session.connection().commit();
log.debug("METHOD : updateObj(Object obj)---> Successful execution");
}
catch(HibernateException he)
{
log.debug(" METHOD : updateObj(Object obj)---> failure");
rollback();
log.error(he);
throw new DAOException(he);
}
catch(SQLException sqle)
{
log.debug(" METHOD : updateObj(Object obj)---> failure");
rollback();
log.error(sqle);
throw new DAOException(sqle);
}
finally
{
closeSession();
}
}
|