gpt4 book ai didi

java - 日期值不正确 : '' for column 'DATESORTIE' at row 1

转载 作者:行者123 更新时间:2023-11-29 12:03:47 25 4
gpt4 key购买 nike

在 Spring 表格中,我添加了一名新员工,其中包含他开始工作的日期和他离开公司的日期,我遇到的问题是,当一名员工现在在公司工作时,该日期是他离开公司应该是空的。但是当我不触摸日期字段时,tomcat 给出了错误:

Incorrect date value: '' for column 'DATESORTIE' at row 1

这是我的Employee.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 5 ao?t 2015 11:05:44 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class name="com.my.dao.Employe" table="EMPLOYE">
<id name="id" type="int">
<column name="ID" />
<generator class="native" />
</id>
<property name="nomEmploye" type="java.lang.String">
<column name="NOMEMPLOYE" />
</property>
<property name="prenomEmploye" type="java.lang.String">
<column name="PRENOMEMPLOYE" />
</property>
<property name="matriculeMY" type="int">
<column name="MATRICULEMY" />
</property>
<property name="adresse" type="java.lang.String">
<column name="ADRESSE" />
</property>
<property name="sexe" type="java.lang.String">
<column name="SEXE" />
</property>
<property name="cin" type="java.lang.String">
<column name="CIN" />
</property>
<property name="dateNaissance" type="java.lang.String">
<column name="DATENAISSANCE" />
</property>
<property name="situationFamiliale" type="java.lang.String">
<column name="SITUATIONFAMILIALE" />
</property>
<!-- <property name="nbEnfant" type="int">
<column name="NBENFANT"></column>
</property> -->
<property name="dateEntree" type="java.lang.String">
<column name="DATEENTREE" />
</property>
<property name="dateSortie" type="java.lang.String">
<column name="DATESORTIE" />
</property>
<property name="numCIMR" type="java.lang.String">
<column name="NUMCIMR" />
</property>
<property name="numCNSS" type="java.lang.String">
<column name="NUMCNSS" />
</property>
<property name="numMUT" type="java.lang.String">
<column name="NUMMUT" />
</property>
<property name="profile" type="java.lang.String">
<column name="PROFILE" />
</property>
<property name="resteConge" type="java.lang.String">
<column name="RESTECONGE" />
</property>
<property name="banque" type="java.lang.String">
<column name="BANQUE" />
</property>
<property name="numCpteBanc" type="java.lang.String">
<column name="NUMCPTEBANC" />
</property>
<property name="fonction" type="java.lang.String">
<column name="FONCTION" />
</property>
<property name="salaire" type="float">
<column name="SALAIRE" />
</property>
<property name="indTransport" type="float">
<column name="INDTRANSPORT" />
</property>
<property name="indRepresent" type="float">
<column name="INDREPRESENT" />
</property>
<property name="indPanier" type="float">
<column name="INDPANIER" />
</property>
<many-to-one name="eDepartement" class="com.my.dao.Departement" access="field" fetch="join">
<column name="EDEPARTEMENT" />
</many-to-one>
<many-to-one name="eFonction" class="com.my.dao.Fonction" access="field" fetch="join">
<column name="EFONCTION" />
</many-to-one>
<many-to-one name="eService" class="com.my.dao.Service" access="field" fetch="join">
<column name="ESERVICE" />
</many-to-one>
<many-to-one name="eTypePaiement" class="com.my.dao.TypePaiement" access="field" fetch="join">
<column name="ETYPEPAIEMENT" />
</many-to-one>
<many-to-one name="eModePaiement" class="com.my.dao.ModePaiement" access="field" fetch="join">
<column name="EMODEPAIEMENT" />
</many-to-one>
</class>
</hibernate-mapping>

这是我的com.my.dao.Employee

package com.my.dao;

/**
* @author Ilias
* @version 1.0
*/
public class Employe {

private int id;
private String nomEmploye;
private String prenomEmploye;
private int matriculeMY;
private String adresse;
private String sexe;
private String cin;
private String dateNaissance;
private String situationFamiliale;
private int nbEnfant;
private String dateEntree;
private String dateSortie;
private String numCIMR;
private String numCNSS;
private String numMUT;
private String profile;
private String resteConge;
private String banque;
private String numCpteBanc;
private String fonction;
private float salaire;
private float indTransport;
private float indRepresent;
private float indPanier;
private Departement eDepartement;
private Fonction eFonction;
private Service eService;
private TypePaiement eTypePaiement;
private ModePaiement eModePaiement;

/**
* @return the nbEnfant
*/
public int getNbEnfant() {
return nbEnfant;
}


/**
* @param nbEnfant the nbEnfant to set
*/
public void setNbEnfant(int nbEnfant) {
this.nbEnfant = nbEnfant;
}


public String getAdresse() {
return adresse;
}


public void setAdresse(String adresse) {
this.adresse = adresse;
}

public Departement getM_Departement() {
return eDepartement;
}


public void setM_Departement(Departement m_Departement) {
this.eDepartement = m_Departement;
}


public Fonction getM_Fonction() {
return eFonction;
}


public void setM_Fonction(Fonction m_Fonction) {
this.eFonction = m_Fonction;
}


public Service getM_Service() {
return eService;
}


public void setM_Service(Service m_Service) {
this.eService = m_Service;
}


public TypePaiement getM_TypePaiement() {
return eTypePaiement;
}


public void setM_TypePaiement(TypePaiement m_TypePaiement) {
this.eTypePaiement = m_TypePaiement;
}


public ModePaiement getM_ModePaiement() {
return eModePaiement;
}


public void setM_ModePaiement(ModePaiement m_ModePaiement) {
this.eModePaiement = m_ModePaiement;
}


public int getId() {
return id;
}


public String getBanque() {
return banque;
}


public void setBanque(String banque) {
this.banque = banque;
}


public String getNumCpteBanc() {
return numCpteBanc;
}


public void setNumCpteBanc(String numCpteBanc) {
this.numCpteBanc = numCpteBanc;
}


public float getSalaire() {
return salaire;
}


public void setSalaire(float salaire) {
this.salaire = salaire;
}


public float getIndTransport() {
return indTransport;
}


public void setIndTransport(float indTransport) {
this.indTransport = indTransport;
}


public float getIndRepresent() {
return indRepresent;
}


public void setIndRepresent(float indRepresent) {
this.indRepresent = indRepresent;
}


public float getIndPanier() {
return indPanier;
}


public void setIndPanier(float indPanier) {
this.indPanier = indPanier;
}


public void setId(int id) {
this.id = id;
}


public String getNomEmploye() {
return nomEmploye;
}

public void setNomEmploye(String nomEmploye) {
this.nomEmploye = nomEmploye;
}

public String getPrenomEmploye() {
return prenomEmploye;
}

public void setPrenomEmploye(String prenomEmploye) {
this.prenomEmploye = prenomEmploye;
}

public int getMatriculeMY() {
return matriculeMY;
}

public void setMatriculeMY(int matriculeMY) {
this.matriculeMY = matriculeMY;
}

public String getSexe() {
return sexe;
}

public void setSexe(String sexe) {
this.sexe = sexe;
}

public String getCin() {
return cin;
}

public void setCin(String cin) {
this.cin = cin;
}

public String getDateNaissance() {
return dateNaissance;
}

public void setDateNaissance(String dateNaissance) {
this.dateNaissance = dateNaissance;
}

public String getSituationFamiliale() {
return situationFamiliale;
}

public void setSituationFamiliale(String situationFamiliale) {
this.situationFamiliale = situationFamiliale;
}

public String getDateEntree() {
return dateEntree;
}

public void setDateEntree(String dateEntree) {
this.dateEntree = dateEntree;
}

public String getDateSortie() {
return dateSortie;
}

public void setDateSortie(String dateSortie) {
this.dateSortie = dateSortie;
}

public String getNumCIMR() {
return numCIMR;
}

public void setNumCIMR(String numCIMR) {
this.numCIMR = numCIMR;
}

public String getNumCNSS() {
return numCNSS;
}

public void setNumCNSS(String numCNSS) {
this.numCNSS = numCNSS;
}

public String getNumMUT() {
return numMUT;
}

public void setNumMUT(String numMUT) {
this.numMUT = numMUT;
}

public String getProfile() {
return profile;
}

public void setProfile(String profile) {
this.profile = profile;
}

public String getResteConge() {
return resteConge;
}

public void setResteConge(String resteConge) {
this.resteConge = resteConge;
}


public void copie(Employe e)
{

this.nomEmploye = e.nomEmploye;

System.out.println("nom : "+e.getNomEmploye()+" nom :"+this.nomEmploye);

this.prenomEmploye = e.prenomEmploye;
this.matriculeMY = e.matriculeMY;
this.sexe = e.sexe;
this.cin = e.cin;
this.dateNaissance = e.dateNaissance;
this.situationFamiliale = e.situationFamiliale;
this.dateEntree = e.dateEntree;
this.dateSortie = e.dateSortie;
this.numCIMR = e.numCIMR;
this.numCNSS = e.numCNSS;
this.numMUT = e.numMUT;
this.profile = e.profile;
this.resteConge = e.resteConge;
this.banque = e.banque;
this.numCpteBanc = e.numCpteBanc;
this.salaire = e.salaire;
this.indTransport = e.indTransport;
this.indRepresent = e.indRepresent;
this.indPanier = e.indPanier;
this.fonction = e.fonction;
this.eDepartement = e.eDepartement;
this.eFonction = e.eFonction;
this.eService = e.eService;
this.eTypePaiement = e.eTypePaiement;
this.eModePaiement = e.eModePaiement;

}


public Employe(Employe e){
this.nomEmploye = e.nomEmploye;

System.out.println("nom : "+e.getNomEmploye()+" nom :"+this.nomEmploye);

this.setNomEmploye(e.nomEmploye);
this.setPrenomEmploye(e.prenomEmploye);
this.setCin(e.cin);
this.setDateNaissance(e.dateNaissance);
this.setSituationFamiliale(e.situationFamiliale);
this.setDateEntree(e.dateEntree);
this.setDateSortie(e.dateSortie);
this.setNumCIMR(e.numCIMR);
this.setNumCNSS(e.numCNSS);
this.setNumMUT(e.numMUT);
this.setProfile(e.profile);
this.setResteConge(e.resteConge);
this.setBanque(e.banque);
this.setNumCpteBanc(e.numCpteBanc);
this.setSalaire(e.salaire);
this.setIndTransport(e.indTransport);
this.setIndRepresent(e.indRepresent);
this.setIndPanier(e.indPanier);
this.setFonction(e.fonction);
this.setM_Departement(e.eDepartement);

}



public String getFonction() {
return fonction;
}


public void setFonction(String fonction) {
this.fonction = fonction;
}


public Employe(String nomEmploye, String prenomEmploye, int matriculeMY, String adresse, String sexe, String cin,
String dateNaissance, String situationFamiliale, String dateEntree, String dateSortie, String numCIMR,
String numCNSS, String numMUT, String profile, String resteConge, String banque, String numCpteBanc,
String fonction, int salaire, float indTransport, float indRepresent, float indPanier,
Departement m_Departement, Fonction m_Fonction, Service m_Service, TypePaiement m_TypePaiement,
ModePaiement m_ModePaiement) {
super();
this.nomEmploye = nomEmploye;
this.prenomEmploye = prenomEmploye;
this.matriculeMY = matriculeMY;
this.adresse = adresse;
this.sexe = sexe;
this.cin = cin;
this.dateNaissance = dateNaissance;
this.situationFamiliale = situationFamiliale;
this.dateEntree = dateEntree;
this.dateSortie = dateSortie;
this.numCIMR = numCIMR;
this.numCNSS = numCNSS;
this.numMUT = numMUT;
this.profile = profile;
this.resteConge = resteConge;
this.banque = banque;
this.numCpteBanc = numCpteBanc;
this.fonction = fonction;
this.salaire = salaire;
this.indTransport = indTransport;
this.indRepresent = indRepresent;
this.indPanier = indPanier;
this.eDepartement = m_Departement;
this.eFonction = m_Fonction;
this.eService = m_Service;
this.eTypePaiement = m_TypePaiement;
this.eModePaiement = m_ModePaiement;
}


public Employe() {

}


/**
* {@exception} Throwable
*/

public void finalize() throws Throwable{

}
}

我正在使用 SpringMVC、hibernate(hbm 文件)、MYSQL DB 来处理 Spring

PLZ,有人可以帮忙吗?

最佳答案

EMPLOYE,列DATESORTIE包含空字符串'',请将其更改为null并重试。

关于java - 日期值不正确 : '' for column 'DATESORTIE' at row 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31914722/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com