The session.flush java code return a net.sf.hibernate.HibernateException identifier of an instance of fr.gouv.impots.appli.pivotmas.persistance.modeleov.EtatTraitementMdlValeur altered
from fr.gouv.impots.appli.pivotmas.persistance.modeleov.EtatTraitementMdlValeur@2585e
to fr.gouv.impots.appli.pivotmas.persistance.modeleov.EtatTraitementMdlValeur@2585e
This error only occured in the modification operation. Here are the details of my configuration and execution :
Hibernate version:
2.0
Mapping documents:
No need in this case. The mapping works on creation and get operation. The only operation which failed is the modification
Code between sessionFactory.openSession() and session.close():
Code:
Session session = HibernateUtil.currentSession();
depot = restituerDepotById(session, requete.getIdDepot()); //Works fine
Iterator iterat = depot.getListeSectionsDepot().iterator();
while (iterat.hasNext())
{
SectionMdlValeur sectionMdlValeur = (SectionMdlValeur) iterat.next();
boolean aModifier = ((requete.getIdSection() != null) ? (sectionMdlValeur.getId().equals(requete
.getIdSection())) : ((requete.getTypeSection() != null) ? (sectionMdlValeur.getTypeSection()
.getCode().equals(requete.getTypeSection())) : true));
if (aModifier)
{
modifierEtatSection(sectionMdlValeur, requete, session);
// Incrementer le Nb de sections modifiees
nbSectionsModifiees++;
}
}
session.save(depot);
session.flush();
Full stack trace of exception that occurs:
Stacktrace :
Quote:
net.sf.hibernate.HibernateException: identifier of an instance of fr.gouv.impots.appli.pivotmas.persistance.modeleov.EtatTraitementMdlValeur altered from fr.gouv.impots.appli.pivotmas.persistance.modeleov.EtatTraitementMdlValeur@11edceb to fr.gouv.impots.appli.pivotmas.persistance.modeleov.EtatTraitementMdlValeur@11edceb
at net.sf.hibernate.impl.SessionImpl.checkId(SessionImpl.java:2670)
at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2493)
at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2486)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2281)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2260)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at fr.gouv.impots.appli.pivotmas.persistance.DepotDaoEntite_ModifierDepotTest.testModifierEtat(DepotDaoEntite_ModifierDepotTest.java:207)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
database : Oracle 10.2.0.3.0
The generated SQL (show_sql=true):Long and boring, the code line where the exception occured doesn't show generated sql. But just in cas, here is the previous generated code :
The only interesting thing to me is that there is no insert or alter or update statement :
Quote:
Hibernate: select listeetats0_.ID_SECTION as ID_SECTION__, listeetats0_.ID_REFERENCE_CONSOMMATEUR as ID_REFER2___, listeetats0_.ID_SECTION as ID_SECTION0_, listeetats0_.ID_REFERENCE_CONSOMMATEUR as ID_REFER2_0_, listeetats0_.ID_REFERENCE_ETAT_TRAITEMENT as ID_REFER3_0_, listeetats0_.HORODATAGE as HORODATAGE0_, listeetats0_.DATE_PREMIERE_ANO as DATE_PRE5_0_ from t_etat_traitement listeetats0_ where listeetats0_.ID_SECTION=?
Hibernate: select this.ID_REFERENCE as ID_REFER1_0_, this.CODE as CODE0_, this.LIBELLE as LIBELLE0_, this.NATURE as NATURE0_ from t_reference this where this.NATURE=?
Hibernate: select this.ID_REFERENCE as ID_REFER1_0_, this.CODE as CODE0_, this.LIBELLE as LIBELLE0_, this.NATURE as NATURE0_ from t_reference this where this.NATURE=?
Thank you for reading!