-->
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: Update & Delete sql missing Discriminator Column (help)
PostPosted: Mon Jul 21, 2008 4:13 pm 
Newbie

Joined: Wed Sep 20, 2006 2:16 pm
Posts: 2
Guys,

I am having a strange problem. I have to hibernate objects stored in same table. I can insert the data, but when I try to delete or update a row, hibernate does not include Discriminator Column (DATA_TYPE) in the sql, so I get an exception org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1

Hibernate-Version: 3.2.6.ga


@Table(name = "UOSTOBFC")
@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@ForceDiscriminator
@DiscriminatorColumn(name = "DATA_TYPE")
@DiscriminatorValue(value = "OBJT")
public class SosObjective extends LevelEntity<SosObjective, SosObjective.SosObjectivePk>
{
...
}


@Table(name = "UOSTOBFC")
@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@ForceDiscriminator
@DiscriminatorColumn(name = "DATA_TYPE")
@DiscriminatorValue(value = "FORC")
public class SosForecast extends LevelEntity<SosForecast, SosForecast.SosForecastPk>
{
....
}

Hibernate: insert into UOSTOBFC (DATA_VALUE, MOD_DATE, MOD_TIME, MOD_USER, DATA_TYPE, DATA_PERIOD, LEVEL_TYPE, LE
VEL_VALUE, LINE_MAKE_ID, SALE_DIMENSION, SALE_MONTH, SALE_UNIT_TYPE, SALE_UNIT_VALUE, SALE_YEAR) values (?, ?, ?, ?, 'FO
RC', ?, ?, ?, ?, ?, ?, ?, ?, ?)

Hibernate: delete from UOSTOBFC where DATA_PERIOD=? and LEVEL_TYPE=? and LEVEL_VALUE=? and LINE_MAKE_ID=? and SAL
E_DIMENSION=? and SALE_MONTH=? and SALE_UNIT_TYPE=? and SALE_UNIT_VALUE=? and SALE_YEAR=?

org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actu
al row count: 2; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:71)
at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:24)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2525)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2702)
at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:77)


Thanks for the help in advance.
Rahul


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.