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

Spring Java Discussion :

Problème List avec Entity


Sujet :

Spring Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre actif
    Homme Profil pro
    Étudiant
    Inscrit en
    Juin 2012
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2012
    Messages : 13
    Par défaut Problème List avec Entity
    j'ai deux tables,indicateur et indperiodval, chaque indicateur peut contenir 1 ou plusieurs indperiodval, lorsque j’essaie de récupérer es indperiodeval,il me retourne chaque objet 3 fois,voici les entités :
    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
     
    package com.st2i.logique.entity;
     
    import java.io.Serializable;
    import javax.persistence.*;
    import java.util.List;
     
     
    /**
     * The persistent class for the indicateur database table.
     * 
     */
    @Entity
    @Table(name="indicateur")
    @NamedQuery(name="Indicateur.findAll", query="SELECT i FROM Indicateur i")
    public class Indicateur implements Serializable {
    	private static final long serialVersionUID = 1L;
     
    	@Id
    	@GeneratedValue(strategy=GenerationType.AUTO)
    	@Column(unique=true, nullable=false)
    	private int id_I;
     
    	@Column(length=254)
    	private String designation;
     
    	@Column(length=254)
    	private String nom;
     
    	private float objetcifR;
     
    	private float valeurRef;
     
    	//bi-directional many-to-one association to Objectif
    	@ManyToOne
    	@JoinColumn(name="objectif", nullable=false)
    	private Objectif objectifBean;
     
    	//bi-directional many-to-one association to Operateur
    	@ManyToOne
    	@JoinColumn(name="id_op", nullable=false)
    	private Operateur operateur;
     
    	//bi-directional many-to-one association to Unite
    	@ManyToOne
    	@JoinColumn(name="Uni_id", nullable=false)
    	private Unite unite;
     
    	//bi-directional many-to-one association to Indperiodval
    	@OneToMany(fetch=FetchType.EAGER,mappedBy="indicateur",cascade=CascadeType.ALL)
    	private List<Indperiodval> indperiodvals;
     
    	//bi-directional many-to-one association to Reclamation
    	@OneToMany(fetch=FetchType.EAGER,mappedBy="indicateur",cascade=CascadeType.ALL)
    	private List<Reclamation> reclamations;
     
    	public Indicateur() {
    	}
     
    	public int getId_I() {
    		return this.id_I;
    	}
     
    	public void setId_I(int id_I) {
    		this.id_I = id_I;
    	}
     
    	public String getDesignation() {
    		return this.designation;
    	}
     
    	public void setDesignation(String designation) {
    		this.designation = designation;
    	}
     
    	public String getNom() {
    		return this.nom;
    	}
     
    	public void setNom(String nom) {
    		this.nom = nom;
    	}
     
    	public float getObjetcifR() {
    		return this.objetcifR;
    	}
     
    	public void setObjetcifR(float objetcifR) {
    		this.objetcifR = objetcifR;
    	}
     
    	public float getValeurRef() {
    		return this.valeurRef;
    	}
     
    	public void setValeurRef(float valeurRef) {
    		this.valeurRef = valeurRef;
    	}
     
    	public Objectif getObjectifBean() {
    		return this.objectifBean;
    	}
     
    	public void setObjectifBean(Objectif objectifBean) {
    		this.objectifBean = objectifBean;
    	}
     
    	public Operateur getOperateur() {
    		return this.operateur;
    	}
     
    	public void setOperateur(Operateur operateur) {
    		this.operateur = operateur;
    	}
     
    	public Unite getUnite() {
    		return this.unite;
    	}
     
    	public void setUnite(Unite unite) {
    		this.unite = unite;
    	}
     
    	public List<Indperiodval> getIndperiodvals() {
    		return this.indperiodvals;
    	}
     
    	public void setIndperiodvals(List<Indperiodval> indperiodvals) {
    		this.indperiodvals = indperiodvals;
    	}
     
    	public Indperiodval addIndperiodval(Indperiodval indperiodval) {
    		getIndperiodvals().add(indperiodval);
    		indperiodval.setIndicateur(this);
     
    		return indperiodval;
    	}
     
    	public Indperiodval removeIndperiodval(Indperiodval indperiodval) {
    		getIndperiodvals().remove(indperiodval);
    		indperiodval.setIndicateur(null);
     
    		return indperiodval;
    	}
     
    	public List<Reclamation> getReclamations() {
    		return this.reclamations;
    	}
     
    	public void setReclamations(List<Reclamation> reclamations) {
    		this.reclamations = reclamations;
    	}
     
    	public Reclamation addReclamation(Reclamation reclamation) {
    		getReclamations().add(reclamation);
    		reclamation.setIndicateur(this);
     
    		return reclamation;
    	}
     
    	public Reclamation removeReclamation(Reclamation reclamation) {
    		getReclamations().remove(reclamation);
    		reclamation.setIndicateur(null);
     
    		return reclamation;
    	}
     
    }
    et celle de indperiodval
    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
     
    package com.st2i.logique.entity;
     
    import java.io.Serializable;
    import javax.persistence.*;
    import java.util.Date;
    import java.util.List;
     
     
    /**
     * The persistent class for the indperiodval database table.
     * 
     */
    @Entity
    @Table(name="indperiodval")
    @NamedQuery(name="Indperiodval.findAll", query="SELECT i FROM Indperiodval i")
    public class Indperiodval implements Serializable {
    	private static final long serialVersionUID = 1L;
     
    	@EmbeddedId
    	private IndperiodvalPK id;
     
    	@Temporal(TemporalType.DATE)
    	private Date datePrise;
     
    	private float valeurCiblePeriode;
     
    	private float valRealise;
     
    	//bi-directional many-to-one association to Indicateur
    	@ManyToOne
    	@JoinColumn(name="Ind_id", nullable=false, insertable=false, updatable=false)
    	private Indicateur indicateur;
     
    	//bi-directional many-to-one association to Periode
    	@ManyToOne
    	@JoinColumn(name="id_p", nullable=false, insertable=false, updatable=false)
    	private Periode periode;
     
    	//bi-directional many-to-one association to ValAgreg
    	@OneToMany(mappedBy="indperiodval")
    	private List<ValAgreg> valAgregs;
     
    	public Indperiodval() {
    	}
     
    	public IndperiodvalPK getId() {
    		return this.id;
    	}
     
    	public void setId(IndperiodvalPK id) {
    		this.id = id;
    	}
     
    	public Date getDatePrise() {
    		return this.datePrise;
    	}
     
    	public void setDatePrise(Date datePrise) {
    		this.datePrise = datePrise;
    	}
     
    	public float getValeurCiblePeriode() {
    		return this.valeurCiblePeriode;
    	}
     
    	public void setValeurCiblePeriode(float valeurCiblePeriode) {
    		this.valeurCiblePeriode = valeurCiblePeriode;
    	}
     
    	public float getValRealise() {
    		return this.valRealise;
    	}
     
    	public void setValRealise(float valRealise) {
    		this.valRealise = valRealise;
    	}
     
    	public Indicateur getIndicateur() {
    		return this.indicateur;
    	}
     
    	public void setIndicateur(Indicateur indicateur) {
    		this.indicateur = indicateur;
    	}
     
    	public Periode getPeriode() {
    		return this.periode;
    	}
     
    	public void setPeriode(Periode periode) {
    		this.periode = periode;
    	}
     
    	public List<ValAgreg> getValAgregs() {
    		return this.valAgregs;
    	}
     
    	public void setValAgregs(List<ValAgreg> valAgregs) {
    		this.valAgregs = valAgregs;
    	}
     
    	public ValAgreg addValAgreg(ValAgreg valAgreg) {
    		getValAgregs().add(valAgreg);
    		valAgreg.setIndperiodval(this);
     
    		return valAgreg;
    	}
     
    	public ValAgreg removeValAgreg(ValAgreg valAgreg) {
    		getValAgregs().remove(valAgreg);
    		valAgreg.setIndperiodval(null);
     
    		return valAgreg;
    	}
     
    }
    Merci d'avance

  2. #2
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Novembre 2009
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2009
    Messages : 80
    Par défaut
    Bonjour.
    Est-ce que tu as utilisé Hibernate Tools pour générer ce mapping ?
    Si non, essayes de générer les entités depuis la base de données en utilisant cet outil.
    Après, ce sera plus facile pour debuguer.
    Cdlt.

Discussions similaires

  1. problème liste avec ocaml
    Par pontarose dans le forum Caml
    Réponses: 4
    Dernier message: 08/12/2014, 13h51
  2. Problème démarrage avec Entity Framework
    Par heloise77u2 dans le forum Entity Framework
    Réponses: 2
    Dernier message: 06/09/2011, 17h34
  3. Problème insertion avec Entity + sql compact
    Par big_grim dans le forum C#
    Réponses: 1
    Dernier message: 03/08/2011, 16h39
  4. Problème SaveOrUpdate avec entity-name
    Par worldchampion57 dans le forum Hibernate
    Réponses: 5
    Dernier message: 11/04/2008, 12h06
  5. MSXML4 - <!DOCTYPE> Problème avec <!ENTITY> exte
    Par trent94 dans le forum XML/XSL et SOAP
    Réponses: 2
    Dernier message: 11/07/2005, 17h20

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