-->
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.  [ 2 posts ] 
Author Message
 Post subject: Could not synchronize database state with session
PostPosted: Thu Nov 01, 2007 1:33 pm 
Newbie

Joined: Thu Nov 01, 2007 1:16 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="gob.mhcp.esigfa.sisef">
<class name="Meta" table="sf_meta" lazy="true">
<composite-id name="id" class="Meta$Id">
<key-property name="ejercicioId">
<column name="ejercicio" sql-type="number(4)"/>
</key-property>
<key-property name="entidadId">
<column name="entidad" sql-type="number(12)"/>
</key-property>
<key-property name="metaId">
<column name="meta" sql-type="number(12)"/>
</key-property>
</composite-id>
<many-to-one name="entidad" class="gob.mhcp.esigfa.Entidad"
foreign-key="meta_entidad_FK" insert="false" update="false">
<column name="ejercicio" sql-type="number(4)"/>
<column name="entidad" sql-type="number(12)"/>
</many-to-one>
<many-to-one name="ejercicio" class="gob.mhcp.esigfa.Ejercicio"
foreign-key="meta_ejercicio_fk" insert="false" update="false">
<column name="ejercicio" sql-type="number(4)"/>
</many-to-one>
<many-to-one name="unidadMedida" class="gob.mhcp.esigfa.UnidadMedida"
foreign-key="meta_unidadmedida_FK" insert="false" update="false">
<column name="ejercicio" sql-type="number(4)"/>
<column name="unidad_Medida" sql-type="number(12)"/>
</many-to-one>
<property name="descripcion">
<column name="descripcion" sql-type="varchar2(1000)" not-null="false"/>
</property>
<property name="sigla">
<column name="sigla" sql-type="varchar2(30)" not-null="false"/>
</property>
<property name="restrictiva" type="gob.mhcp.persistencia.hibernate3.SiNoType"
not-null="true">
<column name="restrictiva" sql-type="varchar2(1)"/>
</property>
<property name="tipoValor">
<column name="tipo_valor" sql-type="varchar2(1)" not-null="false"/>
</property>
<property name="siControlable"
type="gob.mhcp.persistencia.hibernate3.SiNoType" not-null="true">
<column name="si_controlable" sql-type="varchar2(1)"/>
</property>
<property name="siPeriodica" type="gob.mhcp.persistencia.hibernate3.SiNoType"
not-null="true">
<column name="si_periodica" sql-type="varchar2(1)"/>
</property>
<property name="cantidadProyectadaAnual" type="gob.mhcp.esigfa.sisef.util.MontoString">
<column name="proyeccion_anual" sql-type="number(15,2)" not-null="false"/>
</property>
<component name="auditoria" class="gob.mhcp.esigfa.Auditoria">
<property name="fechaIngreso">
<column name="fec_ing" sql-type="Date" not-null="true"/>
</property>
<many-to-one name="usuarioIngreso" foreign-key="USUARIOS_META_UI_FK">
<column name="userid_ing" sql-type="varchar2(30)" not-null="true"/>
</many-to-one>
<property name="fechaActualizacion">
<column name="fec_act" sql-type="Date" not-null="false"/>
</property>
<many-to-one name="usuarioActualizacion"
foreign-key="USUARIOS_META_UA_FK">
<column name="userid_act" sql-type="varchar2(30)" not-null="false"/>
</many-to-one>
</component>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
11:20:57,361 ERROR AbstractFlushingEventListener:301 - Could not synchronize database state with session
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
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.update(AbstractEntityPersister.java:2338)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2242)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2542)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at gob.mhcp.persistencia.hibernate3.Hibernate3Util.commitTransaction(Hibernate3Util.java:56)
at gob.mhcp.esigfa.sisef.web.filter.OpenSessionH3TxFilter.doFilter_internal(OpenSessionH3TxFilter.java:39)
at gob.mhcp.web.filters.AbstractFilter.doFilter(AbstractFilter.java:39)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
at gob.mhcp.esigfa.sisef.web.filter.OpenConnectionFilter.doFilter_internal(OpenConnectionFilter.java:30)
at gob.mhcp.web.filters.AbstractFilter.doFilter(AbstractFilter.java:39)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
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.update(AbstractEntityPersister.java:2338)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2242)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2542)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at gob.mhcp.persistencia.hibernate3.Hibernate3Util.commitTransaction(Hibernate3Util.java:56)
at gob.mhcp.esigfa.sisef.web.filter.OpenSessionH3TxFilter.doFilter_internal(OpenSessionH3TxFilter.java:39)
at gob.mhcp.web.filters.AbstractFilter.doFilter(AbstractFilter.java:39)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)
at gob.mhcp.esigfa.sisef.web.filter.OpenConnectionFilter.doFilter_internal(OpenConnectionFilter.java:30)
at gob.mhcp.web.filters.AbstractFilter.doFilter(AbstractFilter.java:39)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)


Name and version of the database you are using:
Oracle 10g

The generated SQL (show_sql=true):

11:20:57,346 DEBUG SQL:393 - update sf_meta set descripcion=?, sigla=?, restrictiva=?, tipo_valor=?, si_controlable=?, si_periodica=?, proyeccion_anual=?, fec_ing=?, userid_ing=?, fec_act=?, userid_act=? where ejercicio=? and entidad=? and meta=?
07/11/01 11:20:57 Hibernate: update sf_meta set descripcion=?, sigla=?, restrictiva=?, tipo_valor=?, si_controlable=?, si_periodica=?, proyeccion_anual=?, fec_ing=?, userid_ing=?, fec_act=?, userid_act=? where ejercicio=? and entidad=? and meta=?

Debug level Hibernate log excerpt:

Problems with Session and transaction handling?
Could not synchronize database state with session


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 01, 2007 1:35 pm 
Newbie

Joined: Thu Nov 01, 2007 1:16 pm
Posts: 2
I need help, I don`t know what happen.
The error is :
11:20:57,361 ERROR AbstractFlushingEventListener:301 - Could not synchronize database state with session
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1


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