-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Hibernate Cuts of words
PostPosted: Fri Aug 20, 2004 1:45 pm 
Newbie

Joined: Fri Aug 20, 2004 12:43 pm
Posts: 4
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();
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 20, 2004 1:59 pm 
Newbie

Joined: Fri Aug 20, 2004 12:43 pm
Posts: 4
Forgot to give the xml mapping to tables

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.ge.corporate.lpapp.business.deliverables.GoalItem" table="T_APPR_DELV">
<composite-id name="id" class="com.ge.corporate.lpapp.business.deliverables.Delv" unsaved-value="any">
<key-property name="ROT_ID" type="long" column="ROT_ID"/>
<key-property name="PHASE_NO" type="int" column="PHASE_NO"/>
<key-property name="DELV_ID" type="long" column="DELV_ID"/>
</composite-id>
<property name="Goal_Desc" column="DELV_DESC" type="string" length="1000" not-null="false" />
<property name="Measure" column="MEASURE_TEXT" type="string" length="1000" not-null="false" />
<property name="Due_Date" column="DUE_DATE" type="date" not-null="false" />
<property name="Self_Assesment" column="SELF_ASST" type="string" length="1000" not-null="false" />
<property name="AL_Comment" column="AL_COMMENT" type="string" length="1000" not-null="false" />
<property name="AL_Rank" column="RANK_ID" type="integer" length="1" not-null="false" />
<property name="Member_Rank" column="MEMBER_RANK" type="integer" length="1" not-null="false" />
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 20, 2004 2:01 pm 
Newbie

Joined: Fri Aug 20, 2004 12:43 pm
Posts: 4
Do I need to use 'select-before-update="true"' to fix this problem - but I am not able to test it - since it is not occuring on development machine. it occurs only on production machine which has restricted access.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 20, 2004 2:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Probably the database field is just to short?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 20, 2004 2:44 pm 
Newbie

Joined: Fri Aug 20, 2004 12:43 pm
Posts: 4
no - the database field is having enough char limit. The functionality works perfect for 95% users to the fullest character limit. but for 5% users it does not work that way - it saves only few words - there is no special character in the input.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.