Hibernate version: 3.0
Hello everyone,
I'm facing a situation in which I get a HE on a delete. The delete does work, but when the transaction is flushed, there's an error.
Here's part of my log:
Code:
2005-12-26 10:18:54,669 DEBUG org.hibernate.SQL -> delete from MPFICHATECNICA where mpFicha=?
Hibernate: delete from MPFICHATECNICA where mpFicha=?
2005-12-26 10:18:54,670 DEBUG hibernate.jdbc.AbstractBatcher -> preparing statement
2005-12-26 10:18:54,672 DEBUG hibernate.type.IntegerType -> binding '13' to parameter: 1
2005-12-26 10:18:54,683 ERROR event.def.AbstractFlushingEventListener -> Could not synchronize database state with session
org.hibernate.HibernateException: Unexpected row count: 0 expected: 1
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:32)
at org.hibernate.persister.entity.BasicEntityPersister.delete(BasicEntityPersister.java:2069)
at org.hibernate.persister.entity.BasicEntityPersister.delete(BasicEntityPersister.java:2213)
at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:59)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at auge.conexao.MPFichaTecnicaService.delMPFichaTecnica(MPFichaTecnicaService.java:269)
at auge.action.UpdDelMPFichaTecnicaAction.execute(UpdDelMPFichaTecnicaAction.java:101)
Here's the code of the delete method:
Code:
Session session = ConnectionFactory.getInstance().getSession();
Transaction t = null;
try
{
t = session.beginTransaction();
session.delete(mpFichaTecnica);
session.flush();
t.commit();
}
catch (HibernateException he)
{
if (t != null) {
t.rollback();
}
he.printStackTrace();
throw he;
}
And my mapping file:
Code:
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="auge.bean.MPFichaTecnica" table="MPFICHATECNICA" >
<id name="mpFicha" column="mpFicha" type="java.lang.Integer">
<generator class="assigned"/>
</id>
<property name="quantidade" column="quantidade" type="java.lang.Integer" />
<property name="principal" column="principal" type="java.lang.Integer" />
<many-to-one name="cor" column="cor" class="auge.bean.Cor"
not-null="false" lazy="false" not-found="ignore"/>
<many-to-one name="fichaTecnica" column="fichaTecnica" class="auge.bean.FichaTecnica"
not-null="false" lazy="false" not-found="ignore"/>
<many-to-one name="materiaPrima" column="materia" class="auge.bean.MateriaPrima"
not-null="false" lazy="false" not-found="ignore"/>
</class>
</hibernate-mapping>
Batching is disabled (my hibernate.jdbc.batch_size is 0)
Can anyone help?
Thanks