Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
hibernate 2.1.4
Mapping documents:
Mapping of client fiche :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.1
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="com.orange.greco.persistance.dao.client.bean.ClientFicheTO"
table="CLIENTFICHE"
>
<id
name="idClient"
type="java.lang.Integer"
column="ID_CLIENT"
>
<generator class="sequence">
<param name="sequence">SEQCLF00</param>
</generator>
</id>
<property
name="numeroclient"
type="java.lang.Long"
column="NUMEROCLIENT"
not-null="true"
length="10"
/>
<property
name="etat"
type="java.lang.String"
column="ETAT"
length="2"
/>
<property
name="civilite"
type="java.lang.String"
column="CIVILITE"
length="8"
/>
<property
name="nom"
type="java.lang.String"
column="NOM"
not-null="true"
length="32"
/>
<property
name="indContentieux"
type="java.lang.String"
column="IND_CONTENTIEUX"
not-null="true"
length="1"
/>
<property
name="adr1"
type="java.lang.String"
column="ADR1"
length="32"
/>
<property
name="adr2"
type="java.lang.String"
column="ADR2"
length="32"
/>
<property
name="adr3"
type="java.lang.String"
column="ADR3"
length="32"
/>
<property
name="adr4"
type="java.lang.String"
column="ADR4"
length="32"
/>
<property
name="localite"
type="java.lang.String"
column="LOCALITE"
length="32"
/>
<property
name="cp"
type="java.lang.Integer"
column="CP"
length="5"
/>
<property
name="codeinsee"
type="java.lang.Integer"
column="CODEINSEE"
length="5"
/>
<property
name="pays"
type="java.lang.String"
column="PAYS"
length="32"
/>
<property
name="telfixe"
type="java.lang.Long"
column="TELFIXE"
length="18"
/>
<property
name="civiliteSubst"
type="java.lang.String"
column="CIVILITE_SUBST"
length="8"
/>
<property
name="nomSubst"
type="java.lang.String"
column="NOM_SUBST"
length="32"
/>
<property
name="adr1Subst"
type="java.lang.String"
column="ADR1_SUBST"
length="32"
/>
<property
name="adr2Subst"
type="java.lang.String"
column="ADR2_SUBST"
length="32"
/>
<property
name="adr3Subst"
type="java.lang.String"
column="ADR3_SUBST"
length="32"
/>
<property
name="adr4Subst"
type="java.lang.String"
column="ADR4_SUBST"
length="32"
/>
<property
name="localiteSubst"
type="java.lang.String"
column="LOCALITE_SUBST"
length="32"
/>
<property
name="cpSubst"
type="java.lang.Integer"
column="CP_SUBST"
length="5"
/>
<property
name="paysSubst"
type="java.lang.String"
column="PAYS_SUBST"
length="32"
/>
<property
name="codeinseeSubst"
type="java.lang.Integer"
column="CODEINSEE_SUBST"
length="5"
/>
<property
name="telfixeSubst"
type="java.lang.Long"
column="TELFIXE_SUBST"
length="18"
/>
<property
name="solde"
type="java.lang.Integer"
column="SOLDE"
length="9"
/>
<property
name="indRecouvrement"
type="java.lang.String"
column="IND_RECOUVREMENT"
not-null="true"
length="1"
/>
<property
name="srStatutrecouv"
type="java.lang.String"
column="SR_STATUTRECOUV"
not-null="true"
length="1"
/>
<property
name="mttrecouvrement"
type="java.lang.Integer"
column="MTTRECOUVREMENT"
length="9"
/>
<property
name="mttrecouvrementinit"
type="java.lang.Integer"
column="MTTRECOUVREMENTINIT"
not-null="true"
length="9"
/>
<property
name="dateprochainrecouvr"
type="date"
column="DATEPROCHAINRECOUVR"
length="7"
/>
<property
name="datedernmodif"
type="date"
column="DATEDERNMODIF"
length="7"
/>
<property
name="indNvxpaiement"
type="java.lang.String"
column="IND_NVXPAIEMENT"
not-null="true"
length="1"
/>
<property
name="daterejet"
type="date"
column="DATEREJET"
length="7"
/>
<property
name="numeroSiret"
type="java.lang.String"
column="NUMERO_SIRET"
length="20"
/>
<property
name="jourFacturation"
type="java.lang.String"
column="JOURFACTURATION"
length="2"
/>
<property
name="nomCpteBanque"
type="java.lang.String"
column="NOMCOMPTEBANQUE"
length="32"
/>
<property
name="numeroCpteBanque"
type="java.lang.String"
column="NUMEROCOMPTEBANQ"
length="11"
/>
<property
name="codeAgence"
type="java.lang.String"
column="CODEAGENCE"
length="5"
/>
<property
name="typeCompte"
type="java.lang.String"
column="TYPECOMPTE"
length="2"
/>
<property
name="codeBanque"
type="java.lang.String"
column="CODEBANQUE"
length="5"
/>
<property
name="codePaysBanque"
type="java.lang.String"
column="CODEPAYSBANQUE"
length="5"
/>
<property
name="dateFinEngagement"
type="date"
column="DATEFINENGAGEMENT"
length="7"
/>
<!-- Associations -->
<many-to-one
name="sortieGreco"
column="SORTIEGRECO"
class="com.orange.greco.persistance.dao.references.bean.SortieGrecoTO"
cascade="none"
>
<column name="CODEREF" />
</many-to-one>
<many-to-one
name="qualitepayeur"
column="QUALITEPAYEUR"
class="com.orange.greco.persistance.dao.references.bean.QualitePayeurTO"
cascade="none"
>
<column name="CODEREF" />
</many-to-one>
<many-to-one
name="typeclient"
column="TYPECLIENT"
class="com.orange.greco.persistance.dao.references.bean.TypeClientTO"
cascade="none"
>
<column name="CODEREF" />
</many-to-one>
<many-to-one
name="familleRejet"
column="FAMILLEREJET"
class="com.orange.greco.persistance.dao.references.bean.FamilleRejetTO"
cascade="none"
>
<column name="CODEREF" />
</many-to-one>
<many-to-one
name="statutdossier"
column="STATUTDOSSIER"
class="com.orange.greco.persistance.dao.references.bean.StatutDossierTO"
cascade="none"
>
<column name="CODEREF" />
</many-to-one>
<!-- bi-directional many-to-one association to USCM -->
<many-to-one
name="uscm"
class="com.orange.greco.persistance.dao.references.bean.UscmTO"
>
<column name="ID_USCM" />
</many-to-one>
<!-- bi-directional many-to-one association to Planrecouv -->
<many-to-one
name="planrecouv"
class="com.orange.greco.persistance.dao.recouvrement.bean.PlanRecouvTO"
not-null="true"
>
<column name="ID_PLAN" />
</many-to-one>
<many-to-one
name="mpModepaiement"
column="MP_MODEPAIEMENT"
class="com.orange.greco.persistance.dao.references.bean.ModePaiementTO"
cascade="none"
>
<column name="CODEREF" />
</many-to-one>
<!-- bi-directional one-to-many association to Dossier -->
<set
name="dossiers"
lazy="true"
inverse="true"
cascade="all"
>
<key>
<column name="ID_CLIENT" />
</key>
<one-to-many
class="com.orange.greco.persistance.dao.client.bean.DossierTO"
/>
</set>
<!-- bi-directional one-to-many association to EvenementAdv -->
<set
name="evenementAdvs"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="ID_CLIENT" />
</key>
<one-to-many
class="com.orange.greco.persistance.dao.fiche.bean.EvenementAdvTO"
/>
</set>
<!-- bi-directional one-to-many association to Fiche -->
<set
name="fiches"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="ID_CLIENT" />
</key>
<one-to-many
class="com.orange.greco.persistance.dao.fiche.bean.FicheTO"
/>
</set>
<!-- bi-directional many-to-one association to Rejet -->
<many-to-one
name="rejet"
class="com.orange.greco.persistance.dao.references.bean.RejetTO"
not-null="true"
>
<column name="ID_REJET" />
</many-to-one>
<!-- bi-directional many-to-one association to Plateforme -->
<many-to-one
name="plateforme"
class="com.orange.greco.persistance.dao.references.bean.PlateformeTO"
not-null="true"
>
<column name="ID_PLATEFORME" />
</many-to-one>
<!-- bi-directional many-to-one association to Centreclient -->
<many-to-one
name="centreclient"
class="com.orange.greco.persistance.dao.references.bean.CentreClientTO"
not-null="true"
>
<column name="ID_CENTRE" />
</many-to-one>
<!-- bi-directional many-to-one association to Segment -->
<many-to-one
name="segment"
class="com.orange.greco.persistance.dao.references.bean.SegmentTO"
not-null="true"
>
<column name="ID_SEGMENT" />
</many-to-one>
</class>
</hibernate-mapping>
Mapping of mouvement :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.1
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="com.orange.greco.persistance.dao.fiche.bean.MouvementTO"
table="MOUVEMENT"
optimistic-lock="version"
>
<composite-id name="comp_id" class="com.orange.greco.persistance.dao.fiche.bean.MouvementPkTO">
<key-many-to-one
name="client"
class="com.orange.greco.persistance.dao.client.bean.ClientFicheTO"
column="ID_CLIENT"
/>
<key-property
name="ref1comptable"
column="REF1COMPTABLE"
type="java.lang.String"
length="10"
/>
<key-property
name="numordre"
column="NUMORDRE"
type="java.lang.Integer"
length="5"
/>
<key-property
name="mouDate"
column="MOU_DATE"
type="java.util.Date"
length="7"
/>
<key-many-to-one
name="codetype"
class="com.orange.greco.persistance.dao.fiche.bean.TypeOpComptableTO"
column="CODETYPE"
/>
</composite-id>
<version
column="TIMESTAMP"
name="timestamp"
type="long"
unsaved-value="null"
/>
<property
name="periodecomptable"
type="java.util.Date"
column="PERIODECOMPTABLE"
not-null="true"
length="7"
/>
<property
name="typeenreg"
type="int"
column="TYPEENREG"
not-null="true"
length="1"
/>
<property
name="codeoperation"
type="java.lang.String"
column="CODEOPERATION"
not-null="true"
length="4"
/>
<property
name="libellelong"
type="java.lang.String"
column="LIBELLELONG"
not-null="true"
length="24"
/>
<property
name="libellecourt"
type="java.lang.String"
column="LIBELLECOURT"
not-null="true"
length="10"
/>
<property
name="ref2comptable"
type="java.lang.String"
column="REF2COMPTABLE"
length="20"
/>
<property
name="mttttc"
type="int"
column="MTTTTC"
not-null="true"
length="9"
/>
<property
name="solde"
type="int"
column="SOLDE"
not-null="true"
length="9"
/>
<property
name="mttregle"
type="int"
column="MTTREGLE"
not-null="true"
length="9"
/>
<property
name="codeReclamation"
type="java.lang.String"
column="CODE_RECLAMATION"
length="1"
/>
<property
name="dateLettrage"
type="java.util.Date"
column="DATE_LETTRAGE"
length="7"
/>
<property
name="mttreglelettrage"
type="java.lang.Integer"
column="MTTREGLELETTRAGE"
length="9"
/>
<property
name="ref1lettrage"
type="java.lang.String"
column="REF1LETTRAGE"
length="10"
/>
<property
name="seq1reflettrage"
type="java.lang.Integer"
column="SEQ1REFLETTRAGE"
length="5"
/>
<property
name="typelettrage"
type="java.lang.Integer"
column="TYPELETTRAGE"
length="4"
/>
<property
name="indOpenonlettre"
type="java.lang.String"
column="IND_OPENONLETTRE"
not-null="true"
length="1"
/>
<property
name="dvMonnaiestck"
type="java.lang.String"
column="DV_MONNAIESTCK"
not-null="true"
length="3"
/>
<property
name="dvMonnaieinit"
type="java.lang.String"
column="DV_MONNAIEINIT"
length="3"
/>
<property
name="daterejet"
type="java.util.Date"
column="DATEREJET"
length="7"
/>
<property
name="numerolot"
type="java.lang.Integer"
column="NUMEROLOT"
length="6"
/>
<property
name="indNvxPaiement"
type="java.lang.String"
column="IND_NVX_PAIEMENT"
not-null="true"
length="1"
/>
<property
name="dateutilisation"
type="java.util.Date"
column="DATEUTILISATION"
length="7"
/>
<property
name="dateDernModif"
type="java.util.Date"
column="DATEDERNMODIF"
length="7"
/>
<property
name="dateDebutMarquage"
type="java.util.Date"
column="DATEDEBUTMARQUAGE"
length="7"
/>
<property
name="dateFinMarquage"
type="java.util.Date"
column="DATEFINMARQUAGE"
length="7"
/>
<!-- Associations -->
<!-- derived association(s) for compound key -->
<!-- bi-directional many-to-one association to Rejet -->
<many-to-one
name="rejet"
class="com.orange.greco.persistance.dao.references.bean.RejetTO"
not-null="true"
cascade="none"
>
<column name="ID_REJET" />
</many-to-one>
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
ARN 2005/07/28 09:21:28 net.sf.hibernate.StaleObjectStateException.<init>(StaleObjectStateException.java:27) - An operation failed due to stale data
net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.orange.greco.persistance.dao.fiche.bean.MouvementTO instance with identifier: com.orange.greco.persistance.dao.fiche.bean.MouvementPkTO@7fab0a[client=com.orange.greco.persistance.dao.client.bean.ClientFicheTO@6b152b[idClient=27668],ref1comptable=120,numordre=120,mouDate=Thu Aug 04 09:20:46 CEST 2005,codetype=com.orange.greco.persistance.dao.fiche.bean.TypeOpComptableTO@40f3c1[codeType=0101]]
at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:501)
at net.sf.hibernate.persister.EntityPersister.delete(EntityPersister.java:596)
at net.sf.hibernate.impl.ScheduledDeletion.execute(ScheduledDeletion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2414)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2372)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1807)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1567)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.orange.greco.persistance.dao.client.impl.ClientFicheDAOImpl.select(ClientFicheDAOImpl.java:444)
at java.lang.reflect.Method.invoke(Native Method)
at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:116)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152)
at $Proxy36.select(Unknown Source)
at com.orange.greco.persistance.dao.client.ClientFicheDAOTest$3.doInTransactionWithoutResult(ClientFicheDAOTest.java:653)
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114)
at com.orange.greco.persistance.dao.client.ClientFicheDAOTest.testSingleDelete(ClientFicheDAOTest.java:635)
at java.lang.reflect.Method.invoke(Native Method)
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 junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
ERROR 2005/07/28 09:21:28 net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2375) - Could not synchronize database state with session
net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.orange.greco.persistance.dao.fiche.bean.MouvementTO instance with identifier: com.orange.greco.persistance.dao.fiche.bean.MouvementPkTO@7fab0a[client=com.orange.greco.persistance.dao.client.bean.ClientFicheTO@6b152b[idClient=27668],ref1comptable=120,numordre=120,mouDate=Thu Aug 04 09:20:46 CEST 2005,codetype=com.orange.greco.persistance.dao.fiche.bean.TypeOpComptableTO@40f3c1[codeType=0101]]
at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:501)
at net.sf.hibernate.persister.EntityPersister.delete(EntityPersister.java:596)
at net.sf.hibernate.impl.ScheduledDeletion.execute(ScheduledDeletion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2414)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2372)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1807)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1567)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.orange.greco.persistance.dao.client.impl.ClientFicheDAOImpl.select(ClientFicheDAOImpl.java:444)
at java.lang.reflect.Method.invoke(Native Method)
at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:116)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152)
at $Proxy36.select(Unknown Source)
at com.orange.greco.persistance.dao.client.ClientFicheDAOTest$3.doInTransactionWithoutResult(ClientFicheDAOTest.java:653)
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114)
at com.orange.greco.persistance.dao.client.ClientFicheDAOTest.testSingleDelete(ClientFicheDAOTest.java:635)
at java.lang.reflect.Method.invoke(Native Method)
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 junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
ERROR 2005/07/28 09:21:28 com.orange.greco.persistance.dao.client.impl.ClientFicheDAOImpl.select(ClientFicheDAOImpl.java:459) - net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.orange.greco.persistance.dao.fiche.bean.MouvementTO instance with identifier: com.orange.greco.persistance.dao.fiche.bean.MouvementPkTO@7fab0a[client=com.orange.greco.persistance.dao.client.bean.ClientFicheTO@6b152b[idClient=27668],ref1comptable=120,numordre=120,mouDate=Thu Aug 04 09:20:46 CEST 2005,codetype=com.orange.greco.persistance.dao.fiche.bean.TypeOpComptableTO@40f3c1[codeType=0101]]
at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:501)
at net.sf.hibernate.persister.EntityPersister.delete(EntityPersister.java:596)
at net.sf.hibernate.impl.ScheduledDeletion.execute(ScheduledDeletion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2414)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2372)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1807)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1567)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at com.orange.greco.persistance.dao.client.impl.ClientFicheDAOImpl.select(ClientFicheDAOImpl.java:444)
at java.lang.reflect.Method.invoke(Native Method)
at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:116)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152)
at $Proxy36.select(Unknown Source)
at com.orange.greco.persistance.dao.client.ClientFicheDAOTest$3.doInTransactionWithoutResult(ClientFicheDAOTest.java:653)
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114)
at com.orange.greco.persistance.dao.client.ClientFicheDAOTest.testSingleDelete(ClientFicheDAOTest.java:635)
at java.lang.reflect.Method.invoke(Native Method)
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 junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
WARN 2005/07/28 09:21:35 net.sf.hibernate.StaleObjectStateException.<init>(StaleObjectStateException.java:27) - An operation failed due to stale data
net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.orange.greco.persistance.dao.fiche.bean.MouvementTO instance with identifier: com.orange.greco.persistance.dao.fiche.bean.MouvementPkTO@7fab0a[client=com.orange.greco.persistance.dao.client.bean.ClientFicheTO@6b152b[idClient=27668],ref1comptable=120,numordre=120,mouDate=Thu Aug 04 09:20:46 CEST 2005,codetype=com.orange.greco.persistance.dao.fiche.bean.TypeOpComptableTO@40f3c1[codeType=0101]]
at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:501)
at net.sf.hibernate.persister.EntityPersister.delete(EntityPersister.java:596)
at net.sf.hibernate.impl.ScheduledDeletion.execute(ScheduledDeletion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2414)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2372)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at com.orange.greco.util.Utils.unbindSession(Utils.java:145)
at com.orange.greco.GrecoTestCase.tearDown(GrecoTestCase.java:49)
at junit.framework.TestCase.runBare(TestCase.java:130)
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 junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
ERROR 2005/07/28 09:21:35 net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2375) - Could not synchronize database state with session
net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.orange.greco.persistance.dao.fiche.bean.MouvementTO instance with identifier: com.orange.greco.persistance.dao.fiche.bean.MouvementPkTO@7fab0a[client=com.orange.greco.persistance.dao.client.bean.ClientFicheTO@6b152b[idClient=27668],ref1comptable=120,numordre=120,mouDate=Thu Aug 04 09:20:46 CEST 2005,codetype=com.orange.greco.persistance.dao.fiche.bean.TypeOpComptableTO@40f3c1[codeType=0101]]
at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:501)
at net.sf.hibernate.persister.EntityPersister.delete(EntityPersister.java:596)
at net.sf.hibernate.impl.ScheduledDeletion.execute(ScheduledDeletion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2414)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2372)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at com.orange.greco.util.Utils.unbindSession(Utils.java:145)
at com.orange.greco.GrecoTestCase.tearDown(GrecoTestCase.java:49)
at junit.framework.TestCase.runBare(TestCase.java:130)
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 junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
Name and version of the database you are using:
Oracle 9.2.04
[b] code Executed [b]
[code]
public class ClientFicheDAOTest extends BasicDAOTest {
public static final String sIdent = " $Revision: 1.0 $";
private static ClientFicheTO s_ClientFiche;
private static MouvementTO mouvement1;
private static MouvementTO mouvement2;
/**
* Build test object.
*
* @param void
* @return Object
*/
public Object buildTestObject() throws DAOException {
ApplicationManager applicationManager=ApplicationManager.getInstance();
ConfigurationManager configurationManager=applicationManager.getConfigurationManager();
CentreClientDAO centreClientDaoService = (CentreClientDAO)configurationManager.getBean(ConstantsAppli.CENTRECLIENT_DAOSERVICE);
PlanRecouvDAO planRecouvDaoService = (PlanRecouvDAO)configurationManager.getBean(ConstantsAppli.PLANRECOUV_DAOSERVICE);
PlateformeDAO plateformeDaoService = (PlateformeDAO)configurationManager.getBean(ConstantsAppli.PLATEFORME_DAOSERVICE);
RejetDAO rejetDaoService = (RejetDAO)configurationManager.getBean(ConstantsAppli.REJET_DAOSERVICE);
SegmentDAO segmentDaoService = (SegmentDAO)configurationManager.getBean(ConstantsAppli.SEGMENT_DAOSERVICE);
TableRefDAO tableRefDaoService = (TableRefDAO)configurationManager.getBean(ConstantsAppli.TABLEREF_DAOSERVICE);
UscmDAO uscmDaoService = (UscmDAO)configurationManager.getBean(ConstantsAppli.USCM_DAOSERVICE);
TypeClientDAO typeClientDaoService = (TypeClientDAO)configurationManager.getBean(ConstantsAppli.TYPECLIENT_DAOSERVICE);
SortieGrecoDAO sortieGrecoDaoService = (SortieGrecoDAO)configurationManager.getBean(ConstantsAppli.SORTIEGRECO_DAOSERVICE);
StatutDossierDAO statutDossierDaoService = (StatutDossierDAO)configurationManager.getBean(ConstantsAppli.STATUTDOSSIER_DAOSERVICE);
QualitePayeurDAO qualitePayeurDaoService = (QualitePayeurDAO)configurationManager.getBean(ConstantsAppli.QUALITEPAYEUR_DAOSERVICE);
FamilleRejetDAO familleRejetDaoService = (FamilleRejetDAO)configurationManager.getBean(ConstantsAppli.FAMILLEREJET_DAOSERVICE);
ClientFicheTO clientFiche = new ClientFicheTO();
Date date = new Date();
clientFiche.setAdr1("new_adr1");
clientFiche.setAdr2("new_adr2");
clientFiche.setAdr3("new_adr3");
clientFiche.setAdr4("new_adr4");
clientFiche.setAdr1Subst("new_adr1S");
clientFiche.setAdr2Subst("new_adr2S");
clientFiche.setAdr3Subst("new_adr3S");
clientFiche.setAdr4Subst("new_adr4S");
clientFiche.setCivilite("new_civ");
clientFiche.setCiviliteSubst("new_ciS");
clientFiche.setCodeinsee(new Integer(123));
clientFiche.setCodeinseeSubst(new Integer(333));
clientFiche.setCp(new Integer(1));
clientFiche.setCpSubst(new Integer(2));
clientFiche.setDatedernmodif(date);
clientFiche.setDateprochainrecouvr(date);
clientFiche.setDaterejet(date);
clientFiche.setEtat("n");
clientFiche.setIndContentieux(ClientFicheTO.IND_CONTENTIEUX_OUI);
clientFiche.setIndNvxpaiement(ClientFicheTO.IND_NVXPAIEMENT_OUI);
clientFiche.setIndRecouvrement(ClientFicheTO.IND_RECOUVREMENT_OUI);
clientFiche.setLocalite("new_loc");
clientFiche.setLocaliteSubst("new_locS");
clientFiche.setNumeroSiret("123");
ModePaiementTO lookupModePaiement = new ModePaiementTO();
lookupModePaiement.setCodeRef(TableRefTO.TABLEREF_MODEPAIEMENT_AUTORISE_AMEX);
ModePaiementTO selectedModePaiement = (ModePaiementTO) tableRefDaoService.select(lookupModePaiement).get(0);
clientFiche.setMpModepaiement(selectedModePaiement);
clientFiche.setMttrecouvrement(new Integer(5));
clientFiche.setMttrecouvrementinit(new Integer(1));
clientFiche.setNom("NEWNOM");
clientFiche.setNomSubst("new_nomS");
clientFiche.setNumeroclient(new Long(43));
clientFiche.setPays("new_pays");
clientFiche.setPaysSubst("new_paysS");
clientFiche.setSolde(new Integer(100));
clientFiche.setSrStatutrecouv(ClientFicheTO.SR_STATUTRECOUV_EN_COURS);
clientFiche.setTelfixe(new Long(0654545));
clientFiche.setTelfixeSubst(new Long(0551212));
StatutDossierTO lookupStatutDossier = new StatutDossierTO();
lookupStatutDossier.setCodeRef(TableRefTO.TABLEREF_STATUT_DOSSIER_CLOS);
StatutDossierTO selectedStatutDossier = (StatutDossierTO) statutDossierDaoService.select(lookupStatutDossier).get(0);
clientFiche.setStatutdossier(selectedStatutDossier);
QualitePayeurTO lookupQualitePayeur = new QualitePayeurTO();
lookupQualitePayeur.setCodeRef(TableRefTO.TABLEREF_QUALITEPAYEUR_BON);
QualitePayeurTO selectedQualitePayeur = (QualitePayeurTO) qualitePayeurDaoService.select(lookupQualitePayeur).get(0);
clientFiche.setQualitepayeur(selectedQualitePayeur);
SortieGrecoTO lookupSortieGreco = new SortieGrecoTO();
lookupSortieGreco.setCodeRef(TableRefTO.TABLEREF_SORTIEGRECO_SORTIE_CONTENTIEUX);
SortieGrecoTO selectedSortieGreco = (SortieGrecoTO) sortieGrecoDaoService.select(lookupSortieGreco).get(0);
clientFiche.setSortieGreco(selectedSortieGreco);
TypeClientTO lookupTypeClient = new TypeClientTO();
lookupTypeClient.setCodeRef("CHC");
TypeClientTO selectedTypeClient = (TypeClientTO) typeClientDaoService.select(lookupTypeClient).get(0);
clientFiche.setTypeclient(selectedTypeClient);
FamilleRejetTO lookupFamilleRejet = new FamilleRejetTO();
lookupFamilleRejet.setCodeRef(TableRefTO.TABLEREF_FAMILLEREJET_REJET_TECHNIQUE);
FamilleRejetTO selectedFamilleRejet = (FamilleRejetTO) familleRejetDaoService.select(lookupFamilleRejet).get(0);
clientFiche.setFamilleRejet(selectedFamilleRejet);
CentreClientTO lookupCentreClient = new CentreClientTO();
lookupCentreClient.setIdCentre(CentreClientDAOTest.ID_CENTRECLIENT_LYON);
CentreClientTO selectedCentreClient = (CentreClientTO) centreClientDaoService.select(lookupCentreClient).get(0);
clientFiche.setCentreclient(selectedCentreClient);
RejetTO lookupRejet = new RejetTO();
lookupRejet.setIdRejet(new Integer(200));
RejetTO selectedRejet = (RejetTO) rejetDaoService.select(lookupRejet).get(0);
clientFiche.setRejet(selectedRejet);
PlanRecouvTO lookupPlanRecouv = new PlanRecouvTO();
lookupPlanRecouv.setIdPlan(new Integer(304));
PlanRecouvTO selectedPlanRecouv = (PlanRecouvTO) planRecouvDaoService.select(lookupPlanRecouv).get(0);
clientFiche.setPlanrecouv(selectedPlanRecouv);
PlateformeTO lookupPlateforme = new PlateformeTO();
lookupPlateforme.setIdPlateforme(new Integer(1));
PlateformeTO selectedPlateforme = (PlateformeTO) plateformeDaoService.select(lookupPlateforme).get(0);
clientFiche.setPlateforme(selectedPlateforme);
SegmentTO lookupSegment = new SegmentTO();
lookupSegment.setIdSegment(SegmentDAOTest.ID_SEGMENT_COMPTE_MOBILE);
SegmentTO selectedSegment = (SegmentTO) segmentDaoService.select(lookupSegment).get(0);
clientFiche.setSegment(selectedSegment);
UscmTO lookupUscm = new UscmTO();
lookupUscm.setIdUscm("TPL1");
UscmTO selectedUscm = (UscmTO) uscmDaoService.select(lookupUscm).get(0);
clientFiche.setUscm(selectedUscm);
clientFiche.setJourFacturation("01");
clientFiche.setNomCpteBanque("TEST_NOM_COMPTE");
clientFiche.setNumeroCpteBanque("xxxxxxxxxxx");
clientFiche.setCodeAgence("00000");
clientFiche.setTypeCompte("xx");
clientFiche.setCodeBanque("xxxxx");
clientFiche.setCodePaysBanque("xxxxx");
clientFiche.setDateFinEngagement(date);
return clientFiche;
}
/**
* Modify test object.
*
* @param Object
* @return void
*/
public void modifyTestObject(Object object) {
ApplicationManager applicationManager=ApplicationManager.getInstance();
ConfigurationManager configurationManager=applicationManager.getConfigurationManager();
CentreClientDAO centreClientDaoService = (CentreClientDAO)configurationManager.getBean(ConstantsAppli.CENTRECLIENT_DAOSERVICE);
DossierDAO dossierDaoService = (DossierDAO)configurationManager.getBean(ConstantsAppli.DOSSIER_DAOSERVICE);
MouvementDAO mouvementDaoService = (MouvementDAO)configurationManager.getBean(ConstantsAppli.MOUVEMENT_DAOSERVICE);
TypeOpComptableDAO typeOpComptableDaoService = (TypeOpComptableDAO) configurationManager.getBean(ConstantsAppli.TYPEOPCOMPTABLE_DAOSERVICE);
ClientFicheTO clientFiche = (ClientFicheTO)object;
Date date = new Date();
clientFiche.setAdr1("modif_adr1");
clientFiche.setAdr2("modif_adr2");
clientFiche.setAdr3("modif_adr3");
clientFiche.setAdr4("modif_adr4");
clientFiche.setAdr1Subst("modif_adr1S");
clientFiche.setAdr2Subst("modif_adr2S");
clientFiche.setAdr3Subst("modif_adr3S");
clientFiche.setAdr4Subst("modif_adr4S");
clientFiche.setCivilite("mod_c");
clientFiche.setCiviliteSubst("mod_cS");
clientFiche.setCodeinsee(new Integer(444));
clientFiche.setCodeinseeSubst(new Integer(444));
clientFiche.setCp(new Integer(4));
clientFiche.setCpSubst(new Integer(4));
clientFiche.setDatedernmodif(date);
clientFiche.setDateprochainrecouvr(date);
clientFiche.setDaterejet(date);
clientFiche.setEtat("m");
clientFiche.setIndContentieux(ClientFicheTO.IND_CONTENTIEUX_NON);
clientFiche.setIndNvxpaiement(ClientFicheTO.IND_NVXPAIEMENT_NON);
clientFiche.setIndRecouvrement(ClientFicheTO.IND_RECOUVREMENT_NON);
clientFiche.setLocalite("mod_l");
clientFiche.setLocaliteSubst("mod_lS");
clientFiche.setMttrecouvrement(new Integer(4));
clientFiche.setMttrecouvrementinit(new Integer(1));
clientFiche.setNom("MODIFNOM");
clientFiche.setNomSubst("modif_nomS");
clientFiche.setNumeroclient(new Long(43));
clientFiche.setPays("modif_pays");
clientFiche.setPaysSubst("modif_paysS");
clientFiche.setSolde(new Integer(100));
clientFiche.setSrStatutrecouv(ClientFicheTO.SR_STATUTRECOUV_ENTREE);
clientFiche.setTelfixe(new Long(0655555));
clientFiche.setTelfixeSubst(new Long(0555555));
clientFiche.setNumeroSiret("321");
clientFiche.setJourFacturation("02");
clientFiche.setNomCpteBanque("TEST_NOM_COMPTE_MODIF");
clientFiche.setNumeroCpteBanque("yyyyyyyyyyy");
clientFiche.setCodeAgence("11111");
clientFiche.setTypeCompte("yy");
clientFiche.setCodeBanque("yyyyy");
clientFiche.setCodePaysBanque("yyyyy");
clientFiche.setDateFinEngagement(date);
// modification du centreclient lie a la fiche client
CentreClientTO lookupCentreClient = new CentreClientTO();
lookupCentreClient.setIdCentre(CentreClientDAOTest.ID_CENTRECLIENT_PARIS);
CentreClientTO selectedCentreClient = (CentreClientTO) centreClientDaoService.select(lookupCentreClient).get(0);
clientFiche.setCentreclient(selectedCentreClient);
// Creation de deux Dossiers pour l'association ClientFiche <-> Dossier
DossierTO firstDossier = new DossierTO();
DossierPkTO firstDossierPkTO = new DossierPkTO();
firstDossierPkTO.setIdClient(clientFiche.getIdClient());
firstDossierPkTO.setNumdossier(new BigDecimal(777777777));
firstDossier.setComp_id(firstDossierPkTO);
firstDossier.setDatecreation(date);
firstDossier.setDatedernieremodif(date);
firstDossier.setDatefin(date);
firstDossier.setFormuleactuelle("n_f");
firstDossier.setIndIas(DossierTO.IND_IAS_OUI);
firstDossier.setIndIasgreco(DossierTO.IND_IASGRECO_OUI);
firstDossier.setIndIasi(DossierTO.IND_IASI_OUI);
firstDossier.setIndSpr(DossierTO.IND_SPR_OUI);
firstDossier.setIndSuspgreco(DossierTO.IND_SUSPGRECO_OUI);
firstDossier.setIndPlafondrec(DossierTO.IND_PLAFONDREC_OUI);
firstDossier.setMttplafondinit(new Integer(123));
firstDossier.setMttplafondrec(new Integer(333));
firstDossier.setMttseuilalerte(new Integer(1));
firstDossier.setMtttolerancetmp(new Integer(2));
firstDossier.setOffretype("nto");
firstDossier.setPlantarifaire("npt");
firstDossier.setSdStatut(DossierTO.SD_STATUT_CLOS);
firstDossier.setSegmentcom("nsc");
DossierTO secondDossier = new DossierTO();
DossierPkTO secondDossierPkTO = new DossierPkTO();
secondDossierPkTO.setIdClient(clientFiche.getIdClient());
secondDossierPkTO.setNumdossier(new BigDecimal(888888888));
secondDossier.setComp_id(secondDossierPkTO);
secondDossier.setDatecreation(date);
secondDossier.setDatedernieremodif(date);
secondDossier.setDatefin(date);
secondDossier.setFormuleactuelle("n_f");
secondDossier.setIndIas(DossierTO.IND_IAS_OUI);
secondDossier.setIndIasgreco(DossierTO.IND_IASGRECO_OUI);
secondDossier.setIndIasi(DossierTO.IND_IASI_OUI);
secondDossier.setIndSpr(DossierTO.IND_SPR_OUI);
secondDossier.setIndSuspgreco(DossierTO.IND_SUSPGRECO_OUI);
secondDossier.setIndPlafondrec(DossierTO.IND_PLAFONDREC_OUI);
secondDossier.setMttplafondinit(new Integer(123));
secondDossier.setMttplafondrec(new Integer(333));
secondDossier.setMttseuilalerte(new Integer(1));
secondDossier.setMtttolerancetmp(new Integer(2));
secondDossier.setOffretype("nto");
secondDossier.setPlantarifaire("npt");
secondDossier.setSdStatut(DossierTO.SD_STATUT_CLOS);
secondDossier.setSegmentcom("nsc");
// Ajout des dossiers crees a la liste des dossiers du clientFiche.
Set dossierSet = new HashSet();
dossierSet.add(firstDossier);
dossierSet.add(secondDossier);
clientFiche.setDossiers(dossierSet);
// Creation de deux Mouvements pour l'association ClientFiche <-> Mouvement
mouvement1 = new MouvementTO();
mouvement2 = new MouvementTO();
MouvementPkTO mouvementPk = new MouvementPkTO();
MouvementPkTO mouvementPk2 = new MouvementPkTO();
String id = new String("120");
TypeOpComptableTO lookupTypeOpComptable = new TypeOpComptableTO();
lookupTypeOpComptable.setCodeType("0101");
TypeOpComptableTO selectedTypeOpComptable = (TypeOpComptableTO) typeOpComptableDaoService.select(lookupTypeOpComptable).get(0);
mouvementPk.setCodetype(selectedTypeOpComptable);
mouvementPk.setClient(clientFiche);
mouvementPk.setNumordre(new Integer(Integer.parseInt(id)));
mouvementPk.setRef1comptable(id);
mouvementPk2.setCodetype(selectedTypeOpComptable);
mouvementPk2.setClient(clientFiche);
mouvementPk2.setNumordre(new Integer(Integer.parseInt(id)));
mouvementPk2.setRef1comptable(id);
Calendar cDate = Calendar.getInstance();
cDate.add(Calendar.DATE, 7);
mouvementPk.setMouDate(cDate.getTime());
mouvement1.setComp_id(mouvementPk);
mouvement1.setCodeoperation("FACO");
mouvement1.setMttttc(new Integer(4000));
mouvement1.setComp_id(mouvementPk);
cDate = Calendar.getInstance();
cDate.add(Calendar.DATE, 15);
mouvementPk2.setMouDate(cDate.getTime());
mouvement2.setComp_id(mouvementPk2);
mouvement2.setCodeoperation("FACM");
mouvement2.setMttttc(new Integer(6000));
mouvement2.setComp_id(mouvementPk2);
// remplissage des autres champs
mouvement1.setCodeReclamation("r");
mouvement1.setDateLettrage(cDate.getTime());
mouvement1.setDaterejet(cDate.getTime());
mouvement1.setDateutilisation(cDate.getTime());
mouvement1.setDvMonnaieinit(MouvementTO.DV_MONNAIEINIT_FRANC_FRANCAIS);
mouvement1.setDvMonnaiestck(MouvementTO.DV_MONNAIEINIT_FRANC_FRANCAIS);
mouvement1.setIndNvxPaiement(MouvementTO.IND_NVX_PAIEMENT_OUI);
mouvement1.setIndOpenonlettre(MouvementTO.IND_OPENONLETTRE_OUI);
mouvement1.setLibellecourt("lib_cour");
mouvement1.setLibellelong("lib_long");
mouvement1.setMttregle(new Integer(22));
mouvement1.setMttreglelettrage(new Integer(22));
mouvement1.setNumerolot(new Integer(22));
mouvement1.setPeriodecomptable(cDate.getTime());
mouvement1.setRef1lettrage("ref1let");
mouvement1.setRef2comptable("ref2com");
mouvement1.setSeq1reflettrage(new Integer(22));
mouvement1.setSolde(new Integer(222));
mouvement1.setTypeenreg(MouvementTO.TYPEENREG_LETTRAGE);
mouvement1.setTypelettrage(new Integer(222));
mouvement1.setRejet(clientFiche.getRejet());
mouvement2.setCodeReclamation("r");
mouvement2.setDateLettrage(cDate.getTime());
mouvement2.setDaterejet(cDate.getTime());
mouvement2.setDateutilisation(cDate.getTime());
mouvement2.setDvMonnaieinit(MouvementTO.DV_MONNAIEINIT_FRANC_FRANCAIS);
mouvement2.setDvMonnaiestck(MouvementTO.DV_MONNAIEINIT_FRANC_FRANCAIS);
mouvement2.setIndNvxPaiement(MouvementTO.IND_NVX_PAIEMENT_OUI);
mouvement2.setIndOpenonlettre(MouvementTO.IND_OPENONLETTRE_OUI);
mouvement2.setLibellecourt("lib_cour");
mouvement2.setLibellelong("lib_long");
mouvement2.setMttregle(new Integer(22));
mouvement2.setMttreglelettrage(new Integer(22));
mouvement2.setNumerolot(new Integer(22));
mouvement2.setPeriodecomptable(cDate.getTime());
mouvement2.setRef1lettrage("ref1let");
mouvement2.setRef2comptable("ref2com");
mouvement2.setSeq1reflettrage(new Integer(22));
mouvement2.setSolde(new Integer(222));
mouvement2.setTypeenreg(MouvementTO.TYPEENREG_LETTRAGE);
mouvement2.setTypelettrage(new Integer(222));
mouvement2.setRejet(clientFiche.getRejet());
// sauvegarde
mouvementDaoService.save(mouvement1);
mouvementDaoService.save(mouvement2);
}
/**
* Suppression des deux mouvements créés lors du modifyTestObject.
*
* @return void
*/
public void suppressionMouvements() {
ApplicationManager applicationManager=ApplicationManager.getInstance();
ConfigurationManager configurationManager=applicationManager.getConfigurationManager();
MouvementDAO mouvementDaoService = (MouvementDAO)configurationManager.getBean(ConstantsAppli.MOUVEMENT_DAOSERVICE);
mouvementDaoService.delete(mouvement1);
mouvementDaoService.delete(mouvement2);
}
/**
* Get first non allocated Id for current tested classe.
*
* @param void
* @return Object
*/
public Object getFirstNonAllocatedId() throws DAOException {
return null;
}
/**
* Single save Test Case.
*
* @param void
* @return void
* @throws DAOException
*/
public void testSingleSave() throws DAOException {
PlatformTransactionManager ptm = new HibernateTransactionManager(sessionFactory);
TransactionTemplate tt = new TransactionTemplate(ptm);
tt.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
ApplicationManager applicationManager=ApplicationManager.getInstance();
ConfigurationManager configurationManager=applicationManager.getConfigurationManager();
ClientFicheDAO daoService = (ClientFicheDAO)configurationManager.getBean(ConstantsAppli.CLIENTFICHE_DAOSERVICE);
// Save
ClientFicheTO newClientFiche = (ClientFicheTO) buildTestObject();
daoService.save(newClientFiche);
s_ClientFiche = newClientFiche;
// Check
List matchingObjects = daoService.select(s_ClientFiche);
assertTrue(matchingObjects.size() == 1);
ClientFicheTO selectedObject = (ClientFicheTO) matchingObjects.iterator().next();
assertTrue(s_ClientFiche.getIdClient().equals(selectedObject.getIdClient()));
assertTrue(s_ClientFiche.getAdr1().equals(selectedObject.getAdr1()));
assertTrue(s_ClientFiche.getAdr2().equals(selectedObject.getAdr2()));
assertTrue(s_ClientFiche.getAdr3().equals(selectedObject.getAdr3()));
assertTrue(s_ClientFiche.getAdr4().equals(selectedObject.getAdr4()));
assertTrue(s_ClientFiche.getAdr1Subst().equals(selectedObject.getAdr1Subst()));
assertTrue(s_ClientFiche.getAdr2Subst().equals(selectedObject.getAdr2Subst()));
assertTrue(s_ClientFiche.getAdr3Subst().equals(selectedObject.getAdr3Subst()));
assertTrue(s_ClientFiche.getAdr4Subst().equals(selectedObject.getAdr4Subst()));
assertTrue(s_ClientFiche.getCivilite().equals(selectedObject.getCivilite()));
assertTrue(s_ClientFiche.getCiviliteSubst().equals(selectedObject.getCiviliteSubst()));
assertTrue(s_ClientFiche.getCodeinsee().equals(selectedObject.getCodeinsee()));
assertTrue(s_ClientFiche.getCodeinseeSubst().equals(selectedObject.getCodeinseeSubst()));
assertTrue(s_ClientFiche.getCp().equals(selectedObject.getCp()));
assertTrue(s_ClientFiche.getCpSubst().equals(selectedObject.getCpSubst()));
assertTrue(s_ClientFiche.getDatedernmodif().equals(selectedObject.getDatedernmodif()));
assertTrue(s_ClientFiche.getDateprochainrecouvr().equals(selectedObject.getDateprochainrecouvr()));
assertTrue(s_ClientFiche.getDaterejet().equals(selectedObject.getDaterejet()));
assertTrue(s_ClientFiche.getEtat().equals(selectedObject.getEtat()));
assertTrue(s_ClientFiche.getIndContentieux().equals(selectedObject.getIndContentieux()));
assertTrue(s_ClientFiche.getIndNvxpaiement().equals(selectedObject.getIndNvxpaiement()));
assertTrue(s_ClientFiche.getIndRecouvrement().equals(selectedObject.getIndRecouvrement()));
assertTrue(s_ClientFiche.getLocalite().equals(selectedObject.getLocalite()));
assertTrue(s_ClientFiche.getLocaliteSubst().equals(selectedObject.getLocaliteSubst()));
assertTrue(s_ClientFiche.getMpModepaiement().equals(selectedObject.getMpModepaiement()));
assertTrue(s_ClientFiche.getMttrecouvrement().equals(selectedObject.getMttrecouvrement()));
assertTrue(s_ClientFiche.getNom().equals(selectedObject.getNom()));
assertTrue(s_ClientFiche.getNomSubst().equals(selectedObject.getNomSubst()));
assertTrue(s_ClientFiche.getPays().equals(selectedObject.getPays()));
assertTrue(s_ClientFiche.getPaysSubst().equals(selectedObject.getPaysSubst()));
assertTrue(s_ClientFiche.getQualitepayeur().equals(selectedObject.getQualitepayeur()));
assertTrue(s_ClientFiche.getSolde().equals(selectedObject.getSolde()));
assertTrue(s_ClientFiche.getSrStatutrecouv().equals(selectedObject.getSrStatutrecouv()));
assertTrue(s_ClientFiche.getStatutdossier().equals(selectedObject.getStatutdossier()));
assertTrue(s_ClientFiche.getTypeclient().equals(selectedObject.getTypeclient()));
assertTrue(s_ClientFiche.getCentreclient().equals(selectedObject.getCentreclient()));
assertTrue(s_ClientFiche.getPlanrecouv().equals(selectedObject.getPlanrecouv()));
assertTrue(s_ClientFiche.getPlateforme().equals(selectedObject.getPlateforme()));
assertTrue(s_ClientFiche.getRejet().equals(selectedObject.getRejet()));
assertTrue(s_ClientFiche.getSegment().equals(selectedObject.getSegment()));
assertTrue(s_ClientFiche.getUscm().equals(selectedObject.getUscm()));
assertTrue(s_ClientFiche.getSortieGreco().equals(selectedObject.getSortieGreco()));
assertTrue(s_ClientFiche.getNumeroSiret().equals(selectedObject.getNumeroSiret()));
assertTrue(s_ClientFiche.getJourFacturation().equals(selectedObject.getJourFacturation()));
assertTrue(s_ClientFiche.getNomCpteBanque().equals(selectedObject.getNomCpteBanque()));
assertTrue(s_ClientFiche.getNumeroCpteBanque().equals(selectedObject.getNumeroCpteBanque()));
assertTrue(s_ClientFiche.getCodeAgence().equals(selectedObject.getCodeAgence()));
assertTrue(s_ClientFiche.getTypeCompte().equals(selectedObject.getTypeCompte()));
assertTrue(s_ClientFiche.getCodeBanque().equals(selectedObject.getCodeBanque()));
assertTrue(s_ClientFiche.getCodePaysBanque().equals(selectedObject.getCodePaysBanque()));
assertTrue(s_ClientFiche.getDateFinEngagement().equals(selectedObject.getDateFinEngagement()));
}
});
}
/**
* Single update Test Case.
*
* @param void
* @return void
* @throws DAOException
*/
public void testSingleUpdate() throws DAOException {
PlatformTransactionManager ptm = new HibernateTransactionManager(sessionFactory);
TransactionTemplate tt = new TransactionTemplate(ptm);
tt.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
ApplicationManager applicationManager=ApplicationManager.getInstance();
ConfigurationManager configurationManager=applicationManager.getConfigurationManager();
ClientFicheDAO daoService = (ClientFicheDAO)configurationManager.getBean(ConstantsAppli.CLIENTFICHE_DAOSERVICE);
MouvementDAO mouvementDaoService = (MouvementDAO)configurationManager.getBean(ConstantsAppli.MOUVEMENT_DAOSERVICE);
// Update
modifyTestObject(s_ClientFiche);
daoService.update(s_ClientFiche);
// Check
List matchingObjects = daoService.select(s_ClientFiche);
assertTrue(matchingObjects.size() == 1);
ClientFicheTO selectedObject = (ClientFicheTO) matchingObjects.iterator().next();
assertTrue(s_ClientFiche.getIdClient().equals(selectedObject.getIdClient()));
assertTrue(s_ClientFiche.getAdr1().equals(selectedObject.getAdr1()));
assertTrue(s_ClientFiche.getAdr2().equals(selectedObject.getAdr2()));
assertTrue(s_ClientFiche.getAdr3().equals(selectedObject.getAdr3()));
assertTrue(s_ClientFiche.getAdr4().equals(selectedObject.getAdr4()));
assertTrue(s_ClientFiche.getAdr1Subst().equals(selectedObject.getAdr1Subst()));
assertTrue(s_ClientFiche.getAdr2Subst().equals(selectedObject.getAdr2Subst()));
assertTrue(s_ClientFiche.getAdr3Subst().equals(selectedObject.getAdr3Subst()));
assertTrue(s_ClientFiche.getAdr4Subst().equals(selectedObject.getAdr4Subst()));
assertTrue(s_ClientFiche.getCivilite().equals(selectedObject.getCivilite()));
assertTrue(s_ClientFiche.getCiviliteSubst().equals(selectedObject.getCiviliteSubst()));
assertTrue(s_ClientFiche.getCodeinsee().equals(selectedObject.getCodeinsee()));
assertTrue(s_ClientFiche.getCodeinseeSubst().equals(selectedObject.getCodeinseeSubst()));
assertTrue(s_ClientFiche.getCp().equals(selectedObject.getCp()));
assertTrue(s_ClientFiche.getCpSubst().equals(selectedObject.getCpSubst()));
assertTrue(s_ClientFiche.getDatedernmodif().equals(selectedObject.getDatedernmodif()));
assertTrue(s_ClientFiche.getDateprochainrecouvr().equals(selectedObject.getDateprochainrecouvr()));
assertTrue(s_ClientFiche.getDaterejet().equals(selectedObject.getDaterejet()));
assertTrue(s_ClientFiche.getEtat().equals(selectedObject.getEtat()));
assertTrue(s_ClientFiche.getIndContentieux().equals(selectedObject.getIndContentieux()));
assertTrue(s_ClientFiche.getIndNvxpaiement().equals(selectedObject.getIndNvxpaiement()));
assertTrue(s_ClientFiche.getIndRecouvrement().equals(selectedObject.getIndRecouvrement()));
assertTrue(s_ClientFiche.getLocalite().equals(selectedObject.getLocalite()));
assertTrue(s_ClientFiche.getLocaliteSubst().equals(selectedObject.getLocaliteSubst()));
assertTrue(s_ClientFiche.getMpModepaiement().eq