]
Chris Bredesen closed ANN-729.
------------------------------
Resolution: Rejected
JIRA is for bugs, not help requests. Please use the forum:
Mapping problem
---------------
Key: ANN-729
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-729
Project: Hibernate Annotations
Issue Type: Task
Environment: Windows xp,ibm db2
Reporter: bharat shah
Attachments: bug.zip
Hi
I have three tables, offer,offertax,tax_dm and quote. The hbm for all the three
tables are attached. offertax has a foreign key relationship with offer and tax_dm.
tax_dm has a one to many relationship with quote. i am doing the following things when i
create a new tax_dm object
Tax tax = new Tax();
quote.getTaxes().add(tax);
tax.setTaxDescription(adminTax.getTaxName());
tax.setTaxName(adminTax.getTaxName());
tax.setQuote(quote);
tax.registerNewOrDirty();
OfferTax offerTax = new OfferTax();
//set it in tax domain
offertaxes.add(offerTax);
offerTax.setTaxPercentage(new
Double(Formatter.ConvertStringToDouble(adminTax.getTaxValue())));
offerTax.setTaxAmount(new Double(0.00));
offerTax.setTax(tax);
offerTax.registerNewOrDirty();
offerTax.setOffer(offer);
registerNewOrDirty() registers the object with the hibernate session
but when i do this it gives me an error "SQL excpetion " trying to insert null
into offer tax. this is because the insert query in offer tax fires before the insert
query in tax_dm. Hence it is not able to find the foregin key association with tax_dm.
Here is the log
O Hibernate: insert into U90JDQD.QUOTE (QUOTE_NM, ACCT_FLEX_ID, STAT_ID, QUOTE_TYP_ID,
SLPRSN_ID, CRTD_BY, CUST_NOTES, INTRN_NOTES, MOD_BY, CRTN_DT, EXPR_DT, MOD_DT,
DLR_CO_MSTR_IND, PUBLISHED_DT, MARG, CERES_APPL_ID, QUOTE_ID) values (?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, default)
[4/22/08 17:47:29:931 IST] 6bc06bc0 SystemOut O Hibernate: select
identity_val_local() from sysibm.sysdummy1
[4/22/08 17:47:30:181 IST] 6bc06bc0 SystemOut O Hibernate: insert into
U90JDQD.QUOTE_CUST (FRST_NM, LAST_NM, BUSN_NM, PHN_NUM, CNTRY, ADDR_LINE_1, ADDR_LINE_2,
CITY, ST_PRVNC_CD, PSTL_CD, CNTY, EMAIL_ADDR, QUOTE_ID, CUST_ID) values (?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, default)
[4/22/08 17:47:30:431 IST] 6bc06bc0 SystemOut O Hibernate: select
identity_val_local() from sysibm.sysdummy1
[4/22/08 17:47:30:666 IST] 6bc06bc0 SystemOut O Hibernate: insert into U90JDQD.OFFR
(OFFR_NM, OFFR_DSC, PRPSL_INCL_IND, SEL_IND, QUOTE_ID, OFFR_ID) values (?, ?, ?, ?, ?,
default)
[4/22/08 17:47:30:900 IST] 6bc06bc0 SystemOut O Hibernate: select
identity_val_local() from sysibm.sysdummy1
[4/22/08 17:47:31:134 IST] 6bc06bc0 SystemOut O Hibernate: insert into
U90JDQD.FNCE_OFFR (FNCL_OFFR_NM, PRPSL_INCL_IND, SEL_IND, RNTL_APPLD_AMT, DWN_PYMT_AMT,
RT_PCT, OFFR_ID, FNCL_OFFR_ID) values (?, ?, ?, ?, ?, ?, ?, default)
[4/22/08 17:47:31:369 IST] 6bc06bc0 SystemOut O Hibernate: select
identity_val_local() from sysibm.sysdummy1
[4/22/08 17:47:31:619 IST] 6bc06bc0 SystemOut O Hibernate: insert into
U90JDQD.OFFR_TAX (TAX_AMT, TAX_PCT, OFFR_ID, TAX_ID, OFFR_TAX_ID) values (?, ?, ?, ?,
default)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R
com.deere.u90.iaf.spring.exception.SpringPersistenceException:
Failure processing IAFHibernateTemplate.persist(Object).
timestamp: 2008-04-22 05:47:32.322 PM IST (1208866652322)
SQL Exception Message: Assignment of a NULL value to a NOT NULL column "TBSPACEID=5,
TABLEID=8, COLNO=2" is not allowed.
SQL State: 23502
SQL Code: -407
entity: id = 2611039 statusCode = null sbuCode = null creationTime = null internalNote =
modifiedTime = Tue Apr 22 17:47:29 IST 2008 totalAmount = 0.0 Quotename = null createdBy =
SL35418 creationDate = Tue Apr 22 17:47:14 IST 2008 modifiedBy = SL35418 markQuotesExpired
= false quoteStatus = code = ACdescription = Active dealerShip = -83763541 accountNumber =
SL3541 email = null address = [Address]: Address1 = ONE JOHN DEERE PLACEAddress2 = , City
= 'MOLINE', State = IL, Postal Code = 61265, Country =
com.deere.jdquote.domain.Country@63016301, County = , email = null customer = ckcID =
0lastName = firstName = middleName = businessName = phone = cellPhone = fax = nullemail =
editURL = nullisEmp = trueerror = falseCkcIDMerged = falseerrorMessage = nullracfID
= nullcustomerDealerAccount = 0commLocID = 0commTypeID = 0continueButtonClicked =
falsemiddleInitial = generation = phyUsCountyCode = nullmailAddressPresent =
falsephyAddressPresent = falsephyCaCCSDCode = nullphyCaCDCode = nullphyCountyName =
nullphyCountry = nullphyState = nullphyStreetAddress = nullmailCountry = nullmailState
= nullmailUsCountyCode = nullmailCaCCSDCode = nullmailCaCDCode = nullmailCountyName =
nullcountyName = nullpurchaserAcct = nullsalesTaxExempt = nullprofilingDealerID =
nullIndividual = falseBusiness = falsemerged = falseJDAIM_CUSTOMER_SOURCE =
jdaimaddress = [Address]: Address1 = [Add1 is null]Address2 = [Add2 is null], City = [city
is null], State = [state is null], Postal Code = [postal code is null], Country =
com.deere.jdquote.domain.Country@3770377, County = null, email = nullcustomerType code =
0type = null salesperson = racfID = SL35418name = LAHOTI,SHOURABHdealerId =
nullcompositeID = nullphoneNumber = nullemail = LahotiSourabh(a)JohnDeere.com
TradeInEquipments Set Size = 0 Equipments Set Size = 0 Set Of Quote Proposal Option Size
= 12 Set Of Proposal Product Info Size = 0 quoteType quoteTypeId = 2quoteTypeName =
PurchasequoteTypeDesc = 2
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at
com.deere.u90.iaf.spring.orm.hibernate.IAFHibernateTemplate.persist(IAFHibernateTemplate.java:701)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at
com.deere.u90.iaf.ejpm.persistence.datamappers.EJPMHibernateMapper.add(EJPMHibernateMapper.java:32)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at
com.deere.jdquote.persistence.datamappers.QuoteMapper.add(QuoteMapper.java:516)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at
com.deere.u90.iaf.ejpm.persistence.UnitOfWork.insertNew(UnitOfWork.java:397)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at
com.deere.u90.iaf.ejpm.persistence.UnitOfWork.access$0(UnitOfWork.java:390)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at
com.deere.u90.iaf.ejpm.persistence.UnitOfWork$1.doInTransactionWithoutResult(UnitOfWork.java:193)
[4/22/08 17:47:32:681 IST] 6bc06bc0 SystemErr R at
com.deere.u90.iaf.spring.transaction.IAFTransactionCallbackWithoutResult.doInTransaction(IAFTransactionCallbackWithoutResult.java:22)
[4/22/08 17:47
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: