-->
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.  [ 1 post ] 
Author Message
 Post subject: insert="false" update="false" value not
PostPosted: Wed Jan 31, 2007 2:55 am 
Newbie

Joined: Tue Nov 29, 2005 3:56 am
Posts: 4
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1.1

[b]Mapping documents:
<?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>


[b]Code between sessionFactory.openSession() and session.close():

Dispute disp = new Dispute();

disp.setCountry((Country)cty.get(0));
disp.setLedger((Ledger)ledg.get(0));
disp.setDispCreateDate(sdf.parse(startDate));
disp.setDispNumber(disputeNum);
disp.setDispAuthor(cmntAuthId);
disp.setLastUpdId(cmntAuthId);
disp.setLastUpdTs(CurrentTS);

if(!identiDate.equals("")){
disp.setDispIdntfyDate(sdf.parse(identificationDate));
}

if(!contactName.equals("")){
disp.setCustContName(contactName);
}

if(!contactFaxNo.equals("")){
disp.setCustFaxNo(contactFaxNo);
}

if(!contactEmail.equals("")){
disp.setCustContEmail(contactEmail);
}

if(!contactPhoneNo.equals("")){
disp.setCustContPhone(contactPhoneNo);
}

if(!contactOtherInfo.equals("")){
disp.setCustContOther(contactOtherInfo);
}


disp.setDispStatus("DRAFT");

if(!localCode.equals("")){
//Do we need language here
String localResCode = localCode.substring(0, localCode.indexOf("-")).trim();
List locResCdList = hibSession.createQuery("from fit.gdms.schemadao.LocDispResCd as ldr where ldr.id.countryCd='" + countryCode + "' and ldr.id.ledgerCd='" + ledgerCode + "' and ldr.id.lcDispResonCd='" + localResCode + "'").list();
LocDispResCd lcObj = (LocDispResCd)locResCdList.get(0);
disp.setLocDispResCd(lcObj);
disp.setDispResDesc(lcObj.getDispResDesc());
}


if(!wwDisputeReason.equals("")){
//Do we need language here
String wwResCode = wwDisputeReason.substring(0,wwDisputeReason.indexOf("-")).trim();
List wwResCdList = hibSession.createQuery("from fit.gdms.schemadao.WwDispResCd as wdr where wdr.wwDispResonCd='" + wwResCode + "'").list();
WwDispResCd wwObj = (WwDispResCd)wwResCdList.get(0);
disp.setWwDispResCd(wwObj);
disp.setWwDispResDesc(wwObj.getWwDispResDesc());
}


if(!dupInvNum.equals("")){
disp.setDupInvNumber(dupInvNum);
}

List droGrp = new ArrayList();
List usr = new ArrayList();

if(!dispMgr.equals("")){
usr = hibSession.createQuery("select new fit.gdms.schemadao.User(usr.userCnum) from fit.gdms.schemadao.User as usr where usr.userCnum='" + dispMgr + "'").list();
disp.setUserByDispManager((User)usr.get(0));
}

if(!escOverrule.equals("")){
disp.setEscOvrRidePth(new Character(escOverrule.charAt(0)));
}

if(!dispDRO.equals("")){
User droResOwner = new User(BluePages.getPersonsByInternet(createdDisputeForm.getDroCallupName().trim()).getRow(0).get("CNUM").toString());
disp.setUserByDispResOwner(droResOwner);
}

if(!dispEscLevel2.equals("")){
User escLevel2 = new User(BluePages.getPersonsByInternet(createdDisputeForm.getEscLevel2CallupName().trim()).getRow(0).get("CNUM").toString());
disp.setUserByEscLevel2(escLevel2);
}

if(!dispEscLevel3.equals("")){
User escLevel3 = new User(BluePages.getPersonsByInternet(createdDisputeForm.getEscLevel3CallupName().trim()).getRow(0).get("CNUM").toString());
disp.setUserByEscLevel3(escLevel3);
}

if(!dispDROGroup.equals("")){

List preSetDro=new ArrayList();
List droGroup=new ArrayList();
preSetDro=hibSession.createQuery("from fit.gdms.schemadao.PresetDro as preset where preset.id.countryCd='"+ countryCode +"' and preset.id.ledgerCd='"+ ledgerCode +"' and preset.id.presetDroName='"+ createdDisputeForm.getDroGroup() +"'").list();
droGroup=hibSession.createQuery("from fit.gdms.schemadao.DroGroup as drgrup where drgrup.id.droGroupName='"+createdDisputeForm.getDroGroup()+"' and drgrup.id.countryCd='"+ countryCode +"' and drgrup.id.ledgerCd='"+ ledgerCode +"' ").list();

if(droGroup.size()>0){
disp.setDroGroup((DroGroup)droGroup.get(0));

}else if(preSetDro.size()>0){
disp.setPresetDro((PresetDro)preSetDro.get(0));
}

}


hibSession.save(disp);
Full stack trace of any exception that occurs:
No exception but the values are not updated in the following fields
Ledger
Preset DRO
DRO Group
Local Action Action

All these tables have a composite key with CountryCd and LedgerCd in it. The Dispute hbm has reference to all these tables. Now in order to stop Hibenate from inserting CountryCd and LedgerCd from all these references, we added insert="false" update="false". But due to this the data is not getting populated in Preset DRO, DRO Group, Local Action Action columns in Dispute table.


[b]Name and version of the database you are using:
DB2/6000 8.2.0


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

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.