Hi,
I'm trying to update an object I've just loaded from database. I can get the object, display it, everything is good on this side, so mapping might be ok. But I can't save() the object in database...
I got an Exception :
Could not synchronize database state with session and another one after that :
Not able to obtain connection even if I have an opened session!
Thx for your help
Hibernate version: 3.0.5
Mapping documents:
Code:
<?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="fr.integrance.hibernate">
<class name="Simulation" table="simulation" lazy="false">
<id name="idSimulation" column="ID_SIMULATION" type="java.lang.Integer">
<generator class="native"/>
</id>
<prop..... not all the details... />
<property name="dateReceptionContrat" column="DATE_RECEPTION_CONTRAT" type="java.util.Date" />
<property name="dateValidationPiecesAFournir" column="DATE_VALIDATION_PIECES_A_FOURNIR" type="java.util.Date" />
<property name="dateAccuseReceptionContrat" column="DATE_ACCUSE_RECEPTION_CONTRAT" type="java.util.Date" />
<property name="dateRetourEnregistrementAdherent" column="DATE_RETOUR_ENREGISTREMENT_ADHERENT" type="java.util.Date" />
<many-to-one name="beneficiaire" class="Ad042benef" cascade="none" not-null="false" lazy="false">
<column name="KEYADHER" />
<column name="KEYBENEF" />
</many-to-one>
<many-to-one name="prospect" column="ID_PROSPECT" class="Prospect" cascade="none" not-null="false" lazy="false" />
<many-to-one name="simulateur" column="ID_SIMULATEUR" class="Simulateur" cascade="none" not-null="true" lazy="false" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
try {
hibSession = HibernateSessionFactory.currentSession();
Transaction tx = hibSession.beginTransaction();
Simulation simulationToUpdate = (Simulation) hibSession.get(Simulation.class, modifierSimulationForm.getIdSimulation() );
simulationToUpdate.setDateValidationPiecesAFournir( dateVPAF );
simulationToUpdate.setDateAccuseReceptionContrat( dateARC );
simulationToUpdate.setDateRetourEnregistrementAdherent( dateREA );
hibSession.save(simulationToUpdate);
request.getSession().setAttribute( "simulation" , simulationToUpdate);
tx.commit();
} catch (HibernateException e) {
log.error("problème hibernate lors de l'update de la simulation");
errors.add("adherent", new ActionMessage("erreur.problemeApplication") );
e.printStackTrace();
return mapping.findForward("echecModifs");
} finally {
HibernateSessionFactory.closeSession();
}
Full stack trace of any exception that occurs:Code:
17:43:41,691 DEBUG SQL:324 - select simulation0_.ID_SIMULATION as ID1_0_, simulation0_.NOM_SIMULATION as NOM2_28_0_, simulation0_.DATE_SIMULATION as DATE3_28_0_, simulation0_.DATE_NAISSANCE as DATE4_28_0_, simulation0_.DUREE_CONTRAT as DUREE5_28_0_, simulation0_.AGE_SOUSCRIPTION as AGE6_28_0_, simulation0_.CAPITAL_INITIAL as CAPITAL7_28_0_, simulation0_.COTISATION_ANNUELLE as COTISATION8_28_0_, simulation0_.VERSEMENT_EXCEPTIONNEL as VERSEMENT9_28_0_, simulation0_.ANNEE_VERS_EXCEP as ANNEE10_28_0_, simulation0_.TOTAL_VERSEMENTS as TOTAL11_28_0_, simulation0_.CAPITAL_FINAL as CAPITAL12_28_0_, simulation0_.RENTE_ANNUELLE_PH as RENTE13_28_0_, simulation0_.RENTE_SANS_DECALAGE_AGE as RENTE14_28_0_, simulation0_.TOTAL_FRAIS_SUR_VERSEMENT as TOTAL15_28_0_, simulation0_.POUR_CENT_REEL_FRAIS as POUR16_28_0_, simulation0_.TOTAL_FRAIS_ENCOURS as TOTAL17_28_0_, simulation0_.INTERETS_GLOBAUX as INTERETS18_28_0_, simulation0_.TYPE_CLIENT as TYPE19_28_0_, simulation0_.TAUX_FRAIS_SUR_ENCOURS as TAUX20_28_0_, simulation0_.TAUX_INTERET as TAUX21_28_0_, simulation0_.VERSEMENT_MAX_TRANCHE_1 as VERSEMENT22_28_0_, simulation0_.TAUX_TRANCHE_1 as TAUX23_28_0_, simulation0_.VERSEMENT_MAX_TRANCHE2 as VERSEMENT24_28_0_, simulation0_.TAUX_TRANCHE_2 as TAUX25_28_0_, simulation0_.COMMENTAIRE as COMMENT26_28_0_, simulation0_.DATE_RECEPTION_CONTRAT as DATE27_28_0_, simulation0_.DATE_VALIDATION_PIECES_A_FOURNIR as DATE28_28_0_, simulation0_.DATE_ACCUSE_RECEPTION_CONTRAT as DATE29_28_0_, simulation0_.DATE_RETOUR_ENREGISTREMENT_ADHERENT as DATE30_28_0_, simulation0_.KEYADHER as KEYADHER28_0_, simulation0_.KEYBENEF as KEYBENEF28_0_, simulation0_.ID_PROSPECT as ID33_28_0_, simulation0_.ID_SIMULATEUR as ID34_28_0_ from simulation simulation0_ where simulation0_.ID_SIMULATION=?
17:43:41,723 DEBUG SQL:324 - select ad042benef0_.KEYADHER as KEYADHER0_, ad042benef0_.KEYBENEF as KEYBENEF0_, ad042benef0_.ORGANISM as ORGANISM5_0_, ad042benef0_.SIGGACSM as SIGGACSM5_0_, ad042benef0_.TYPACTIV as TYPACTIV5_0_, ad042benef0_.KEYSOCIE as KEYSOCIE5_0_, ad042benef0_.QUALIMUT as QUALIMUT5_0_, ad042benef0_.NUMBENEF as NUMBENEF5_0_, ad042benef0_.CLEBENEF as CLEBENEF5_0_, ad042benef0_.DATNAISS as DATNAISS5_0_, ad042benef0_.RANBENEF as RANBENEF5_0_, ad042benef0_.PREBENEF as PREBENEF5_0_, ad042benef0_.NOMBENEF as NOMBENEF5_0_, ad042benef0_.NOMFILLE as NOMFILLE5_0_, ad042benef0_.DATADHES as DATADHES5_0_, ad042benef0_.NOADHBEN as NOADHBEN5_0_, ad042benef0_.SEXBENEF as SEXBENEF5_0_, ad042benef0_.CODCOMPL as CODCOMPL5_0_, ad042benef0_.DTDEBCOM as DTDEBCOM5_0_, ad042benef0_.DTFINCOM as DTFINCOM5_0_, ad042benef0_.DTPREMUT as DTPREMUT5_0_, ad042benef0_.TYPREMUT as TYPREMUT5_0_, ad042benef0_.CODATTES as CODATTES5_0_, ad042benef0_.DTFINATT as DTFINATT5_0_, ad042benef0_.CODRADIA as CODRADIA5_0_, ad042benef0_.DATRADIA as DATRADIA5_0_, ad042benef0_.DTMAJRAD as DTMAJRAD5_0_, ad042benef0_.CODPARTI as CODPARTI5_0_, ad042benef0_.DTDEBPAR as DTDEBPAR5_0_, ad042benef0_.DTFINPAR as DTFINPAR5_0_, ad042benef0_.DATDROIT as DATDROIT5_0_, ad042benef0_.DROITENT as DROITENT5_0_, ad042benef0_.NOMUTUEL as NOMUTUEL5_0_, ad042benef0_.NSECTEUR as NSECTEUR5_0_, ad042benef0_.NSECTION as NSECTION5_0_, ad042benef0_.NSOUSECT as NSOUSECT5_0_, ad042benef0_.CDREGIME as CDREGIME5_0_, ad042benef0_.OLDSOCIE as OLDSOCIE5_0_, ad042benef0_.DTMAJOLD as DTMAJOLD5_0_, ad042benef0_.RESPOMUT as RESPOMUT5_0_, ad042benef0_.DATCREAT as DATCREAT5_0_, ad042benef0_.UPDTDATE as UPDTDATE5_0_, ad042benef0_.UPDTUSER as UPDTUSER5_0_, ad042benef0_.CONFLIT as CONFLIT5_0_, ad042benef0_.INDDROIT as INDDROIT5_0_ from ad042benef ad042benef0_ where ad042benef0_.KEYADHER=? and ad042benef0_.KEYBENEF=?
17:43:41,754 DEBUG SQL:324 - select simulateur0_.ID_SIMULATEUR as ID1_0_, simulateur0_.ID_GERANT as ID2_27_0_, simulateur0_.CIVILITE as CIVILITE27_0_, simulateur0_.NOM as NOM27_0_, simulateur0_.PRENOM as PRENOM27_0_, simulateur0_.EMAIL as EMAIL27_0_, simulateur0_.TELEPHONE as TELEPHONE27_0_ from simulateur simulateur0_ where simulateur0_.ID_SIMULATEUR=?
17:43:41,832 ERROR AbstractFlushingEventListener:277 - Could not synchronize database state with session
org.hibernate.HibernateException: Not able to obtain connection
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:113)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:76)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:69)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:150)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1954)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1909)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2149)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
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:137)
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 fr.integrance.struts.action.ModifierSimulationAction.execute(ModifierSimulationAction.java:75)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:595)
17:43:41,832 ERROR ModifierSimulationAction:77 - problème hibernate lors de l'update de la simulation
org.hibernate.HibernateException: Not able to obtain connection
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:113)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:76)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:69)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:150)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1954)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1909)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2149)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
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:137)
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 fr.integrance.struts.action.ModifierSimulationAction.execute(ModifierSimulationAction.java:75)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:595)
Name and version of the database you are using: MySQL 4.1