IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Hibernate Java Discussion :

probleme avec le select


Sujet :

Hibernate Java

  1. #1
    Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    67
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 67
    Points : 48
    Points
    48
    Par défaut probleme avec le select
    Bonjour
    J'ai un souci
    Ben voila j'ai une table dont le contenu du fichier.hbm.xml est :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
     
    <?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="com.tva.bo">
    <class name="com.tva.bo.EntrepriseDec" table="entreprise_dec" proxy="com.tva.bo.EntrepriseDec" lazy="true" >
     
    			<id name="identifiant" column="identifiant" type="java.lang.Integer">		
    				<generator class="sequence">
                    	<param name="sequence">seq_entreprise_dec</param>
           			</generator>		
    			</id>
     
                <property name="ninea" column="ninea"/>
    			<property name="date_declaration" column="date_declaration"/>
                <property name="agent_autorise" column="agent_autorise"/>
                <property name="penalite_du" column="penalite_du"/>
                <property name="interet_du" column="interet_du"/>
                <property name="total_du" column="total_du"/>
                <property name="date" column="date"/>
                <property name="noms_complets" column="noms_complets"/>
                <property name="titre" column="titre"/>
                <property name="telephone" column="telephone"/>
     
                <set name="declarations" inverse="true" cascade="all-delete-orphan">
                    <key column="identifiant"/>
                    <one-to-many class="com.tva.bo.Declaration"/>
                  </set>     
     
    			<many-to-one
    	        	name="entreprise" 
    	        	unique="true"
    	            outer-join="true"
    	            insert="false" 
    	            update="false"
    	            lazy="true"
    	            not-found="ignore"
    	        	class="com.tva.bo.Entreprise">
    		        	<column name="ninea"/>
    			</many-to-one>
     
     
     
    </class>
    </hibernate-mapping>
    -------> la classe EntrepriseDec.java:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
     
    package com.tva.bo;
     
    import java.io.Serializable;
    import java.util.Date;
    import java.util.HashSet;
    import java.util.Set;
     
    public class EntrepriseDec implements Serializable {
     
        private int identifiant ;
        private String ninea ;
        private Date date_declaration ;
        private String agent_autorise;
        private double penalite_du ;
        private double interet_du ;
        private double total_du ;
        private Date date;
        private String noms_complets;
        private String titre;
        private String telephone;
     
        private Entreprise entreprise;
        private Set declarations = new HashSet();
        public void addDeclarations(Declaration d)
        {
            d.setEntrepriseDec(this);
            declarations.add(d);
        }
     
     
        public EntrepriseDec()
        {
     
            this.identifiant= 0 ;
            this.ninea="";
            this.date_declaration=new Date();
            this.agent_autorise="";
            this.penalite_du= 0 ;
            this.interet_du = 0 ;
            this.total_du = 0 ;
            this.date=new Date();
            this.noms_complets="";
            this.titre="";
            this.telephone="";
     
            this.entreprise = new Entreprise();
     
     
        }
        /**
         * @return Returns the agent_autorise.
         */
        public String getAgent_autorise() {
            return agent_autorise;
        }
        /**
         * @param agent_autorise The agent_autorise to set.
         */
        public void setAgent_autorise(String agent_autorise) {
            this.agent_autorise = agent_autorise;
        }
        /**
         * @return Returns the date.
         */
        public Date getDate() {
            return date;
        }
        /**
         * @param date The date to set.
         */
        public void setDate(Date date) {
            this.date = date;
        }
        /**
         * @return Returns the date_declaration.
         */
        public Date getDate_declaration() {
            return date_declaration;
        }
        /**
         * @param date_declaration The date_declaration to set.
         */
        public void setDate_declaration(Date date_declaration) {
            this.date_declaration = date_declaration;
        }
        /**
         * @return Returns the entreprise.
         */
        public Entreprise getEntreprise() {
            return entreprise;
        }
        /**
         * @param entreprise The entreprise to set.
         */
        public void setEntreprise(Entreprise entreprise) {
            this.entreprise = entreprise;
        }
     
        /**
         * @return Returns the identifiant.
         */
        public int getIdentifiant() {
            return identifiant;
        }
        /**
         * @param identifiant The identifiant to set.
         */
        public void setIdentifiant(int identifiant) {
            this.identifiant = identifiant;
        }
        /**
         * @return Returns the interet_du.
         */
        public double getInteret_du() {
            return interet_du;
        }
        /**
         * @param interet_du The interet_du to set.
         */
        public void setInteret_du(double interet_du) {
            this.interet_du = interet_du;
        }
        /**
         * @return Returns the ninea.
         */
        public String getNinea() {
            return ninea;
        }
        /**
         * @param ninea The ninea to set.
         */
        public void setNinea(String ninea) {
            this.ninea = ninea;
        }
        /**
         * @return Returns the noms_complets.
         */
        public String getNoms_complets() {
            return noms_complets;
        }
        /**
         * @param noms_complets The noms_complets to set.
         */
        public void setNoms_complets(String noms_complets) {
            this.noms_complets = noms_complets;
        }
        /**
         * @return Returns the penalite_du.
         */
        public double getPenalite_du() {
            return penalite_du;
        }
        /**
         * @param penalite_du The penalite_du to set.
         */
        public void setPenalite_du(double penalite_du) {
            this.penalite_du = penalite_du;
        }
        /**
         * @return Returns the telephone.
         */
        public String getTelephone() {
            return telephone;
        }
        /**
         * @param telephone The telephone to set.
         */
        public void setTelephone(String telephone) {
            this.telephone = telephone;
        }
        /**
         * @return Returns the titre.
         */
        public String getTitre() {
            return titre;
        }
        /**
         * @param titre The titre to set.
         */
        public void setTitre(String titre) {
            this.titre = titre;
        }
        /**
         * @return Returns the total_du.
         */
        public double getTotal_du() {
            return total_du;
        }
        /**
         * @param total_du The total_du to set.
         */
        public void setTotal_du(double total_du) {
            this.total_du = total_du;
        }
     
     
     
        /**
         * @return Returns the declarations.
         */
        public Set getDeclarations() {
            return declarations;
        }
        /**
         * @param declarations The declarations to set.
         */
        public void setDeclarations(Set declarations) {
            this.declarations = declarations;
        }
    }
    ma methode qui me permet de faire un select dans le dao:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
     
    public int getIdMaxEntrepriseDec() {
    	    logger.info("Entree dans la  methode getIdMaxEntrepriseDec la classe DeclarationDao");
    	    Session session = this.getSessionFactory().openSession();
    	    //Declaration declaration= new Declaration();
    	    List list =new ArrayList();
    	    String resultat="";
    	    Integer valeur = new Integer(0);
    	    try{
    	        Transaction tx = session.beginTransaction();
    	        //valeur = (Integer)session.createSQLQuery(" select max(entrepriseDec.identifiant)as max from EntrepriseDec entrepriseDec ").addScalar("max",Hibernate.INTEGER ).uniqueResult();
     
    	        list=session.createSQLQuery(" select max(entrepriseDec.identifiant)as max from EntrepriseDec entrepriseDec ").addScalar("max",Hibernate.INTEGER).list();
     
    	        if (list != null && list.size() > 0) 
    	          {
    	           if (list.get(0) != null) 
    	             {
    	               valeur =  (Integer) list.get(0);
    	             }
    	           }
     
    	        tx.commit();
    	    }catch (Exception e){
    	        e.printStackTrace();
    	        logger.error("Erreur lors de la recuperation du max de l'identifiant");
    	    }finally{
    	        session.close();
    	    }
    	    return (valeur.intValue()) ; 
    	}
    et le probleme que j'ai
    Lorsque je fais une insertion ça marche
    mais lorsque je veux faire un select ça me donne un message d'erreur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
     
    Hibernate:  select max(entrepriseDec.identifiant)as max from EntrepriseDec entrepriseDec 
     WARN : JDBCExceptionReporter.java          -> SQL Error: 0, SQLState: 42P01
    ERROR : JDBCExceptionReporter.java          -> ERROR: relation "entreprisedec" does not exist
    org.hibernate.exception.SQLGrammarException: could not execute query
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    	at org.hibernate.loader.Loader.doList(Loader.java:1596)
    	at org.hibernate.loader.Loader.list(Loader.java:1577)
    	at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:112)
    	at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1414)
    	at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:153)
    	at com.tva.dao.imp.EntrepriseDecDao.getIdMaxEntrepriseDec(EntrepriseDecDao.java:147)
    	at com.tva.manager.imp.EntrepriseDecMg.getIdMaxEntrepriseDec(EntrepriseDecMg.java:68)
    	at com.tva.struts.action.declaration.EnregistrerDeclarationAction.executeAction(EnregistrerDeclarationAction.java:254)
    	at com.tva.struts.action.ActionBase.execute(ActionBase.java:155)
    	at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
    	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 com.tva.struts.servlets.ServletBase.doPost(ServletBase.java:38)
    	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:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Thread.java:595)
    Caused by: java.sql.SQLException: ERROR: relation "entreprisedec" does not exist
    	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1501)
    	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1283)
    	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:186)
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:392)
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:240)
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
    	at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
    	at org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
    	at org.hibernate.loader.Loader.doQuery(Loader.java:391)
    	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
    	at org.hibernate.loader.Loader.doList(Loader.java:1593)
    	... 30 more

    QUELQU'UN PEUT M'AIDER SVP je suis bloquée la dessus ?

  2. #2
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 313
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Points : 9 529
    Points
    9 529
    Billets dans le blog
    1
    Par défaut
    Là comme ça, je ne vois pas d'où provient "entreprisedec"...

    Peux-tu positionner l'attribut hibernate.show_sql à true dans le fichier hibernate.cfg.xml et montrer la requête générée ?

    A+

  3. #3
    Expert confirmé
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 274
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 274
    Points : 4 141
    Points
    4 141
    Par défaut
    Si tu utilises une SQLQuery, tu dois spécifier des noms de tables, dans tes requêtes.
    Si tu utilises une Query (hql), tu dois spécifier des noms de classes.
    En tout cas, tu ne dois pas faire un mix des deux comme tu as fait.

  4. #4
    Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    67
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 67
    Points : 48
    Points
    48
    Par défaut
    merci de me répondre aussi tôt

    Voici mon fichier hibernate.cfg.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
     
    <hibernate-configuration>
     
    <session-factory>
     
    	<!-- properties 	-->
     
    	<property name="connection.username">postgres</property>
    	<property name="connection.url">jdbc:postgresql://localhost:5432/fiscR</property>
    	<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
    	<property name="connection.password">postgres</property>
    	<property name="connection.driver_class">org.postgresql.Driver</property>
    	<property name="show_sql">true</property>
     
     
    	<property name="use_reflection_optimizer">false</property>
    	<property name="cglib.use_reflection_optimizer">false</property>
     
     
    	<!-- mapping files -->
    	<mapping resource="hibernate/ressources/Entreprise.hbm.xml" />	
        <mapping resource="hibernate/ressources/Declaration.hbm.xml" />
        <mapping resource="hibernate/ressources/EntrepriseDec.hbm.xml" />
    </session-factory>
     
    </hibernate-configuration>

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    383
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2007
    Messages : 383
    Points : 468
    Points
    468
    Par défaut
    Pourquoi tu fais un list() maintenant au lieu d'un uniqueResult() comme dans la ligne qui est commentée ?
    Le max va te retourner une seule valeur non ?

  6. #6
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 313
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Points : 9 529
    Points
    9 529
    Billets dans le blog
    1
    Par défaut
    Citation Envoyé par fr1man Voir le message
    Si tu utilises une SQLQuery, tu dois spécifier des noms de tables, dans tes requêtes.
    Si tu utilises une Query (hql), tu dois spécifier des noms de classes.
    En tout cas, tu ne dois pas faire un mix des deux comme tu as fait.
    Bien vu

  7. #7
    Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    67
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 67
    Points : 48
    Points
    48
    Par défaut
    Citation Envoyé par slevy Voir le message
    Pourquoi tu fais un list() maintenant au lieu d'un uniqueResult() comme dans la ligne qui est commentée ?
    Le max va te retourner une seule valeur non ?
    ah oui en fait tout au debut c'est ce que je fesais , mais avec l'erreur comme je ne sais d'ou vien l'erreur alors j'ai essayé de commenter la ligne et la remplacer par une autre : histoire de resoudre par elimination
    je ne suis pas tres douée en hibernate ,

  8. #8
    Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    67
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 67
    Points : 48
    Points
    48
    Par défaut
    Citation Envoyé par fr1man Voir le message
    Si tu utilises une SQLQuery, tu dois spécifier des noms de tables, dans tes requêtes.
    Si tu utilises une Query (hql), tu dois spécifier des noms de classes.
    En tout cas, tu ne dois pas faire un mix des deux comme tu as fait.
    c comme je disais tout a l'heure je ne suis pas trop douée en hibernate
    en fait je ne pensais pas melanger est ce que vous pouvez m'aider a rendre le code totalement en hql svp ?

  9. #9
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 313
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Points : 9 529
    Points
    9 529
    Billets dans le blog
    1
    Par défaut
    Essaye
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     list = session.createQuery(" select max(entrepriseDec.identifiant)as max from EntrepriseDec entrepriseDec ").list()
    

  10. #10
    Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    67
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 67
    Points : 48
    Points
    48
    Par défaut
    Citation Envoyé par OButterlin Voir le message
    Essaye
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     list = session.createQuery(" select max(entrepriseDec.identifiant)as max from EntrepriseDec entrepriseDec ").list()
    
    ouf je vous remercie bcp ça marche la requete !
    mais j'ai un autre souci en fait l'erreur a évolué
    je devais recuperer cette valeur pour ensuite enregistrer dans la table declaration comme vous avez remarqué dans le fichier .hbm.xml la table entrepriseDec est en relation avec la table declaration
    mais j'ai un message d'erreur lorsque j'essaye d'enregistrer la declaration
    voici son le contenu du fichier declaration.hbm.xml :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
     
    <?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="com.tva.bo">
    <class name="com.tva.bo.Declaration" table="declaration" proxy="com.tva.bo.Declaration" lazy="true" >
     
    			<id name="id_declaration" column="id_declaration" type="java.lang.Integer">		
    				<generator class="sequence">
                    	<param name="sequence">seq_declaration</param>
           			</generator>		
    			</id>
     
    			<property name="ninea" column="ninea"/>
                <property name="idUser" column="id_user"/>
                <property name="identifiant" column="identifiant"/>
    			<property name="num_fact" column="num_fact"/>
    			<property name="date_declaration" column="date_declaration"/>
    			<property name="date_imposition" column="date_imposition"/>
    			<property name="date_cotisation_deb" column="date_cotisation_deb"/>
    			<property name="date_cotisation_fin" column="date_cotisation_fin"/>
    			<property name="date_exig_depot" column="date_exig_depot"/>
                <property name="date_exig_paiement" column="date_exig_paiement"/>
                <property name="type_impot" column="type_impot"/>
                <property name="val_tbsd_mois" column="val_tbsd_mois"/>
                <property name="vente_exo" column="vente_exo"/>
                <property name="vente_taxe_o" column="vente_taxe_o"/>
                <property name="exportation" column="exportation"/>
                <property name="total_vente_nt" column="total_vente_nt"/>
                <property name="total_vente_tax" column="total_vente_tax"/>
                <property name="tva_vente_tax" column="tva_vente_tax"/>
                <property name="tva_importation" column="tva_importation"/>
                <property name="tva_achat_locaux" column="tva_achat_locaux"/>
                <property name="tva_paye" column="tva_paye"/>
                <property name="tva_net_due_credit_r" column="tva_net_due_credit_r"/>
                <property name="credit_reporte_ma" column="credit_reporte_ma"/>
                <property name="tva_ret_srce_minecofin" column="tva_ret_srce_minecofin"/>
                <property name="total_tva_du_credit_p" column="total_tva_du_credit_p"/>
                <property name="tva_r" column="tva_r"/>
                <property name="tva_due" column="tva_due"/>
     
     
    			<many-to-one
    	        	name="entreprise" 
    	        	unique="true"
    	            outer-join="true"
    	            insert="false" 
    	            update="false"
    	            lazy="true"
    	            not-found="ignore"
    	        	class="com.tva.bo.Entreprise">
    		        	<column name="ninea"/>
    			</many-to-one>	
     
               <many-to-one
    	        	name="utilisateur"
                    insert="false" 
    	            update="false"
    	        	class="com.tva.bo.Utilisateur">
    		        	<column name="id_user" not-null="true"/>
    			</many-to-one>	
     
               <many-to-one
    	        	name="entrepriseDec"
                    insert="false" 
    	            update="false"
    	        	class="com.tva.bo.EntrepriseDec">
    		        	<column name="identifiant" not-null="true"/>
    			</many-to-one>	
     
     
    </class>
    </hibernate-mapping>
    la methode dans le dao est :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
     public void saveDeclaration(Declaration declaration, int id_user, int identifiant) 
    	{
    	    logger.info("Entree dans la methode saveDeclaration la classe DeclarationDao");
    	    Session session = this.getSessionFactory().openSession();
    	    try{
     
    	        Transaction tx = session.beginTransaction();
    	        Utilisateur utilisateur =(Utilisateur)session.load(Utilisateur.class, new Integer(id_user));
    	        EntrepriseDec entrepriseDec =(EntrepriseDec)session.load(EntrepriseDec.class, new Integer(identifiant));
    	        utilisateur.addDeclarations(declaration);
    	        entrepriseDec.addDeclarations(declaration);
    	        session.save(declaration);
    	        session.flush();
    	        tx.commit();
    	    }catch (Exception e){
    	        e.printStackTrace();
    	        logger.error("Erreur lors de la sauvegarde d'une declaration");
    	    }finally{
    	        session.close();
    	    }
     
    	}
    voici le message d'erreur apres insertion

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
     
     
    Hibernate: select utilisateu0_.id_user as id1_0_, utilisateu0_.nom as nom18_0_, utilisateu0_.prenom as prenom18_0_, utilisateu0_.login as login18_0_, utilisateu0_.mdp as mdp18_0_ from utilisateur utilisateu0_ where utilisateu0_.id_user=?
    Hibernate: select declaratio0_.id_user as id3_2_, declaratio0_.id_declaration as id1_2_, declaratio0_.id_declaration as id1_1_, declaratio0_.ninea as ninea12_1_, declaratio0_.id_user as id3_12_1_, declaratio0_.identifiant as identifi4_12_1_, declaratio0_.num_fact as num5_12_1_, declaratio0_.date_declaration as date6_12_1_, declaratio0_.date_imposition as date7_12_1_, declaratio0_.date_cotisation_deb as date8_12_1_, declaratio0_.date_cotisation_fin as date9_12_1_, declaratio0_.date_exig_depot as date10_12_1_, declaratio0_.date_exig_paiement as date11_12_1_, declaratio0_.type_impot as type12_12_1_, declaratio0_.val_tbsd_mois as val13_12_1_, declaratio0_.vente_exo as vente14_12_1_, declaratio0_.vente_taxe_o as vente15_12_1_, declaratio0_.exportation as exporta16_12_1_, declaratio0_.total_vente_nt as total17_12_1_, declaratio0_.total_vente_tax as total18_12_1_, declaratio0_.tva_vente_tax as tva19_12_1_, declaratio0_.tva_importation as tva20_12_1_, declaratio0_.tva_achat_locaux as tva21_12_1_, declaratio0_.tva_paye as tva22_12_1_, declaratio0_.tva_net_due_credit_r as tva23_12_1_, declaratio0_.credit_reporte_ma as credit24_12_1_, declaratio0_.tva_ret_srce_minecofin as tva25_12_1_, declaratio0_.total_tva_du_credit_p as total26_12_1_, declaratio0_.tva_r as tva27_12_1_, declaratio0_.tva_due as tva28_12_1_, entreprise1_.ninea as ninea0_, entreprise1_.nom_entreprise as nom2_1_0_, entreprise1_.sigle as sigle1_0_, entreprise1_.forme as forme1_0_, entreprise1_.compte as compte1_0_, entreprise1_.adresse as adresse1_0_, entreprise1_.rue as rue1_0_, entreprise1_.quartier as quartier1_0_, entreprise1_.localite as localite1_0_, entreprise1_.bp as bp1_0_, entreprise1_.renseigne as renseigne1_0_, entreprise1_.extenso as extenso1_0_, entreprise1_.activite as activite1_0_, entreprise1_.tel as tel1_0_, entreprise1_.num_secu as num15_1_0_, entreprise1_.num_registre as num16_1_0_, entreprise1_.email as email1_0_, entreprise1_.description as descrip18_1_0_, entreprise1_.adresse_stable as adresse19_1_0_, entreprise1_.comptable as comptable1_0_, entreprise1_.bp_comptable as bp21_1_0_, entreprise1_.tel_comptable as tel22_1_0_, entreprise1_.forme_societe as forme23_1_0_, entreprise1_.profession as profession1_0_, entreprise1_.unite_secteur as unite25_1_0_, entreprise1_.centre_fiscal as centre26_1_0_, entreprise1_.centre_perception as centre27_1_0_ from declaration declaratio0_ left outer join entreprise entreprise1_ on declaratio0_.ninea=entreprise1_.ninea where declaratio0_.id_user=?
    Hibernate: select entreprise0_.identifiant as identifi1_1_, entreprise0_.ninea as ninea23_1_, entreprise0_.date_declaration as date3_23_1_, entreprise0_.agent_autorise as agent4_23_1_, entreprise0_.penalite_du as penalite5_23_1_, entreprise0_.interet_du as interet6_23_1_, entreprise0_.total_du as total7_23_1_, entreprise0_.date as date23_1_, entreprise0_.noms_complets as noms9_23_1_, entreprise0_.titre as titre23_1_, entreprise0_.telephone as telephone23_1_, entreprise1_.ninea as ninea0_, entreprise1_.nom_entreprise as nom2_1_0_, entreprise1_.sigle as sigle1_0_, entreprise1_.forme as forme1_0_, entreprise1_.compte as compte1_0_, entreprise1_.adresse as adresse1_0_, entreprise1_.rue as rue1_0_, entreprise1_.quartier as quartier1_0_, entreprise1_.localite as localite1_0_, entreprise1_.bp as bp1_0_, entreprise1_.renseigne as renseigne1_0_, entreprise1_.extenso as extenso1_0_, entreprise1_.activite as activite1_0_, entreprise1_.tel as tel1_0_, entreprise1_.num_secu as num15_1_0_, entreprise1_.num_registre as num16_1_0_, entreprise1_.email as email1_0_, entreprise1_.description as descrip18_1_0_, entreprise1_.adresse_stable as adresse19_1_0_, entreprise1_.comptable as comptable1_0_, entreprise1_.bp_comptable as bp21_1_0_, entreprise1_.tel_comptable as tel22_1_0_, entreprise1_.forme_societe as forme23_1_0_, entreprise1_.profession as profession1_0_, entreprise1_.unite_secteur as unite25_1_0_, entreprise1_.centre_fiscal as centre26_1_0_, entreprise1_.centre_perception as centre27_1_0_ from entreprise_dec entreprise0_ left outer join entreprise entreprise1_ on entreprise0_.ninea=entreprise1_.ninea where entreprise0_.identifiant=?
    Hibernate: select declaratio0_.identifiant as identifi4_2_, declaratio0_.id_declaration as id1_2_, declaratio0_.id_declaration as id1_1_, declaratio0_.ninea as ninea12_1_, declaratio0_.id_user as id3_12_1_, declaratio0_.identifiant as identifi4_12_1_, declaratio0_.num_fact as num5_12_1_, declaratio0_.date_declaration as date6_12_1_, declaratio0_.date_imposition as date7_12_1_, declaratio0_.date_cotisation_deb as date8_12_1_, declaratio0_.date_cotisation_fin as date9_12_1_, declaratio0_.date_exig_depot as date10_12_1_, declaratio0_.date_exig_paiement as date11_12_1_, declaratio0_.type_impot as type12_12_1_, declaratio0_.val_tbsd_mois as val13_12_1_, declaratio0_.vente_exo as vente14_12_1_, declaratio0_.vente_taxe_o as vente15_12_1_, declaratio0_.exportation as exporta16_12_1_, declaratio0_.total_vente_nt as total17_12_1_, declaratio0_.total_vente_tax as total18_12_1_, declaratio0_.tva_vente_tax as tva19_12_1_, declaratio0_.tva_importation as tva20_12_1_, declaratio0_.tva_achat_locaux as tva21_12_1_, declaratio0_.tva_paye as tva22_12_1_, declaratio0_.tva_net_due_credit_r as tva23_12_1_, declaratio0_.credit_reporte_ma as credit24_12_1_, declaratio0_.tva_ret_srce_minecofin as tva25_12_1_, declaratio0_.total_tva_du_credit_p as total26_12_1_, declaratio0_.tva_r as tva27_12_1_, declaratio0_.tva_due as tva28_12_1_, entreprise1_.ninea as ninea0_, entreprise1_.nom_entreprise as nom2_1_0_, entreprise1_.sigle as sigle1_0_, entreprise1_.forme as forme1_0_, entreprise1_.compte as compte1_0_, entreprise1_.adresse as adresse1_0_, entreprise1_.rue as rue1_0_, entreprise1_.quartier as quartier1_0_, entreprise1_.localite as localite1_0_, entreprise1_.bp as bp1_0_, entreprise1_.renseigne as renseigne1_0_, entreprise1_.extenso as extenso1_0_, entreprise1_.activite as activite1_0_, entreprise1_.tel as tel1_0_, entreprise1_.num_secu as num15_1_0_, entreprise1_.num_registre as num16_1_0_, entreprise1_.email as email1_0_, entreprise1_.description as descrip18_1_0_, entreprise1_.adresse_stable as adresse19_1_0_, entreprise1_.comptable as comptable1_0_, entreprise1_.bp_comptable as bp21_1_0_, entreprise1_.tel_comptable as tel22_1_0_, entreprise1_.forme_societe as forme23_1_0_, entreprise1_.profession as profession1_0_, entreprise1_.unite_secteur as unite25_1_0_, entreprise1_.centre_fiscal as centre26_1_0_, entreprise1_.centre_perception as centre27_1_0_ from declaration declaratio0_ left outer join entreprise entreprise1_ on declaratio0_.ninea=entreprise1_.ninea where declaratio0_.identifiant=?
    Hibernate: select nextval ('seq_declaration')
    Hibernate: select entreprise_.ninea, entreprise_.nom_entreprise as nom2_1_, entreprise_.sigle as sigle1_, entreprise_.forme as forme1_, entreprise_.compte as compte1_, entreprise_.adresse as adresse1_, entreprise_.rue as rue1_, entreprise_.quartier as quartier1_, entreprise_.localite as localite1_, entreprise_.bp as bp1_, entreprise_.renseigne as renseigne1_, entreprise_.extenso as extenso1_, entreprise_.activite as activite1_, entreprise_.tel as tel1_, entreprise_.num_secu as num15_1_, entreprise_.num_registre as num16_1_, entreprise_.email as email1_, entreprise_.description as descrip18_1_, entreprise_.adresse_stable as adresse19_1_, entreprise_.comptable as comptable1_, entreprise_.bp_comptable as bp21_1_, entreprise_.tel_comptable as tel22_1_, entreprise_.forme_societe as forme23_1_, entreprise_.profession as profession1_, entreprise_.unite_secteur as unite25_1_, entreprise_.centre_fiscal as centre26_1_, entreprise_.centre_perception as centre27_1_ from entreprise entreprise_ where entreprise_.ninea=?
    Hibernate: insert into declaration (ninea, id_user, identifiant, num_fact, date_declaration, date_imposition, date_cotisation_deb, date_cotisation_fin, date_exig_depot, date_exig_paiement, type_impot, val_tbsd_mois, vente_exo, vente_taxe_o, exportation, total_vente_nt, total_vente_tax, tva_vente_tax, tva_importation, tva_achat_locaux, tva_paye, tva_net_due_credit_r, credit_reporte_ma, tva_ret_srce_minecofin, total_tva_du_credit_p, tva_r, tva_due, id_declaration) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
     WARN : JDBCExceptionReporter.java          -> SQL Error: 0, SQLState: null
    ERROR : JDBCExceptionReporter.java          -> L'élément du batch 0 insert into declaration (ninea, id_user, identifiant, num_fact, date_declaration, date_imposition, date_cotisation_deb, date_cotisation_fin, date_exig_depot, date_exig_paiement, type_impot, val_tbsd_mois, vente_exo, vente_taxe_o, exportation, total_vente_nt, total_vente_tax, tva_vente_tax, tva_importation, tva_achat_locaux, tva_paye, tva_net_due_credit_r, credit_reporte_ma, tva_ret_srce_minecofin, total_tva_du_credit_p, tva_r, tva_due, id_declaration) values (54671892E1, 18, 0, , 2008-08-27 00:00:00.000000+00:00, Juillet  2008, 01 Juillet 2008, 31 Juillet 2008, 2008-08-15 00:00:00.000000+00:00, 2008-08-15 00:00:00.000000+00:00, , 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1234567967) a été annulé. Appeler getNextException pour en connaître la cause.
     WARN : JDBCExceptionReporter.java          -> SQL Error: 0, SQLState: 23503
    ERROR : JDBCExceptionReporter.java          -> ERROR: insert or update on table "declaration" violates foreign key constraint "fk_declaration_entreprise_dec"
    ERROR : AbstractFlushingEventListener.java  -> Could not synchronize database state with session
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:63)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:181)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
    	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 com.tva.dao.imp.DeclarationDao.saveDeclaration(DeclarationDao.java:98)
    	at com.tva.manager.imp.DeclarationMg.saveDeclaration(DeclarationMg.java:59)
    	at com.tva.struts.action.declaration.EnregistrerDeclarationAction.executeAction(EnregistrerDeclarationAction.java:256)
    	at com.tva.struts.action.ActionBase.execute(ActionBase.java:155)
    	at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
    	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 com.tva.struts.servlets.ServletBase.doPost(ServletBase.java:38)
    	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:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Thread.java:595)
    Caused by: java.sql.BatchUpdateException: L'élément du batch 0 insert into declaration (ninea, id_user, identifiant, num_fact, date_declaration, date_imposition, date_cotisation_deb, date_cotisation_fin, date_exig_depot, date_exig_paiement, type_impot, val_tbsd_mois, vente_exo, vente_taxe_o, exportation, total_vente_nt, total_vente_tax, tva_vente_tax, tva_importation, tva_achat_locaux, tva_paye, tva_net_due_credit_r, credit_reporte_ma, tva_ret_srce_minecofin, total_tva_du_credit_p, tva_r, tva_due, id_declaration) values (54671892E1, 18, 0, , 2008-08-27 00:00:00.000000+00:00, Juillet  2008, 01 Juillet 2008, 31 Juillet 2008, 2008-08-15 00:00:00.000000+00:00, 2008-08-15 00:00:00.000000+00:00, , 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1234567967) a été annulé. Appeler getNextException pour en connaître la cause.
    	at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2439)
    	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1284)
    	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:345)
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2501)
    	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
    	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:174)
    	... 31 more
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:63)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:181)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
    	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 com.tva.dao.imp.DeclarationDao.saveDeclaration(DeclarationDao.java:98)
    	at com.tva.manager.imp.DeclarationMg.saveDeclaration(DeclarationMg.java:59)
    	at com.tva.struts.action.declaration.EnregistrerDeclarationAction.executeAction(EnregistrerDeclarationAction.java:256)
    	at com.tva.struts.action.ActionBase.execute(ActionBase.java:155)
    	at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
    	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 com.tva.struts.servlets.ServletBase.doPost(ServletBase.java:38)
    	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:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Thread.java:595)
    Caused by: java.sql.BatchUpdateException: L'élément du batch 0 insert into declaration (ninea, id_user, identifiant, num_fact, date_declaration, date_imposition, date_cotisation_deb, date_cotisation_fin, date_exig_depot, date_exig_paiement, type_impot, val_tbsd_mois, vente_exo, vente_taxe_o, exportation, total_vente_nt, total_vente_tax, tva_vente_tax, tva_importation, tva_achat_locaux, tva_paye, tva_net_due_credit_r, credit_reporte_ma, tva_ret_srce_minecofin, total_tva_du_credit_p, tva_r, tva_due, id_declaration) values (54671892E1, 18, 0, , 2008-08-27 00:00:00.000000+00:00, Juillet  2008, 01 Juillet 2008, 31 Juillet 2008, 2008-08-15 00:00:00.000000+00:00, 2008-08-15 00:00:00.000000+00:00, , 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1234567967) a été annulé. Appeler getNextException pour en connaître la cause.
    	at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2439)
    	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1284)
    	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:345)
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2501)
    	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
    	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:174)
    	... 31 more

  11. #11
    Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    67
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 67
    Points : 48
    Points
    48
    Par défaut
    A l'AIDE SVP

  12. #12
    Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    67
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 67
    Points : 48
    Points
    48
    Par défaut
    QUELQU'UN PEUT M'AIDER SVP je suis bloquée la dessus ?

  13. #13
    Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    67
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 67
    Points : 48
    Points
    48
    Par défaut
    oufff ça marche merci beaucoup pour votre aide

    Ben voila en ce qui concerne le insert de la table declaration ne marchait pas parce que qu'il enregistrait une valeur nulle pour la clé étrangère ,et donc je suis allé d'abord renseigné le champs identifiant que j'avais oublié de renseigner dans la classe Action
    Et ben voila ça marche ,mais vous m'avez beaucoup aidé sur le select je vous en remercie infiniment

  14. #14
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 313
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Points : 9 529
    Points
    9 529
    Billets dans le blog
    1
    Par défaut
    Regarde ce qui pourrait provoquer ceci :
    ...
    org.hibernate.exception.ConstraintViolationException
    ...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Probleme avec fonction SELECT FROM WHERE
    Par tatann22 dans le forum Langage
    Réponses: 5
    Dernier message: 27/03/2009, 02h01
  2. probleme avec new->select a wizard
    Par thesorrow dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 12/03/2007, 10h00
  3. [My SQL]probleme avec insert select
    Par jmjmjm dans le forum Langage SQL
    Réponses: 2
    Dernier message: 27/01/2007, 12h24
  4. problem avec un select sous IE?
    Par Death83 dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 24/12/2005, 15h36
  5. probleme avec un SELECT
    Par Jean Fi dans le forum Débuter
    Réponses: 5
    Dernier message: 29/11/2005, 22h55

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo