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

Struts 2 Java Discussion :

Struts 2 : Struts Problem Report (Problème avec les clés étrangères)


Sujet :

Struts 2 Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Femme Profil pro
    Inscrit en
    Mai 2012
    Messages
    360
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Mai 2012
    Messages : 360
    Par défaut Struts 2 : Struts Problem Report (Problème avec les clés étrangères)
    Bonjour,

    Désolée de vous déranger avec çà, surtout que je ne sais même pas si je poste mon topic au bon endroit

    Donc, je souhaite faire une injection de données dans une tables (Jour.java), cette dernière ayant un clé étrangère provenant d'une autre table (Absence.java).

    Jour.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
    package com.maison.enfant.gestion.horaire.entitybeans;
     
    // default package
    // Generated 27 mai 2012 14:00:13 by Hibernate Tools 3.4.0.CR1
     
    import java.sql.Time;
    import java.util.Date;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.FetchType;
    import javax.persistence.GeneratedValue;
    import static javax.persistence.GenerationType.IDENTITY;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.ManyToOne;
    import javax.persistence.Table;
    import javax.persistence.Temporal;
    import javax.persistence.TemporalType;
     
    /**
     * Jour generated by hbm2java
     */
    @Entity
    @Table(name = "jour", catalog = "gestionhoraire")
    public class Jour implements java.io.Serializable {
     
    	private Integer idJour;
    	private Absence absence;
    	private Semaine semaine;
    	private String jour;
    	private Time debutHoraire;
    	private Time finHoraire;
    	private String typeHoraire;
     
    	public Jour() {
    	}
     
    	public Jour(Absence absence, Semaine semaine, String jour,
    			Time debutHoraire, Time finHoraire, String typeHoraire) {
    		this.absence = absence;
    		this.semaine = semaine;
    		this.jour = jour;
    		this.debutHoraire = debutHoraire;
    		this.finHoraire = finHoraire;
    		this.typeHoraire = typeHoraire;
    	}
     
    	@Id
    	@GeneratedValue(strategy = IDENTITY)
    	@Column(name = "idJour", unique = true, nullable = false)
    	public Integer getIdJour() {
    		return this.idJour;
    	}
     
    	public void setIdJour(Integer idJour) {
    		this.idJour = idJour;
    	}
     
    	@ManyToOne(fetch = FetchType.LAZY)
    	@JoinColumn(name = "idAbsence", nullable = false)
    	public Absence getAbsence() {
    		return this.absence;
    	}
     
    	public void setAbsence(Absence absence) {
    		this.absence = absence;
    	}
     
    	@ManyToOne(fetch = FetchType.LAZY)
    	@JoinColumn(name = "idSemaine", nullable = false)
    	public Semaine getSemaine() {
    		return this.semaine;
    	}
     
    	public void setSemaine(Semaine semaine) {
    		this.semaine = semaine;
    	}
     
    	@Column(name = "jour", nullable = false, length = 50)
    	public String getJour() {
    		return this.jour;
    	}
     
    	public void setJour(String jour) {
    		this.jour = jour;
    	}
     
    	@Column(name = "debutHoraire", nullable = false, length = 8)
    	public Time getDebutHoraire() {
    		return this.debutHoraire;
    	}
     
    	public void setDebutHoraire(Time debutHoraire) {
    		this.debutHoraire = debutHoraire;
    	}
     
     
    	@Column(name = "finHoraire", nullable = false, length = 8)
    	public Time getFinHoraire() {
    		return this.finHoraire;
    	}
     
    	public void setFinHoraire(Time finHoraire) {
    		this.finHoraire = finHoraire;
    	}
     
    	@Column(name = "typeHoraire", nullable = false, length = 45)
    	public String getTypeHoraire() {
    		return this.typeHoraire;
    	}
     
    	public void setTypeHoraire(String typeHoraire) {
    		this.typeHoraire = typeHoraire;
    	}
     
    }

    Absence.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
    package com.maison.enfant.gestion.horaire.entitybeans;
     
    // default package
    // Generated 13 mai 2012 11:46:48 by Hibernate Tools 3.4.0.CR1
     
    import java.util.HashSet;
    import java.util.Set;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.FetchType;
    import javax.persistence.GeneratedValue;
    import static javax.persistence.GenerationType.IDENTITY;
    import javax.persistence.Id;
    import javax.persistence.OneToMany;
    import javax.persistence.Table;
     
    /**
     * Absence generated by hbm2java
     */
    @Entity
    @Table(name = "absence", catalog = "gestionhoraire")
    public class Absence implements java.io.Serializable {
     
    	private Integer idAbsence;
    	private String nomAbsence;
    	private String abrAbsence;
    	private double nombreHeureArecup;
    	private Set<Jour> jours = new HashSet<Jour>(0);
     
    	public Absence() {
    	}
     
    	public Absence(String nomAbsence, String abrAbsence,
    			double nombreHeureArecup) {
    		this.nomAbsence = nomAbsence;
    		this.abrAbsence = abrAbsence;
    		this.nombreHeureArecup = nombreHeureArecup;
    	}
     
    	public Absence(String nomAbsence, String abrAbsence,
    			double nombreHeureArecup, Set<Jour> jours) {
    		this.nomAbsence = nomAbsence;
    		this.abrAbsence = abrAbsence;
    		this.nombreHeureArecup = nombreHeureArecup;
    		this.jours = jours;
    	}
     
    	@Id
    	@GeneratedValue(strategy = IDENTITY)
    	@Column(name = "idAbsence", unique = true, nullable = false)
    	public Integer getIdAbsence() {
    		return this.idAbsence;
    	}
     
    	public void setIdAbsence(Integer idAbsence) {
    		this.idAbsence = idAbsence;
    	}
     
    	@Column(name = "nomAbsence", nullable = false, length = 100)
    	public String getNomAbsence() {
    		return this.nomAbsence;
    	}
     
    	public void setNomAbsence(String nomAbsence) {
    		this.nomAbsence = nomAbsence;
    	}
     
    	@Column(name = "abrAbsence", nullable = false, length = 45)
    	public String getAbrAbsence() {
    		return this.abrAbsence;
    	}
     
    	public void setAbrAbsence(String abrAbsence) {
    		this.abrAbsence = abrAbsence;
    	}
     
    	@Column(name = "nombreHeureArecup", nullable = false, precision = 22, scale = 0)
    	public double getNombreHeureArecup() {
    		return this.nombreHeureArecup;
    	}
     
    	public void setNombreHeureArecup(double nombreHeureArecup) {
    		this.nombreHeureArecup = nombreHeureArecup;
    	}
     
    	@OneToMany(fetch = FetchType.LAZY, mappedBy = "absence")
    	public Set<Jour> getJours() {
    		return this.jours;
    	}
     
    	public void setJours(Set<Jour> jours) {
    		this.jours = jours;
    	}
     
    }

    Lorsque j'essaie d'insérer un jour dans ma table, j'ai ce message d'erreur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Cannot add or update a child row: a foreign key constraint fails (`gestionhoraire`.`jour`, CONSTRAINT `FK_jour_2` FOREIGN KEY (`idAbsence`) REFERENCES `absence` (`idAbsence`) ON DELETE CASCADE ON UPDATE CASCADE)
     
    Method public java.lang.String org.hibernate.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on org.hibernate.exception.ConstraintViolationException: could not insert: [com.maison.enfant.gestion.horaire.entitybeans.Jour]
    The problematic instruction:
    ----------
    ==> ${msg[0]} [on line 68, column 29 in org/apache/struts2/dispatcher/error.ftl]

    Sachant que dans ma classe action pour insérer les jours j'ai :

    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
    //Gestion des horaires du matin
    					if (horairePersonneDebutMatinValue != null && !"".equals(horairePersonneDebutMatinValue) && 
    							horairePersonneFinMatinValue != null && !"".equals(horairePersonneFinMatinValue)){
     
    						if (!"00:00".equals(horairePersonneDebutMatinValue)|| !"00:00".equals(horairePersonneFinMatinValue)){
    							horairePersonneDebutMatinValue = horairePersonneDebutMatinValue + ":00";
    							horairePersonneFinMatinValue = horairePersonneFinMatinValue + ":00";
     
    							System.out.println("horairePersonneDebutMatinValue : "+horairePersonneDebutMatinValue);
    							System.out.println("horairePersonneFinMatinValue : "+horairePersonneFinMatinValue);
     
     
    							Time startDateMatin = java.sql.Time.valueOf(horairePersonneDebutMatinValue);
    							jourDto.setDebutHoraire(startDateMatin);
     
     
    							Time endDateMatin = java.sql.Time.valueOf(horairePersonneFinMatinValue);
    							jourDto.setFinHoraire(endDateMatin);
    							jourDto.setAbsenceDTO(null);
    							jourDto.setTypeHoraire("AM");
     
    							System.out.println("setDebutHoraire : "+jourDto.getDebutHoraire());
    							System.out.println("setFinHoraire : "+jourDto.getFinHoraire());
    							System.out.println("setAbsenceDTO : "+jourDto.getAbsenceDTO());
    							System.out.println("setTypeHoraire : "+jourDto.getTypeHoraire());
     
     
    							this.jourService.saveOrUpdateJour(jourDto);	
    						}else{
    							System.out.println("les horaires du matin sont nuls");
    							System.out.println("horairePersonneDebutMatinValue : "+horairePersonneDebutMatinValue);
    							System.out.println("horairePersonneFinMatinValue : "+horairePersonneFinMatinValue);
    						}
     
    					}

    Toutes vos suggestions et toutes vos propositions sont les bien venues ^^

    Merci de votre aide ^^

  2. #2
    Membre éclairé
    Femme Profil pro
    Inscrit en
    Mai 2012
    Messages
    360
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Mai 2012
    Messages : 360
    Par défaut
    Personne a la moindre idée d'où vient le problème ?

    Je pense que, comme l'indique le message, soucis vient de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    jourDto.setAbsenceDTO(null);
    Mais je ne vois pas pourquoi .... :/

  3. #3
    Membre éclairé
    Homme Profil pro
    Architecte technique
    Inscrit en
    Juillet 2007
    Messages
    36
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Architecte technique

    Informations forums :
    Inscription : Juillet 2007
    Messages : 36
    Par défaut
    Il y a un problème dans le code que tu nous soumets, là... Ta classe Jour ne comprend pas de méthode setAbsenceDTO. Est-ce qu'il n'y aurait pas quelque part des classes AbsenceDTO et JourDTO dont tu aurais oublié de nous parler ? Et comment se passe la conversion de la classe XXXDTO en XXX ? Et que fais ta méthode jourService.saveOrUpdateJour ?

    Parce que l'erreur est très claire : au moment où tu persistes ton instance de Jour, il y a dans l'attribut absence une instance qui n'a pas été persistée (typiquement une instance toute neuve créée par new Absence()).

  4. #4
    Membre éclairé
    Femme Profil pro
    Inscrit en
    Mai 2012
    Messages
    360
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Mai 2012
    Messages : 360
    Par défaut
    Merci beaucoup de ta réponse et de ton aide. Effectivement, j'utilise des objets JourDTO.java et AbsenceDTO.java dans ma classe action que j'ai oublié de mettre

    J'utilise le Struts 2 et Hibernate pour développer mon application.

    JourDTO.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
    package com.maison.enfant.gestion.horaire.dto;
     
    import java.sql.Time;
    import java.util.Date;
    import java.util.HashSet;
    import java.util.Set;
     
    import com.maison.enfant.gestion.horaire.entitybeans.Absence;
    import com.maison.enfant.gestion.horaire.entitybeans.Jour;
    import com.maison.enfant.gestion.horaire.entitybeans.Semaine;
     
    public class JourDTO {
    	private Integer idJour;
    	private AbsenceDTO absenceDTO;
    	private SemaineDTO semaineDTO;
    	private String jour;
    	private Time debutHoraire;
    	private Time finHoraire;
    	private String typeHoraire;
     
     
     
     
    	public Integer getIdJour() {
    		return idJour;
    	}
    	public void setIdJour(Integer idJour) {
    		this.idJour = idJour;
    	}
     
    	public AbsenceDTO getAbsenceDTO() {
    		return absenceDTO;
    	}
    	public void setAbsenceDTO(AbsenceDTO absenceDTO) {
    		this.absenceDTO = absenceDTO;
    	}
    	public SemaineDTO getSemaineDTO() {
    		return semaineDTO;
    	}
    	public void setSemaineDTO(SemaineDTO semaineDTO) {
    		this.semaineDTO = semaineDTO;
    	}
     
    	public String getJour() {
    		return jour;
    	}
    	public void setJour(String jour) {
    		this.jour = jour;
    	}
     
    	public Time getDebutHoraire() {
    		return debutHoraire;
    	}
    	public void setDebutHoraire(Time debutHoraire) {
    		this.debutHoraire = debutHoraire;
    	}
    	public Time getFinHoraire() {
    		return finHoraire;
    	}
    	public void setFinHoraire(Time finHoraire) {
    		this.finHoraire = finHoraire;
    	}
    	public String getTypeHoraire() {
    		return typeHoraire;
    	}
    	public void setTypeHoraire(String typeHoraire) {
    		this.typeHoraire = typeHoraire;
    	}
     
     
    	public JourDTO(Integer idJour, AbsenceDTO absenceDTO,
    			SemaineDTO semaineDTO, String jour, Time debutHoraire,
    			Time finHoraire, String typeHoraire) {
    		super();
    		this.idJour = idJour;
    		this.absenceDTO = absenceDTO;
    		this.semaineDTO = semaineDTO;
    		this.jour = jour;
    		this.debutHoraire = debutHoraire;
    		this.finHoraire = finHoraire;
    		this.typeHoraire = typeHoraire;
     
    	}
    	public JourDTO() {
    		super();
    	}
     
    	//Methodes qui permettent de transformer un objet DTO en objet Bean
     
    	public JourDTO (Jour jourBean){
    		this.setIdJour(jourBean.getIdJour());
    		this.setJour(jourBean.getJour());
    		this.setDebutHoraire(jourBean.getDebutHoraire());
    		this.setFinHoraire(jourBean.getFinHoraire());
    		this.setTypeHoraire(jourBean.getTypeHoraire());
     
     
    		/*Semaine semaineBean = jourBean.getSemaine();
    		this.setSemaineDTO(new SemaineDTO(semaineBean));
     
    		Absence absenceBean = jourBean.getAbsence();
    		this.setAbsenceDTO(new AbsenceDTO(absenceBean));*/
    	}
     
    	public Jour getJourBeanFromDTO(){
    		//1- recuperation des attributs du DTO
    		Integer idJour = this.getIdJour();
    		String jour = this.getJour();
    		Time debutHoraire = this.getDebutHoraire();
    		Time finHoraire = this.getFinHoraire();
    		String typeHoraire = this.getTypeHoraire();
     
     
    		AbsenceDTO absenceDto = this.absenceDTO;
    		SemaineDTO semaineDto = this.semaineDTO;
     
    		//2- Transformation des DTO en bean
    		Absence absenceBean = new Absence();
    		if (absenceDto !=null){
    			//absenceBean.setAbrAbsence(absenceDto.getAbrAbsence());
    			absenceBean.setIdAbsence(absenceDto.getIdAbsence());
    			//absenceBean.setNomAbsence(absenceDto.getNomAbsence());
    		}else{
    			absenceBean.setIdAbsence(0);
    		}
    		Semaine semaineBean = new Semaine();
    		semaineBean.setIdSemaine(semaineDto.getIdSemaine());
    		semaineBean.setNumeroSemaine(semaineDto.getNumeroSemaine());
     
     
     
    		//3- creation du bean global avec les elements définis ci-dessus 
    		Jour jourBean = new Jour(absenceBean,semaineBean,jour,debutHoraire,finHoraire,typeHoraire);
    		jourBean.setIdJour(idJour);
    		return jourBean;
    	}
     
     
    }
    AbsenceDTO.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
    package com.maison.enfant.gestion.horaire.dto;
     
    import java.util.HashSet;
    import java.util.Set;
     
    import com.maison.enfant.gestion.horaire.entitybeans.Absence;
     
    public class AbsenceDTO {
     
    	private Integer idAbsence;
    	private String nomAbsence;
    	private String abrAbsence;
    	private double nombreHeureArecup;
    	private Set<JourDTO> joursDTO = new HashSet<JourDTO>(0);
     
    	//Accesseur
    	public Integer getIdAbsence() {
    		return idAbsence;
    	}
    	public void setIdAbsence(Integer idAbsence) {
    		this.idAbsence = idAbsence;
    	}
    	public String getNomAbsence() {
    		return nomAbsence;
    	}
    	public void setNomAbsence(String nomAbsence) {
    		this.nomAbsence = nomAbsence;
    	}
    	public String getAbrAbsence() {
    		return abrAbsence;
    	}
    	public void setAbrAbsence(String abrAbsence) {
    		this.abrAbsence = abrAbsence;
    	}
     
    	public Set<JourDTO> getJoursDTO() {
    		return joursDTO;
    	}
    	public void setJoursDTO(Set<JourDTO> joursDTO) {
    		this.joursDTO = joursDTO;
    	}
     
    	public double getNombreHeureArecup() {
    		return nombreHeureArecup;
    	}
    	public void setNombreHeureArecup(double nombreHeureArecup) {
    		this.nombreHeureArecup = nombreHeureArecup;
    	}
    	public AbsenceDTO(Integer idAbsence, String nomAbsence, String abrAbsence,
    			Set<JourDTO> joursDTO) {
    		super();
    		this.idAbsence = idAbsence;
    		this.nomAbsence = nomAbsence;
    		this.abrAbsence = abrAbsence;
    		this.joursDTO = joursDTO;
    	}
    	//Constructeur vide
    	public AbsenceDTO() {
    		super();
    	}
     
    	//Methodes qui permettent de transformer un objet DTO en objet Bean
     
    		public AbsenceDTO (Absence absenceBean){
    			this.setIdAbsence(absenceBean.getIdAbsence());
    			this.setNomAbsence(absenceBean.getNomAbsence());
    			this.setAbrAbsence(absenceBean.getAbrAbsence());
    			this.setNombreHeureArecup(absenceBean.getNombreHeureArecup());
     
    		}
     
    		public Absence getAbsenceBeanFromDTO(){
     
    			Integer idAbsence = this.getIdAbsence();
    			String nomAbsence = this.getNomAbsence();
    			String abrAbsence = this.getAbrAbsence();
    			double nbHeureARecup = this.getNombreHeureArecup();
     
    			//utiliser le constructeur généré par hibernate
    			Absence absenceBean = new Absence(nomAbsence, abrAbsence, nbHeureARecup);
    			//puis le completer avec les setters des champs que l'on qouhaite ajouter.
    			absenceBean.setIdAbsence(idAbsence);
     
    			return absenceBean;
    		}
     
     
     
     
     
    }
    Ma méthode jourService.saveOrUpdateJour fait :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    	@Override
    	public void saveOrUpdateJour(JourDTO jourDTO) {
    		Jour jourBean = jourDTO.getJourBeanFromDTO();
    		System.out.println("** jourBean jour**"+jourBean.getJour());
    		this.jourDao.saveOrUpdateBean(jourBean);		
    	}
    et la méthode this.jourDao.saveOrUpdateBean(jourBean); fait
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     public void saveOrUpdateBean(final Object myBean) {
        	System.out.println("myBean : "+myBean);
        	this.getHibernateTemplate().saveOrUpdate(myBean);
        }
    Dans les différents System.out.println que j'ai mis dans différents endroit,
    j'obtiens
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    horairePersonneDebutMatinValue : 09:00:00
    horairePersonneFinMatinValue : 12:00:00
    ** jourBean jour**lun.-02-07-2012
    myBean : com.maison.enfant.gestion.horaire.entitybeans.Jour@e2d0ab
    J'ai l'impression que le soucis doit venir de ma base de données mais je ne sais pas où

    script de création de la base de données :
    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
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    -- MySQL Administrator dump 1.4
    --
    -- ------------------------------------------------------
    -- Server version	5.1.37-community-log
     
     
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
     
    /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
    /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
     
     
    --
    -- Create schema gestionhoraire
    --
     
    CREATE DATABASE /*!32312 IF NOT EXISTS*/ gestionhoraire;
    USE gestionhoraire;
     
    --
    -- Table structure for table `gestionhoraire`.`absence`
    --
     
    DROP TABLE IF EXISTS `absence`;
    CREATE TABLE `absence` (
      `idAbsence` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `nomAbsence` varchar(100) COLLATE utf8_bin NOT NULL DEFAULT '',
      `abrAbsence` varchar(45) COLLATE utf8_bin NOT NULL DEFAULT '',
      `nombreHeureArecup` double NOT NULL DEFAULT '0',
      PRIMARY KEY (`idAbsence`)
    ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`absence`
    --
     
    /*!40000 ALTER TABLE `absence` DISABLE KEYS */;
    INSERT INTO `absence` (`idAbsence`,`nomAbsence`,`abrAbsence`,`nombreHeureArecup`) VALUES 
     (11,'Congés annuel','C annuel',7),
     (12,'','',0);
    /*!40000 ALTER TABLE `absence` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`compteur`
    --
     
    DROP TABLE IF EXISTS `compteur`;
    CREATE TABLE `compteur` (
      `idCompteur` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `horaireAfaire` varchar(5) COLLATE utf8_bin NOT NULL DEFAULT '00:00',
      `horaireFaite` varchar(5) COLLATE utf8_bin NOT NULL DEFAULT '00:00',
      PRIMARY KEY (`idCompteur`)
    ) ENGINE=InnoDB AUTO_INCREMENT=400 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`compteur`
    --
     
    /*!40000 ALTER TABLE `compteur` DISABLE KEYS */;
    INSERT INTO `compteur` (`idCompteur`,`horaireAfaire`,`horaireFaite`) VALUES 
     (323,'35:00','08:00'),
     (324,'23:00','12'),
     (325,'35:00','08:00'),
     (326,'35:00','08:00'),
     (327,'35:00','08:00'),
     (328,'23:00','12'),
     (329,'35:00','01:00'),
     (330,'23:00','12'),
     (333,'17:30','12'),
     (334,'17:30','12'),
     (336,'17:30','08:00'),
     (354,'17:30','17:30'),
     (355,'17:30','13:00'),
     (358,'25','11:00'),
     (359,'25','03:00'),
     (360,'25','12'),
     (361,'13','12'),
     (362,'35:00','04:00'),
     (363,'15','11:00'),
     (364,'15','03:00'),
     (367,'15','03:00'),
     (368,'15','03:00'),
     (369,'35:00','03:00'),
     (370,'35:00','02:00'),
     (371,'15','07:00'),
     (372,'15','07:00'),
     (373,'15','07:00'),
     (374,'35:00','05:00'),
     (375,'35:00','03:00'),
     (376,'35:00','00:00'),
     (377,'23:00','12'),
     (378,'10','12'),
     (379,'35:00','12'),
     (380,'23:00','12'),
     (381,'10','12'),
     (382,'15','03:00'),
     (383,'15','12'),
     (384,'35','12'),
     (385,'35:00','06:00'),
     (386,'15','12'),
     (387,'35','12'),
     (388,'15','01:00'),
     (389,'15','02:00'),
     (390,'35','12');
    INSERT INTO `compteur` (`idCompteur`,`horaireAfaire`,`horaireFaite`) VALUES 
     (391,'15','03:00'),
     (392,'15','08:00'),
     (393,'7.5','05:00'),
     (394,'7.5','03:00'),
     (395,'7.5','12'),
     (396,'7.5','03:00'),
     (397,'7.5','03:00'),
     (398,'7.5','03:00'),
     (399,'7.5','03:00');
    /*!40000 ALTER TABLE `compteur` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`droit`
    --
     
    DROP TABLE IF EXISTS `droit`;
    CREATE TABLE `droit` (
      `idDroit` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `nomDroit` varchar(45) COLLATE utf8_bin NOT NULL DEFAULT '',
      `descDroit` varchar(45) COLLATE utf8_bin NOT NULL DEFAULT '',
      PRIMARY KEY (`idDroit`)
    ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`droit`
    --
     
    /*!40000 ALTER TABLE `droit` DISABLE KEYS */;
    INSERT INTO `droit` (`idDroit`,`nomDroit`,`descDroit`) VALUES 
     (1,'admininistrateur','ad8'),
     (5,'visualisation','visu'),
     (7,'tyt','tyt');
    /*!40000 ALTER TABLE `droit` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`fonction`
    --
     
    DROP TABLE IF EXISTS `fonction`;
    CREATE TABLE `fonction` (
      `idFonction` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `descFonction` varchar(100) COLLATE utf8_bin NOT NULL DEFAULT '',
      PRIMARY KEY (`idFonction`)
    ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`fonction`
    --
     
    /*!40000 ALTER TABLE `fonction` DISABLE KEYS */;
    INSERT INTO `fonction` (`idFonction`,`descFonction`) VALUES 
     (2,'Moniteur Educ'),
     (3,'Educateurs'),
     (6,'info');
    /*!40000 ALTER TABLE `fonction` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`jour`
    --
     
    DROP TABLE IF EXISTS `jour`;
    CREATE TABLE `jour` (
      `idJour` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `idSemaine` int(10) unsigned NOT NULL DEFAULT '0',
      `idAbsence` int(10) unsigned NOT NULL DEFAULT '0',
      `jour` varchar(50) COLLATE utf8_bin NOT NULL DEFAULT '',
      `debutHoraire` time NOT NULL DEFAULT '00:00:00',
      `finHoraire` time NOT NULL DEFAULT '00:00:00',
      `typeHoraire` varchar(45) COLLATE utf8_bin NOT NULL DEFAULT '',
      PRIMARY KEY (`idJour`),
      KEY `FK_jour_1` (`idSemaine`),
      KEY `FK_jour_2` (`idAbsence`),
      CONSTRAINT `FK_jour_1` FOREIGN KEY (`idSemaine`) REFERENCES `semaine` (`idSemaine`) ON DELETE CASCADE ON UPDATE CASCADE,
      CONSTRAINT `FK_jour_2` FOREIGN KEY (`idAbsence`) REFERENCES `absence` (`idAbsence`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB AUTO_INCREMENT=1071 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`jour`
    --
     
    /*!40000 ALTER TABLE `jour` DISABLE KEYS */;
    /*!40000 ALTER TABLE `jour` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`personne`
    --
     
    DROP TABLE IF EXISTS `personne`;
    CREATE TABLE `personne` (
      `idPersonne` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `nom` varchar(100) COLLATE utf8_bin NOT NULL DEFAULT '',
      `prenom` varchar(100) COLLATE utf8_bin NOT NULL DEFAULT '',
      `idFonction` int(10) unsigned NOT NULL DEFAULT '0',
      `idUser` int(10) unsigned NOT NULL DEFAULT '0',
      `horaireContrat` varchar(5) COLLATE utf8_bin NOT NULL DEFAULT '00:00',
      `idDroit` int(10) unsigned NOT NULL DEFAULT '0',
      `idService` int(10) unsigned NOT NULL DEFAULT '0',
      PRIMARY KEY (`idPersonne`),
      KEY `FK_personne_2` (`idFonction`),
      KEY `FK_personne_3` (`idUser`),
      KEY `FK_personne_4` (`idDroit`),
      KEY `FK_personne_5` (`idService`),
      CONSTRAINT `FK_personne_2` FOREIGN KEY (`idFonction`) REFERENCES `fonction` (`idFonction`) ON DELETE CASCADE ON UPDATE CASCADE,
      CONSTRAINT `FK_personne_3` FOREIGN KEY (`idUser`) REFERENCES `userlogin` (`idUser`) ON DELETE CASCADE ON UPDATE CASCADE,
      CONSTRAINT `FK_personne_4` FOREIGN KEY (`idDroit`) REFERENCES `droit` (`idDroit`) ON DELETE CASCADE ON UPDATE CASCADE,
      CONSTRAINT `FK_personne_5` FOREIGN KEY (`idService`) REFERENCES `service` (`idService`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`personne`
    --
     
    /*!40000 ALTER TABLE `personne` DISABLE KEYS */;
    INSERT INTO `personne` (`idPersonne`,`nom`,`prenom`,`idFonction`,`idUser`,`horaireContrat`,`idDroit`,`idService`) VALUES 
     (1,'Driouech','Achraf',6,1,'23:00',1,14),
     (39,'Salcou','Beber',2,33,'35:00',5,13),
     (42,'FILIBERT','Françoise',3,36,'15',1,12),
     (43,'PALOUA','Noémie',3,37,'35',5,12),
     (44,'DELCOUR','Thierry',3,38,'10',5,14),
     (45,'CHRISTIOLIN','Albert',3,39,'7.5',1,16),
     (46,'TRIO','Jean Jacques',3,40,'28',1,15);
    /*!40000 ALTER TABLE `personne` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`perssemainecompt`
    --
     
    DROP TABLE IF EXISTS `perssemainecompt`;
    CREATE TABLE `perssemainecompt` (
      `idPersSemaineCompt` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `idSemaine` int(10) unsigned NOT NULL DEFAULT '0',
      `idCompteur` int(10) unsigned NOT NULL DEFAULT '0',
      `idPersonne` int(10) unsigned NOT NULL DEFAULT '0',
      `observation` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
      PRIMARY KEY (`idPersSemaineCompt`),
      KEY `FK_perssemainecompt_1` (`idSemaine`),
      KEY `FK_perssemainecompt_2` (`idCompteur`),
      KEY `FK_perssemainecompt_3` (`idPersonne`),
      CONSTRAINT `FK_perssemainecompt_1` FOREIGN KEY (`idSemaine`) REFERENCES `semaine` (`idSemaine`) ON DELETE CASCADE ON UPDATE CASCADE,
      CONSTRAINT `FK_perssemainecompt_2` FOREIGN KEY (`idCompteur`) REFERENCES `compteur` (`idCompteur`) ON DELETE CASCADE ON UPDATE CASCADE,
      CONSTRAINT `FK_perssemainecompt_3` FOREIGN KEY (`idPersonne`) REFERENCES `personne` (`idPersonne`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`perssemainecompt`
    --
     
    /*!40000 ALTER TABLE `perssemainecompt` DISABLE KEYS */;
    INSERT INTO `perssemainecompt` (`idPersSemaineCompt`,`idSemaine`,`idCompteur`,`idPersonne`,`observation`) VALUES 
     (40,349,376,39,''),
     (41,349,377,1,''),
     (42,349,378,44,''),
     (43,350,379,39,''),
     (44,350,380,1,''),
     (45,350,381,44,''),
     (46,352,383,42,''),
     (47,352,384,43,''),
     (48,354,386,42,''),
     (49,354,387,43,''),
     (50,356,389,42,''),
     (51,356,390,43,''),
     (52,361,395,45,'');
    /*!40000 ALTER TABLE `perssemainecompt` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`roulement`
    --
     
    DROP TABLE IF EXISTS `roulement`;
    CREATE TABLE `roulement` (
      `idRoulement` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `idService` int(10) unsigned NOT NULL DEFAULT '0',
      `nomRoulement` varchar(45) NOT NULL DEFAULT '',
      PRIMARY KEY (`idRoulement`),
      KEY `FK_roulement_1` (`idService`),
      CONSTRAINT `FK_roulement_1` FOREIGN KEY (`idService`) REFERENCES `service` (`idService`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8;
     
    --
    -- Dumping data for table `gestionhoraire`.`roulement`
    --
     
    /*!40000 ALTER TABLE `roulement` DISABLE KEYS */;
    INSERT INTO `roulement` (`idRoulement`,`idService`,`nomRoulement`) VALUES 
     (55,53,'A1');
    /*!40000 ALTER TABLE `roulement` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`semaine`
    --
     
    DROP TABLE IF EXISTS `semaine`;
    CREATE TABLE `semaine` (
      `idSemaine` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `numeroSemaine` int(10) unsigned NOT NULL DEFAULT '0',
      `roulementSem` varchar(10) COLLATE utf8_bin DEFAULT NULL,
      `dateModif` date NOT NULL DEFAULT '0000-00-00',
      `dateDebutSem` date NOT NULL DEFAULT '0000-00-00',
      `dateFinSem` date NOT NULL DEFAULT '0000-00-00',
      `Previsionnel` varchar(45) COLLATE utf8_bin NOT NULL DEFAULT '',
      PRIMARY KEY (`idSemaine`)
    ) ENGINE=InnoDB AUTO_INCREMENT=366 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`semaine`
    --
     
    /*!40000 ALTER TABLE `semaine` DISABLE KEYS */;
    INSERT INTO `semaine` (`idSemaine`,`numeroSemaine`,`roulementSem`,`dateModif`,`dateDebutSem`,`dateFinSem`,`Previsionnel`) VALUES 
     (346,27,'a1','2012-07-03','2012-07-02','2012-07-08','prévisionnel'),
     (347,27,'a1','2012-07-03','2012-07-02','2012-07-08','prévisionnel'),
     (348,27,'a1','2012-07-03','2012-07-02','2012-07-08','prévisionnel'),
     (349,28,'a1','2012-07-03','2012-07-09','2012-07-15','réalisé'),
     (350,31,'a1','2012-07-03','2012-07-30','2012-08-05','prévisionnel'),
     (351,27,'a1','2012-07-03','2012-07-02','2012-07-08','prévisionnel'),
     (352,28,'a1','2012-07-03','2012-07-09','2012-07-15','prévisionnel'),
     (353,31,'a1','2012-07-03','2012-07-30','2012-08-05','réalisé'),
     (354,29,'a1','2012-07-03','2012-07-16','2012-07-22','réalisé'),
     (355,27,'a1','2012-07-03','2012-07-02','2012-07-08','prévisionnel'),
     (356,27,'a1','2012-07-03','2012-07-02','2012-07-08','prévisionnel'),
     (357,27,'a1','2012-07-03','2012-07-02','2012-07-08','réalisé'),
     (358,31,'a1','2012-07-03','2012-07-30','2012-08-05','prévisionnel'),
     (359,27,'a1','2012-07-03','2012-07-02','2012-07-08','prévisionnel');
    INSERT INTO `semaine` (`idSemaine`,`numeroSemaine`,`roulementSem`,`dateModif`,`dateDebutSem`,`dateFinSem`,`Previsionnel`) VALUES 
     (360,27,'a1','2012-07-03','2012-07-02','2012-07-08','prévisionnel'),
     (361,27,'a1','2012-07-04','2012-07-02','2012-07-08','prévisionnel'),
     (362,27,'a1','2012-07-04','2012-07-02','2012-07-08','réalisé'),
     (363,27,'a1','2012-07-04','2012-07-02','2012-07-08','réalisé'),
     (364,27,'a1','2012-07-04','2012-07-02','2012-07-08','réalisé'),
     (365,27,'a1','2012-07-04','2012-07-02','2012-07-08','prévisionnel');
    /*!40000 ALTER TABLE `semaine` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`service`
    --
     
    DROP TABLE IF EXISTS `service`;
    CREATE TABLE `service` (
      `idService` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `nomService` varchar(45) COLLATE utf8_bin NOT NULL DEFAULT '',
      PRIMARY KEY (`idService`)
    ) ENGINE=InnoDB AUTO_INCREMENT=69 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`service`
    --
     
    /*!40000 ALTER TABLE `service` DISABLE KEYS */;
    INSERT INTO `service` (`idService`,`nomService`) VALUES 
     (12,'Service 3'),
     (13,'Service 4'),
     (14,'Service 2'),
     (15,'Service 5'),
     (16,'Service 7 '),
     (53,'Service POIII');
    /*!40000 ALTER TABLE `service` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`unite`
    --
     
    DROP TABLE IF EXISTS `unite`;
    CREATE TABLE `unite` (
      `idUnite` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `nomUnite` varchar(45) COLLATE utf8_bin NOT NULL DEFAULT '',
      PRIMARY KEY (`idUnite`)
    ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`unite`
    --
     
    /*!40000 ALTER TABLE `unite` DISABLE KEYS */;
    INSERT INTO `unite` (`idUnite`,`nomUnite`) VALUES 
     (14,'Unité 1'),
     (15,'Unité 2'),
     (16,'Unité 7');
    /*!40000 ALTER TABLE `unite` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`uniteservice`
    --
     
    DROP TABLE IF EXISTS `uniteservice`;
    CREATE TABLE `uniteservice` (
      `idUnite` int(10) unsigned NOT NULL DEFAULT '0',
      `idService` int(10) unsigned NOT NULL DEFAULT '0',
      PRIMARY KEY (`idUnite`,`idService`),
      KEY `FK_uniteservice_2` (`idService`),
      CONSTRAINT `FK_uniteservice_1` FOREIGN KEY (`idUnite`) REFERENCES `unite` (`idUnite`) ON DELETE CASCADE ON UPDATE CASCADE,
      CONSTRAINT `FK_uniteservice_2` FOREIGN KEY (`idService`) REFERENCES `service` (`idService`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`uniteservice`
    --
     
    /*!40000 ALTER TABLE `uniteservice` DISABLE KEYS */;
    INSERT INTO `uniteservice` (`idUnite`,`idService`) VALUES 
     (14,12),
     (15,13),
     (14,14),
     (15,15),
     (16,16);
    /*!40000 ALTER TABLE `uniteservice` ENABLE KEYS */;
     
     
    --
    -- Table structure for table `gestionhoraire`.`userlogin`
    --
     
    DROP TABLE IF EXISTS `userlogin`;
    CREATE TABLE `userlogin` (
      `idUser` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `login` varchar(45) COLLATE utf8_bin NOT NULL DEFAULT '',
      `mdp` varchar(45) COLLATE utf8_bin NOT NULL DEFAULT '',
      PRIMARY KEY (`idUser`)
    ) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
     
    --
    -- Dumping data for table `gestionhoraire`.`userlogin`
    --
     
    /*!40000 ALTER TABLE `userlogin` DISABLE KEYS */;
    INSERT INTO `userlogin` (`idUser`,`login`,`mdp`) VALUES 
     (1,'test','test'),
     (2,'gfg','fgfgfg'),
     (5,'gfg','fgfgfg'),
     (6,'gfg','fgfgfg'),
     (7,'gfg','fgfgfg'),
     (9,'ouiy','yuio'),
     (10,'ouiy','yuio'),
     (11,'hhh','hhh'),
     (15,'00','00'),
     (17,'120','123'),
     (18,'1205','1235'),
     (19,'1205','1235'),
     (20,'oo','oo'),
     (21,'pp852','pp'),
     (33,'tata','pp'),
     (34,'tata','pp'),
     (35,'',''),
     (36,'ff','ff'),
     (37,'ff','ff'),
     (38,'ff','ff'),
     (39,'',''),
     (40,'','');
    /*!40000 ALTER TABLE `userlogin` ENABLE KEYS */;
     
    /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
    /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
    /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

    Je suis preneuse de toutes suggestions.
    Merci pour tout

  5. #5
    Membre éclairé
    Homme Profil pro
    Architecte technique
    Inscrit en
    Juillet 2007
    Messages
    36
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Architecte technique

    Informations forums :
    Inscription : Juillet 2007
    Messages : 36
    Par défaut
    Nope, le problème vient exactement de ce que je disais plus haut. Dans JourDTO, ligne 118 et suivantes : si l'AbsenceDTO dans ton JourDTO est null (ce qui est le cas), tu met dans ton instance de Jour une instance d'Absence qui n'existe pas en base.

    De manière plus générale : as-tu vraiment besoin d'avoir une classe Jour, et une classe JourDTO (idem pour le reste) ? C'est rarement une bonne idée de multiplier les classes pour tes objets métier. Ça complique les évolutions ultérieures (rajouter un champ...), ça ajoute du code inutile (qui ne sert qu'à convertir d'une classe dans une autre pratiquement identique)... Tu pourrais parfaitement exposer directement ta classe Jour dans ton action.

  6. #6
    Membre éclairé
    Femme Profil pro
    Inscrit en
    Mai 2012
    Messages
    360
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Mai 2012
    Messages : 360
    Par défaut
    MERCI ! ! !

    Grâce à toi j'ai trouvé d'où venait le problème. Effectivement, comme j'avais nettoyé ma base de données, j'avais également enlevé l'idAbsence qui était égale à 0.

    Merci pour tout ^^ car çà faisait 2 jour que j'y étais dessus

    Encore Merci !

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

Discussions similaires

  1. [Core] Problème avec les clés étrangères
    Par leara500 dans le forum Hibernate
    Réponses: 1
    Dernier message: 04/07/2012, 08h37
  2. Réponses: 10
    Dernier message: 27/03/2011, 13h27
  3. Problème avec les clés étrangères
    Par PoichOU dans le forum SQL Procédural
    Réponses: 5
    Dernier message: 06/11/2007, 09h46
  4. [CONCEPTION MCD] Problème avec les clés composées
    Par fabriceMerc dans le forum Schéma
    Réponses: 3
    Dernier message: 14/02/2005, 09h43

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