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
|