-->
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.  [ 4 posts ] 
Author Message
 Post subject: Could not update a column in Database( probl. in mapping fil
PostPosted: Thu Feb 08, 2007 11:14 am 
Newbie

Joined: Mon Nov 06, 2006 9:46 am
Posts: 10
when i am trying to update the red coloured column it is going to exception after executeUpate(). what is the problem behind this ? Expecting immediate reply

files are given below

shinoy.v.v.



Hibernate 3.1.2

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="fit.gdms.schemadao.Dispute" table="DISPUTE" schema="GDMW">
<id name="dispSkey" type="long">
<column name="DISP_SKEY" />
<generator class="sequence">
<param name="sequence">DISPUTESEQ</param>
</generator>
</id>
<many-to-one name="userByDispManager" class="fit.gdms.schemadao.User">
<column name="DISP_MANAGER" length="10" />
</many-to-one>
<many-to-one name="userByDispResOwner" class="fit.gdms.schemadao.User">
<column name="DISP_RES_OWNER" length="10" />
</many-to-one>
<many-to-one name="presetDro" class="fit.gdms.schemadao.PresetDro" update="false" insert="false">
<column name="PRESET_DRO" length="50" />
<column name="COUNTRY_CD" length="3" not-null="true" />
<column name="LEDGER_CD" length="2" not-null="true" />
</many-to-one>
<many-to-one name="userByEscLevel3" class="fit.gdms.schemadao.User">
<column name="ESC_LEVEL3" length="10" />
</many-to-one>
<many-to-one name="country" class="fit.gdms.schemadao.Country" update="false" insert="false">
<column name="COUNTRY_CD" length="3" not-null="true" />
</many-to-one>
<many-to-one name="userByEscLevel2" class="fit.gdms.schemadao.User">
<column name="ESC_LEVEL2" length="10" />
</many-to-one>
<many-to-one name="userByDroAssistant" class="fit.gdms.schemadao.User">
<column name="DRO_ASSISTANT" length="10" />
</many-to-one>
<many-to-one name="locDispResCd" class="fit.gdms.schemadao.LocDispResCd" update="false" insert="false">
<column name="LC_DISP_RESON_CD" length="2" />
<column name="COUNTRY_CD" length="3" not-null="true" />
<column name="LEDGER_CD" length="2" not-null="true" />
</many-to-one>
<many-to-one name="wwDispResCd" class="fit.gdms.schemadao.WwDispResCd">
<column name="WW_DISP_RESON_CD" length="2" />
</many-to-one>
<many-to-one name="droGroup" class="fit.gdms.schemadao.DroGroup" update="false" insert="false">
<column name="COUNTRY_CD" length="3" not-null="true" />
<column name="LEDGER_CD" length="2" not-null="true" />
<column name="DRO_GROUP" length="50" />
</many-to-one>
<many-to-one name="ledger" class="fit.gdms.schemadao.Ledger" update="false">
<column name="COUNTRY_CD" length="3" not-null="true" />
<column name="LEDGER_CD" length="2" not-null="true" />
</many-to-one>
<property name="dispNumber" type="string">
<column name="DISP_NUMBER" length="12" not-null="true" />
</property>
<property name="dispStatus" type="string">
<column name="DISP_STATUS" length="20" not-null="true" />
</property>
<property name="dispAuthor" type="string">
<column name="DISP_AUTHOR" length="10" not-null="true" />
</property>
<property name="dispCreateDate" type="date">
<column name="DISP_CREATE_DATE" length="10" not-null="true" />
</property>
<property name="dispIdntfyDate" type="date">
<column name="DISP_IDNTFY_DATE" length="10" />
</property>
<property name="dispAssgnDate" type="date">
<column name="DISP_ASSGN_DATE" length="10" />
</property>
<property name="dispExResDate" type="date">
<column name="DISP_EX_RES_DATE" length="10" />
</property>
<property name="dispResolDate" type="date">
<column name="DISP_RESOL_DATE" length="10" />
</property>
<property name="dispCloseDate" type="date">
<column name="DISP_CLOSE_DATE" length="10" />
</property>
<property name="dupInvNumber" type="string">
<column name="DUP_INV_NUMBER" length="20" />
</property>
<property name="escOvrRidePth" type="character">
<column name="ESC_OVR_RIDE_PTH" length="1" />
</property>
<property name="custContPhone" type="string">
<column name="CUST_CONT_PHONE" length="20" />
</property>
<property name="custFaxNo" type="string">
<column name="CUST_FAX_NO" length="20" />
</property>
<property name="wwDispResDesc" type="string">
<column name="WW_DISP_RES_DESC" length="100" />
</property>
<property name="dispResDesc" type="string">
<column name="DISP_RES_DESC" length="100" />
</property>
<property name="custContName" type="string">
<column name="CUST_CONT_NAME" length="128" />
</property>
<property name="custContEmail" type="string">
<column name="CUST_CONT_EMAIL" length="320" />
</property>
<property name="custContOther" type="string">
<column name="CUST_CONT_OTHER" length="512" />
</property>
<property name="lastUpdId" type="string">
<column name="LAST_UPD_ID" length="10" not-null="true" />
</property>
<property name="lastUpdTs" type="timestamp">
<column name="LAST_UPD_TS" length="26" not-null="true" />
</property>
<set name="disputedAritems" inverse="true">
<key>
<column name="DISP_SKEY" not-null="true" />
</key>
<one-to-many class="fit.gdms.schemadao.DisputedAritem" />
</set>
<set name="notifAssignments" inverse="true">
<key>
<column name="DISP_SKEY" not-null="true" />
</key>
<one-to-many class="fit.gdms.schemadao.NotifAssignment" />
</set>
<set name="dispChangeLogs" inverse="true">
<key>
<column name="DISP_SKEY" not-null="true" />
</key>
<one-to-many class="fit.gdms.schemadao.DispChangeLog" />
</set>
<set name="disputeComments" inverse="true">
<key>
<column name="DISP_SKEY" not-null="true" />
</key>
<one-to-many class="fit.gdms.schemadao.DisputeComment" />
</set>
</class>
</hibernate-mapping>


HQL below


strQuery.append(" update Dispute dispTb set dispTb.wwDispResCd.wwDispResonCd =:newdispResonCodeWW, dispTb.wwDispResDesc =:newWdesc,");
strQuery.append(" dispTb.locDispResCd.id.lcDispResonCd =:newdispResonCodeLoc,dispTb.dispResDesc =:newLdesc, dispTb.dupInvNumber=:newdipnum,");
strQuery.append(" dispTb.dispExResDate=:newexpectResolDate,dispTb.lastUpdId =:newCnum ,dispTb.lastUpdTs=:currentTS");
strQuery.append(" where dispTb.dispSkey = :newdispSkey ");
String query=new String(strQuery);
DisputeLog logDisp = new DisputeLog();
logDisp.setWwDispResCd(request.getParameter("wwDisputeReason"));
logDisp.setWwDispResDesc(wwDispDesc);
logDisp.setLocDispResCd(dispLcCode);
logDisp.setDispResDesc(lcDispDesc);
logDisp.setDupInvNumber(dupInvNum);
logDisp.setDispExResDate(expReDate);
ChangeLogInsertion.logDispute(tempDisp,logDisp,roleUser.getUserCNUM(),hibSession);
hibSession.createQuery(query)
.setString("newdispResonCodeWW", request.getParameter("wwDisputeReason"))
.setString("newWdesc",wwDispDesc)
.setString("newdispResonCodeLoc", dispLcCode) .setString("newLdesc", lcDispDesc)
.setString("newdipnum", dupInvNum)
.setString("newexpectResolDate", expReDate)
.setString("newCnum", request.getParameter("userCNUM"))
.setString("currentTS", CurrentTS.toString())
.setString("newdispSkey", request.getParameter("dispSkey"))
.executeUpdate();


Full stack trace of any exception that occurs:


org.hibernate.exception.ConstraintViolationException: could not execute update query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:334)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:209)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1126)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
at fit.gdms.process.EditDisputeProcess.updateDispute(EditDisputeProcess.java)
at fit.gdms.controller.DispProcMgmtCtrl.updateDispute(DispProcMgmtCtrl.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.dolphin.webengine.lifecycle.plugins.ServletManagerPlugin.handleRequest(ServletManagerPlugin.java:112)
at com.ibm.dolphin.webengine.lifecycle.LifecycleManager.processLifecycleRequest(LifecycleManager.java:215)
at com.ibm.dolphin.webengine.servlet.DRLProxyServlet.service(DRLProxyServlet.java:91)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1657)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:201)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:103)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
Caused by: com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: GDMW.DISPUTE.FK_DISP_PDRO
at com.ibm.db2.jcc.b.zc.d(zc.java:1351)
at com.ibm.db2.jcc.a.db.l(db.java:366)
at com.ibm.db2.jcc.a.db.a(db.java:64)
at com.ibm.db2.jcc.a.r.a(r.java:48)
at com.ibm.db2.jcc.a.tb.c(tb.java:266)
at com.ibm.db2.jcc.b.ad.Z(ad.java:1666)
at com.ibm.db2.jcc.b.ad.d(ad.java:2224)
at com.ibm.db2.jcc.b.ad.d(ad.java:2342)
at com.ibm.db2.jcc.b.ad.V(ad.java:521)
at com.ibm.db2.jcc.b.ad.executeUpdate(ad.java:504)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:334)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:209)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1126)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
at fit.gdms.process.EditDisputeProcess.updateDispute(EditDisputeProcess.java)
at fit.gdms.controller.DispProcMgmtCtrl.updateDispute(DispProcMgmtCtrl.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.dolphin.webengine.lifecycle.plugins.ServletManagerPlugin.handleRequest(ServletManagerPlugin.java:112)
at com.ibm.dolphin.webengine.lifecycle.LifecycleManager.processLifecycleRequest(LifecycleManager.java:215)
at com.ibm.dolphin.webengine.servlet.DRLProxyServlet.service(DRLProxyServlet.java:91)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1657)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:201)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:103)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)





DB2 8.2

when i am trying to update the coloured column it is going to exception after executeUpate(). what is the problem behind this ? Expecting immediate reply


shinoy.v.v.


Top
 Profile  
 
 Post subject: not able to update column
PostPosted: Fri Feb 09, 2007 3:57 am 
Beginner
Beginner

Joined: Wed Nov 15, 2006 4:25 am
Posts: 21
Hi

As the text i extratced from the Hibernate book says that the column can be controlled whether they can appear in INSERT ,UPDATE statement by using the insert and update in xml mapping file.So edit the text whether you marked to below one.


update="true"


This will help you from the problem


Top
 Profile  
 
 Post subject: Re: not able to update column
PostPosted: Fri Feb 09, 2007 9:33 am 
Newbie

Joined: Mon Nov 06, 2006 9:46 am
Posts: 10
shantha wrote:
Hi

As the text i extratced from the Hibernate book says that the column can be controlled whether they can appear in INSERT ,UPDATE statement by using the insert and update in xml mapping file.So edit the text whether you marked to below one.


update="true"

)



hi,

This is not working .it will create mapping problem .I tried this first time .but it is not working .after that i put a post here.If u have any other soln .pls send it soon.here if we put update=true , then we will get message like update =false and insert=false are required(like that)


shinoy.v.v.


Top
 Profile  
 
 Post subject: update and insert mapping exception
PostPosted: Fri Feb 09, 2007 9:51 am 
Beginner
Beginner

Joined: Wed Nov 15, 2006 4:25 am
Posts: 21
Hi

Try to replace the line

insert=false update=false

with

update=true and insert=true. Plz specify both and try again .

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.