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

JDBC Java Discussion :

Value '0000-00-00' can not be represented as java.sql.Date


Sujet :

JDBC Java

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    512
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Indre et Loire (Centre)

    Informations forums :
    Inscription : Juin 2007
    Messages : 512
    Points : 97
    Points
    97
    Par défaut Value '0000-00-00' can not be represented as java.sql.Date
    Bonjour,

    j'essaie de me connecter à ma base de données, j'ai vu qu'il fallait télécharger mysql_connector se que j'ai fait. je l'ai aussi ajouté dans le path du projet.
    J'ai réussi à me connecter mais j'ai une erreur sur les dates qui me sont retournées par ma base Value '0000-00-00' can not be represented as java.sql.Date. Quel est le format alors?

  2. #2
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    on peut voir le code?

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    512
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Indre et Loire (Centre)

    Informations forums :
    Inscription : Juin 2007
    Messages : 512
    Points : 97
    Points
    97
    Par défaut
    C'est le code d'un tuto que j'ai modifié pour me servir de ma base :

    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
     
    //connection a la base de données
     
     
          affiche("connexion a la base de données");
          try {
     
             String DBurl = "jdbc:mouv";
             con = DriverManager.getConnection("jdbc:mysql://localhost/mouv","root","");
          } catch (SQLException e) {
             arret("Connection à la base de données impossible");
          }
     
          //creation et execution de la requete
     
          affiche("creation et execution de la requête");
          requete = "SELECT * FROM agents";
     
          try {
             Statement stmt = con.createStatement();
             résultats = stmt.executeQuery(requete);
          } catch (SQLException e) {
             arret("Anomalie lors de l'execution de la requête");
          }
     
          //parcours des données retournées
     
          affiche("parcours des données retournées");
          try {
             ResultSetMetaData rsmd = résultats.getMetaData();
             int nbCols = rsmd.getColumnCount();
             boolean encore = résultats.next();
     
             while (encore) {
     
                for (int i = 1; i <= nbCols; i++)
                   System.out.print(résultats.getString(i) + " ");
                System.out.println();
                encore = résultats.next();
             }
     
             résultats.close();
          } catch (SQLException e) {
             arret(e.getMessage());
          }
     
          affiche("fin du programme");
          System.exit(0);

  4. #4
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    peux tu remplacer
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
          } catch (SQLException e) {
             arret(e.getMessage());
          }
    par
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
          } catch (SQLException e) {
             e.printStackTrace();
             arret(e.getMessage());
          }
    et nous donner l'affichage du stacktrace ainsi que ce qui se trouve avant?

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    512
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Indre et Loire (Centre)

    Informations forums :
    Inscription : Juin 2007
    Messages : 512
    Points : 97
    Points
    97
    Par défaut
    Voilà ce que ça me donne :

    connexion a la base de données
    creation et execution de la requête
    parcours des données retournées
    3198 A11248 A11248 c3d7459f745217a1337bf23076873513 MR R***** J***** null null null ***********@edf.fr 15 173 0 null null 0 1 null java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
    at com.mysql.jdbc.ResultSetImpl.getDateFromString(ResultSetImpl.java:2250)
    at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5676)
    at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5509)
    at testJDBC.main(testJDBC.java:63)
    Value '0000-00-00' can not be represented as java.sql.Date


    Si je fais la même chose mais sur une table ne contenant pas de dates ça fonctionne sans erreur

  6. #6
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    essaie de rajouter ?zeroDateTimeBehavior=convertToNull à la fin de ta string de connection JDBC. 0000-00-00 n'est pas une data valide en général et ne devrais donc pas se trouver dans le DB.

    Plus d'infos:
    http://dev.mysql.com/doc/refman/5.1/...ing-3-0-to-3-1

  7. #7
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    512
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Indre et Loire (Centre)

    Informations forums :
    Inscription : Juin 2007
    Messages : 512
    Points : 97
    Points
    97
    Par défaut
    Merci ça fonctionne

    ça mets donc null à la place, et il existe quelquechose si je veux par exemple que rien ne s'affiche, ou il faut le faire en parcourant le ResultSet?

  8. #8
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    tu fais ce que tu veux de l'affichage. Si tu ne veux pas afficher la 5ème colonne, soit tu ne la met pas dans le select sql, soit tu saute une colonne dans ta boucle for.

  9. #9
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    512
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Indre et Loire (Centre)

    Informations forums :
    Inscription : Juin 2007
    Messages : 512
    Points : 97
    Points
    97
    Par défaut
    ok merci beaucoup

  10. #10
    Nouveau membre du Club
    Inscrit en
    Mars 2007
    Messages
    70
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 70
    Points : 27
    Points
    27
    Par défaut
    bonsoir a tous !!
    j'au eu le meme probleme mais dans un autre cas :
    j'utilise hibernate pour la persistance et jsf pour la couche representation .
    je veux consulter ma base de donnees afin d'afficher les données dans la page jsf.

    j'ai les classes suivantes :

    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
     
    package bean;
     
    import java.util.Date;
    import java.util.Iterator;
     
    import org.hibernate.Query;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
     
    import stt.Bcn;
    import stt.DefBcn;
    import stt.Prix;
    public class DefBcnBean 
     
    {
       private String titre ;
       private int quantite;
       private int prix;
       private String serie;
       private int ndebut;
       private int nfin;
       private Date dtbcn;
       private Date dtdef;
       private int debbcn;
     
    public DefBcnBean( Date dtdef, int ndebut, int nfin, String serie, String titre) {
    	super();
    	this.dtdef = dtdef;
    	this.ndebut = ndebut;
    	this.nfin = nfin;
    	this.prix =0;
    	this.quantite = this.nfin-this.ndebut;
    	this.serie = serie;
    	this.titre = titre;
    	this.debbcn=0;
    	SessionFactory sessionfactory = new Configuration().configure().buildSessionFactory();
    	Session session = sessionfactory.openSession();
    	try
    	{
    		Query qry = session.createQuery("from Prix p WHERE p.Id.IdTitre = :idt and  p.Id.DateDebutEffet <= :deb");
    		qry.setString("idt",this.titre);
    		qry.setDate("deb", this.dtbcn);
    		Iterator  it = qry.iterate();
    		while (it.hasNext()){
    			Prix pri = (Prix) it.next();
     
    			this.prix = pri.getId().getPrix();
    	}
    		Query q = session.createQuery("from DefBcn d WHERE d.Id.IdTitre = :idt");
    		q.setString("idt",this.titre);
    		Iterator  i = q.iterate();
    		while (i.hasNext())
    		{
    			DefBcn db = (DefBcn) i.next();
    			this.debbcn= db.getNDebBcn();
     
    		}
    		Query q2= session.createQuery("from Bcn b WHERE b.Id.ndebut = :idt");
    		q2.setInteger("idt",this.debbcn);
    		Iterator itt = q2.iterate();
    		while (i.hasNext())
    		{
    			Bcn b= (Bcn) itt.next();
    			this.dtbcn= b.getDtBcn();
    		}
     
     
    	}
    		finally
    		{
    			session.close();
    		}
    		sessionfactory.close();
     
    }
     
    public int getDebbcn() {
    	return debbcn;
    }
     
    public void setDebbcn(int debbcn) {
    	this.debbcn = debbcn;
    }
     
    public String getTitre() {
    	return titre;
    }
    public void setTitre(String titre) {
    	this.titre = titre;
    }
    public int getQuantite() {
    	return quantite;
    }
    public void setQuantite(int quantite) {
    	this.quantite = quantite;
    }
    public int getPrix() {
    	return prix;
    }
    public void setPrix(int prix) {
    	this.prix = prix;
    }
    public String getSerie() {
    	return serie;
    }
    public void setSerie(String serie) {
    	this.serie = serie;
    }
    public int getNdebut() {
    	return ndebut;
    }
    public void setNdebut(int ndebut) {
    	this.ndebut = ndebut;
    }
    public int getNfin() {
    	return nfin;
    }
    public void setNfin(int nfin) {
    	this.nfin = nfin;
    }
    public Date getDtbcn() {
    	return dtbcn;
    }
    public void setDtbcn(Date dtbcn) {
    	this.dtbcn = dtbcn;
    }
    public Date getDtdef() {
    	return dtdef;
    }
    public void setDtdef(Date dtdef) {
    	this.dtdef = dtdef;
    }
    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
    package bean;
     
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.Iterator;
    import java.util.List;
     
    import org.hibernate.HibernateException;
     
    import stt.Bcn;
    import stt.DefBcn;
    import stt.dao.BcnDAO;
    import stt.dao.DefBcnDAO;
    import stt.dao._RootDAO;
     
    public class ConsultationDefBcn 
    {
    	private Date d;
    	private Date f;
    	private List<DefBcnBean> resultat;
    	private String msg;
    	public ConsultationDefBcn(){}
    	public Date getD() {
    		return d;
    	}
    	public void setD(Date d) {
    		this.d = d;
    	}
    	public Date getF() {
    		return f;
    	}
    	public void setF(Date f) {
    		this.f = f;
    	}
    	public List<DefBcnBean> getResultat() {
    		return resultat;
    	}
    	public void setResultat(List<DefBcnBean> resultat) {
    		this.resultat = resultat;
    	}
    	public String getMsg() {
    		return msg;
    	}
    	public void setMsg(String msg) {
    		this.msg = msg;
    	}
     
    	public String afficher()
    	{
    		DefBcnBean bb;
    		try
    		{
    			_RootDAO.initialize();
    			DefBcnDAO dao = new DefBcnDAO();
    			List<DefBcn> lstbcn=dao.findAll();
    			Iterator it=lstbcn.iterator();
    			resultat = new ArrayList<DefBcnBean>();
     
    			while (it.hasNext())
    			{
    				DefBcn lbcn=(DefBcn)it.next();
     
    				if (lbcn.getDtDef().before(this.f) && lbcn.getDtDef().after(this.d))
    				{   
    					bb = new DefBcnBean(lbcn.getDtDef(),lbcn.getNDebBcn(),lbcn.getNFin(),lbcn.getId().getSerie(),lbcn.getId().getIdTitre());
    					resultat.add(bb);
    				}
    				else 
    				{msg="la defaillance est introuvable"  ;}
    			}
    			if (this.resultat.size()>0)
    			{
    				msg="";
    				return "ok"; 
    			}
    			else
    			{
    			msg="DEF B.C.N NON TROUVABLE";
    			return "nok";
    			}
     
    		}
    		catch(HibernateException e)
    		{
    			e.printStackTrace();
    			msg= e.getMessage();
    			return "nok";
    		}
     
    }
    }
    une page jsf dont le code est le suivant :
    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
     
    <h1 style="font-size: 30px; font-family: arial; color:orange">CONSULTATION DEFAILLANCE B.C.N</h1>
     
    <h:panelGrid columns="1" border="4" style="background-color: Green">
    <h:outputText value="CHOIX DE LA PERIODE DE DETECTION DEFAILLANCE" style="font-size: 16px"></h:outputText>
    </h:panelGrid><br/>
     
    <h:panelGrid columns="6" style="background-color: Orange">
    <h:outputText value="Periode du "></h:outputText>
    <h:inputText id="periode1" value="#{consultationDefBcn.d}"><f:convertDateTime type="date" pattern="yyyy-MM-dd"/></h:inputText><h:message for="periode1" style="color:error"/><h:outputText value="Au"></h:outputText>
    <h:inputText id="periode2" value="#{consultationDefBcn.f}"><f:convertDateTime type="date" pattern="yyyy-MM-dd"/></h:inputText><h:message for="periode2" style="color:error"/>
    </h:panelGrid><br/>
     
    <h:commandButton value="Afficher" action="#{consultationDefBcn.afficher }"></h:commandButton>
    <br/>
     
    <h:dataTable id="bcn" var="defBcnBean" bgcolor="orange" value="#{consultationDefBcn.resultat}">
     
    <f:facet name="header"><h:outputText value="Details Defaillance B.C.N " style="font-size: 24px"></h:outputText></f:facet>
     
    <h:column id="column1">
    <f:facet name="header">
    <h:outputText id="titre" value="Titre"></h:outputText>
    </f:facet>
    <h:outputText value="#{defBcnBean.titre}"></h:outputText>
    </h:column>
     
    <h:column id="column2">
    <f:facet name="header">
    <h:outputText id="qte" value="Qunatite"></h:outputText>
    </f:facet>
    <h:outputText value="#{defBcnBean.quantite}"></h:outputText>
    </h:column>
     
    <h:column id="column3">
    <f:facet name="header">
    <h:outputText id="prix" value="Prix"></h:outputText>
    </f:facet>
    <h:outputText value="#{defBcnBean.prix}"></h:outputText>
    </h:column>
     
    <h:column id="column4">
    <f:facet name="header">
    <h:outputText id="serie" value="Serie"></h:outputText>
    </f:facet>
    <h:outputText value="#{defBcnBean.serie}"></h:outputText>
    </h:column>
     
    <h:column id="column5">
    <f:facet name="header">
    <h:outputText id="ndeb" value="N° Debut"></h:outputText>
    </f:facet>
    <h:outputText value="#{defBcnBean.ndebut}"></h:outputText>
    </h:column>
     
    <h:column id="column6">
    <f:facet name="header">
    <h:outputText id="nfin" value="N° Fin"></h:outputText>
    </f:facet>
    <h:outputText value="#{defBcnBean.nfin}"></h:outputText>
    </h:column>
     
    <h:column id="column7">
    <f:facet name="header">
    <h:outputText id="dt" value="Date Bcn"></h:outputText>
    </f:facet>
    <h:outputText value="#{defBcnBean.dtbcn}"></h:outputText>
    </h:column>
     
    <h:column id="column8">
    <f:facet name="header">
    <h:outputText id="dtdef" value="Date Defaillance"></h:outputText>
    </f:facet>
    <h:outputText value="#{defBcnBean.dtdef}"></h:outputText>
    </h:column>
     
    </h:dataTable>
     
    </h:form>
    </center>
    </body>
    </f:view>
    </html>

    le console affiche les erreurs suivantes:

    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
    2316 [http-8080-1] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
    2856 [http-8080-1] INFO org.hibernate.type.DateType - could not read column value from result set: date8_3_0_; Value '0000-00-00' can not be represented as java.sql.Date
    2862 [http-8080-1] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: S1009
    2862 [http-8080-1] ERROR org.hibernate.util.JDBCExceptionReporter - Value '0000-00-00' can not be represented as java.sql.Date
    org.hibernate.exception.GenericJDBCException: could not execute query
    	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    	at org.hibernate.loader.Loader.doList(Loader.java:2231)
    	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
    	at org.hibernate.loader.Loader.list(Loader.java:2120)
    	at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
    	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596)
    	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
    	at stt.base._BaseRootDAO.findAll(_BaseRootDAO.java:298)
    	at stt.base.BaseDefBcnDAO.findAll(BaseDefBcnDAO.java:98)
    	at stt.base._BaseRootDAO.findAll(_BaseRootDAO.java:273)
    	at stt.base._BaseRootDAO.findAll(_BaseRootDAO.java:260)
    	at stt.base.BaseDefBcnDAO.findAll(BaseDefBcnDAO.java:82)
    	at bean.ConsultationDefBcn.afficher(ConsultationDefBcn.java:55)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:585)
    	at org.apache.el.parser.AstValue.invoke(AstValue.java:172)
    	at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
    	at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
    	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
    	at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:57)
    	at javax.faces.component.UICommand.broadcast(UICommand.java:383)
    	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
    	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
    	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
    	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	at java.lang.Thread.run(Thread.java:595)
    Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
    	at com.mysql.jdbc.ResultSetRow.getDateFast(ResultSetRow.java:140)
    	at com.mysql.jdbc.ByteArrayRow.getDateFast(ByteArrayRow.java:237)
    	at com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:2174)
    	at com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:2127)
    	at com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:2190)
    	at org.hibernate.type.DateType.get(DateType.java:51)
    	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184)
    	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:173)
    	at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)
    	at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2124)
    	at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1404)
    	at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1332)
    	at org.hibernate.loader.Loader.getRow(Loader.java:1230)
    	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:603)
    	at org.hibernate.loader.Loader.doQuery(Loader.java:724)
    	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    	at org.hibernate.loader.Loader.doList(Loader.java:2228)
    	... 39 more
    sachez que les dates ont la forme YYYY-MM-DD dans la base de donnée

    merci infiniment

  11. #11
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    Citation Envoyé par Emir83 Voir le message
    j'au eu le meme probleme mais dans un autre cas
    Et la solution devrait être la même.

  12. #12
    Nouveau membre du Club
    Inscrit en
    Mars 2007
    Messages
    70
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 70
    Points : 27
    Points
    27
    Par défaut
    merci tchize pour votre attention
    mais ou dois je mettre
    "?zeroDateTimeBehavior=convertToNull" SVP?

  13. #13
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    Citation Envoyé par tchize_ Voir le message
    rajouter ?zeroDateTimeBehavior=convertToNull à la fin de ta string de connection JDBC

  14. #14
    Nouveau membre du Club
    Inscrit en
    Mars 2007
    Messages
    70
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 70
    Points : 27
    Points
    27
    Par défaut
    j'ai pas une chaine de connexion dans mon code
    la connexion se fait quand l'objet _RootDAO soit initialisé

  15. #15
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Points : 48 807
    Points
    48 807
    Par défaut
    c'est peut etre pas dans ton code mais c'est configuré quelque part, sinon t'aurais pas de base de donnée.

  16. #16
    Nouveau membre du Club
    Inscrit en
    Mars 2007
    Messages
    70
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 70
    Points : 27
    Points
    27
    Par défaut
    ça marche !!

    un grand merci tchize !

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

Discussions similaires

  1. [2.1.2] .rptdesign has error and can not be run
    Par stratocasters dans le forum BIRT
    Réponses: 4
    Dernier message: 27/10/2008, 16h37
  2. Réponses: 1
    Dernier message: 03/07/2008, 11h38
  3. Erreur Listener : can not fork
    Par Alain B. dans le forum Administration
    Réponses: 5
    Dernier message: 23/05/2008, 13h58
  4. the import org.jdom can not be resolved
    Par samia13 dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 19/05/2007, 16h47
  5. Réponses: 14
    Dernier message: 23/08/2004, 07h53

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