-->
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.  [ 8 posts ] 
Author Message
 Post subject: Problem in incrementin the version number during an update
PostPosted: Mon Jun 11, 2007 2:53 am 
Newbie

Joined: Mon Jun 11, 2007 2:48 am
Posts: 10
Hi i'm having a problem in hibernate when i try to update the version number during an "update". Ideally hibernate should increment it auotmatically but its not doing so. i'm getting this error.

[6/11/07 12:11:14:168 IST] 1bcaf293 SystemErr R java.lang.NullPointerException
[6/11/07 12:11:14:168 IST] 1bcaf293 SystemErr R at org.hibernate.type.IntegerType.next(IntegerType.java:57)
[6/11/07 12:11:14:168 IST] 1bcaf293 SystemErr R at org.hibernate.engine.Versioning.increment(Versioning.java:25)
[6/11/07 12:11:14:168 IST] 1bcaf293 SystemErr R at org.hibernate.event.def.DefaultFlushEntityEventListener.getNextVersion(DefaultFlushEntityEventListener.java:262)
[6/11/07 12:11:14:168 IST] 1bcaf293 SystemErr R at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:140)
[6/11/07 12:11:14:168 IST] 1bcaf293 SystemErr R at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
[6/11/07 12:11:14:168 IST] 1bcaf293 SystemErr R at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
[6/11/07 12:11:14:168 IST] 1bcaf293 SystemErr R at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
[6/11/07 12:11:14:168 IST] 1bcaf293 SystemErr R at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)


Can someone help me with this?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 11, 2007 5:32 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

Send your,

Mapping File

Class File

Code used to save


Amila


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 11, 2007 5:46 am 
Newbie

Joined: Mon Jun 11, 2007 2:48 am
Posts: 10
This is my mapping file.
Here the version column is getting saved when i do a .save() but when i call the .update() it is throwing that error. Do i need to set the version value again while updating?

<id name="customerPartyId" type="java.lang.Integer" column="CUSTOMER_PARTY_ID">
<generator class="sequence">
<param name="sequence">CUSTOMER_PARTY_ID_SEQ</param>
</generator>
</id>

<version name="versionSequenceNbr" column="VERSION_SEQUENCE_NBR"/>
<property name="effectiveDt" type="java.sql.Date" column="EFFECTIVE_DT" not-null="true" length="10"/>

This is my DAO method:::::::::::::::::


public PayerObligor updatePayerDetails(PayerDetailsTO argPayerDetailsTO) throws DAOException
, ConcurrentAccessException
{

try
{

System.out.println("Version Number = " +argPayerDetailsTO.getVersionNbr());

}


this.getHibernateTemplate().update(bisysFileDefaultRule);

this.getHibernateTemplate().save(payerHistory);
}
catch (HibernateOptimisticLockingFailureException e) {
System.out.println("Inside DAO HibernateOptimisticLockingFailureException");
HSABaseLogger.error(logger, "updatePayerDetails", "ERROR:-"
+ e.getMessage());
throw new ConcurrentAccessException(e);
} catch (DataAccessException e) {
HSABaseLogger.error(logger, "updatePayerDetails", "ERROR:-"
+ e.getMessage());
e.printStackTrace();
throw new DAOException(e);
} catch (HibernateException e) {
HSABaseLogger.error(logger, "updatePayerDetails", "ERROR:-"
+ e.getMessage());
throw new DAOException(e);
}

return argPayerObligor;
}


bisysFileDefaultRule is the table where that version sequence number is presnt.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 11, 2007 6:18 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

Don't update bisysFileDefaultRule hibernate will automatically update it .

Amila

(Don't fotget to rate if helps)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 11, 2007 6:33 am 
Newbie

Joined: Mon Jun 11, 2007 2:48 am
Posts: 10
That update() is to update other values into the DB. So i'll have to call it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 11, 2007 7:15 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

what are the other values

send update method implementation


Amila


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 11, 2007 7:23 am 
Newbie

Joined: Mon Jun 11, 2007 2:48 am
Posts: 10
if(bisysDefaultRuleSet == null)
{
argBisysFileDefaultRule = new BisysFileDefaultRule();
bisysDefaultRuleSet = new HashSet();
}
else
{
Iterator bisysDefaultRuleSetIter = bisysDefaultRuleSet.iterator();

while(bisysDefaultRuleSetIter.hasNext())
{
argBisysFileDefaultRule = (BisysFileDefaultRule)bisysDefaultRuleSetIter.next();
}

}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getAccntLetterInd()))
{
argBisysFileDefaultRule.setAccountLetterInd(argPayerDetailsTO.getAccntLetterInd());
}
if(argPayerDetailsTO.getAccntVettingInd() != null)
{
argBisysFileDefaultRule.setAccountVettingInd(argPayerDetailsTO.getAccntVettingInd());
}
if(argPayerDetailsTO.getDepAllowedInd() != null)
{
argBisysFileDefaultRule.setAllowDepositWoDocInd(argPayerDetailsTO.getDepAllowedInd());
}
AutoSweepOptionType autoSweepOptionType = new AutoSweepOptionType();
if(argPayerDetailsTO.getAutoSweepId() != null)
{
autoSweepOptionType.setAutoSweepId(new Short(argPayerDetailsTO.getAutoSweepId()));
argBisysFileDefaultRule.setAutoSweepOptionType(autoSweepOptionType);
}
if(argPayerDetailsTO.getBrand() != null)
{
argBisysFileDefaultRule.setBrandTypeCd(argPayerDetailsTO.getBrand());
}

CheckOrderType checkOrderType = new CheckOrderType();
if(argPayerDetailsTO.getCheckOrderCd() != null)
{
checkOrderType.setCheckOrderCd(argPayerDetailsTO.getCheckOrderCd());
argBisysFileDefaultRule.setCheckOrderType(checkOrderType);
}
if(argPayerDetailsTO.getDivClass() != null)
{
argBisysFileDefaultRule.setCustomerPlanClassId(argPayerDetailsTO.getDivClass());
}
if(argPayerDetailsTO.getEmployerSubId() != null)
{
argBisysFileDefaultRule.setCustomerPlanSubdivisionId(argPayerDetailsTO.getEmployerSubId());
}

DebitCardOrderType debitCardOrderType = new DebitCardOrderType();
if(argPayerDetailsTO.getDebitCardOrderCd() != null)
{
debitCardOrderType.setDebitCardOrderCd(argPayerDetailsTO.getDebitCardOrderCd());
argBisysFileDefaultRule.setDebitCardOrderType(debitCardOrderType);
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getEnrollSetupFeeAmnt()))
{
argBisysFileDefaultRule.setEnrlSetUpFeeAmt(new BigDecimal(argPayerDetailsTO.getEnrollSetupFeeAmnt()));
}
if(argPayerDetailsTO.getInsuranceCarrier() != null)
{
argBisysFileDefaultRule.setInsuranceCarrierId(argPayerDetailsTO.getInsuranceCarrier());
}

InvestmentAllowedType investmentAllowedType = new InvestmentAllowedType();
if(argPayerDetailsTO.getInvestmentsAllowed() != null)
{
investmentAllowedType.setInvestmentAllowedCd(argPayerDetailsTO.getInvestmentsAllowed());
argBisysFileDefaultRule.setInvestmentAllowedType(investmentAllowedType);
}

if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getInvestmentFeeAmnt()))
{
argBisysFileDefaultRule.setInvestmentFeeAmt(new BigDecimal(argPayerDetailsTO.getInvestmentFeeAmnt()));
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getInvestmentThreshold()))
{
argBisysFileDefaultRule.setInvestmentThresholdAmt(new Integer
(argPayerDetailsTO.getInvestmentThreshold()));
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getMinimumTransferAmt()))
{
argBisysFileDefaultRule.setMinimumTransferAmt(new Integer(argPayerDetailsTO.getMinimumTransferAmt()));
}

NewAccountApplicationType newAccountApplicationType = new NewAccountApplicationType();
if(argPayerDetailsTO.getApplType() != null)
{
newAccountApplicationType.setNewAccountApplTypCd(argPayerDetailsTO.getApplType());
argBisysFileDefaultRule.setNewAccountApplicationType(newAccountApplicationType);
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getNoResponseDayNbr2()))
{
argBisysFileDefaultRule.setNoResponseDay2Nbr(new Short(argPayerDetailsTO.getNoResponseDayNbr2()));
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getNoResponseDayNbr3()))
{
argBisysFileDefaultRule.setNoResponseDay3Nbr(new Short(argPayerDetailsTO.getNoResponseDayNbr3()));
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getNoResponseDays()))
{
argBisysFileDefaultRule.setNoResponseDayNbr(new Short(argPayerDetailsTO.getNoResponseDays()));
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getNoResponseInd()))
{
argBisysFileDefaultRule.setNoResponseLetterInd(argPayerDetailsTO.getNoResponseInd());
}
if(argPayerDetailsTO.getNsfClassCd() != null)
{
argBisysFileDefaultRule.setNsfClassCd(argPayerDetailsTO.getNsfClassCd());
}
if(argPayerDetailsTO.getOfficerCd() != null)
{
argBisysFileDefaultRule.setOfficerCd(argPayerDetailsTO.getOfficerCd());
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getPaperApplSetupFeeAmnt()))
{
argBisysFileDefaultRule.setPaperSetUpFeeAmt(new BigDecimal
(argPayerDetailsTO.getPaperApplSetupFeeAmnt()));
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getPrimaryFundList()))
{
argBisysFileDefaultRule.setPrimaryFundList(new Short(argPayerDetailsTO.getPrimaryFundList()));
}
if(argPayerDetailsTO.getProductNumber() != null)
{
argBisysFileDefaultRule.setProductNumber(argPayerDetailsTO.getProductNumber());
}
if(argPayerDetailsTO.getRateRecordCd() != null)
{
argBisysFileDefaultRule.setRateRecordCd(argPayerDetailsTO.getRateRecordCd());
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getSecFundList()))
{
argBisysFileDefaultRule.setSecFundList(new Short(argPayerDetailsTO.getSecFundList()));
}

ServiceChargeOverrideType serviceChargeOverrideType = new ServiceChargeOverrideType();
if(argPayerDetailsTO.getScCode() != null)
{
serviceChargeOverrideType.setServiceChargeOverrideCd(argPayerDetailsTO.getScCode());
argBisysFileDefaultRule.setServiceChargeOverrideType(serviceChargeOverrideType);
}
if(argPayerDetailsTO.getScClass() != null)
{
argBisysFileDefaultRule.setServiceChargeClassCd(argPayerDetailsTO.getScClass());
}
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getSetupFee()))
{
argBisysFileDefaultRule.setSetUpFeeAmt(new Integer(argPayerDetailsTO.getSetupFee()));
}

StatementDeliveryType statementDeliveryType = new StatementDeliveryType();
if(!HSAStringUtil.isEmpty(argPayerDetailsTO.getStatmentDeliveryId()))
{
statementDeliveryType.setStatementDeliveryId(new Short
(argPayerDetailsTO.getStatmentDeliveryId()));
argBisysFileDefaultRule.setStatementDeliveryType(statementDeliveryType);
}
if(argPayerDetailsTO.getFeeClass() != null)
{
argBisysFileDefaultRule.setTpoFeeClassCd(argPayerDetailsTO.getFeeClass());
}
if(argPayerDetailsTO.getVetFailed() != null)
{
argBisysFileDefaultRule.setVettFailedInd(argPayerDetailsTO.getVetFailed());
}

WebBrand webBrand = new WebBrand();
if(argPayerDetailsTO.getWebBrand() != null)
{
webBrand.setWebBrandId(argPayerDetailsTO.getWebBrand());
argBisysFileDefaultRule.setWebBrand(webBrand);
}
WelcomeKitProcessType welcomeKitProcessType = new WelcomeKitProcessType();
if(argPayerDetailsTO.getWelcomeKitProcCd() != null)
{
welcomeKitProcessType.setWelcomeKitProcessCd(argPayerDetailsTO.getWelcomeKitProcCd());
argBisysFileDefaultRule.setWelcomeKitProcessType(welcomeKitProcessType);
}

bisysFileDefaultRulePK.setBisysBranchId(argPayerDetailsTO.getBranchId());
bisysFileDefaultRulePK.setBisysPlanId(argPayerDetailsTO.getPlanId());
//if()
bisysFileDefaultRulePK.setPayerPartyId(argPayerObligor.getPayerPartyId());
argBisysFileDefaultRule.setComp_id(bisysFileDefaultRulePK);
//argBisysFileDefaultRule.set
argBisysFileDefaultRule.setCreateId(argPayerDetailsTO.getUserRole());
//argBisysFileDefaultRule.setCreateTimeStamp(argPayerDetailsTO.getCreatedDate())


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 26, 2007 8:57 am 
Newbie

Joined: Fri Dec 15, 2006 7:07 pm
Posts: 7
Location: Luxembourg
Hi

I guess that in the object you are trying to update, the column you use for versioning (if you use an updateCounter) is null!

Check that the field you defined as version is not null in your database! Initialise it with 1 or 0.

Let me know if this helped.

Kindest regards
Markus

_________________
Markus
SW Developer and wine maker
http://www.jostock.net


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