Erreur dans le mapping d'une collection
Bonjour,
J'ai une erreur lors de la compilation :
Code:
1 2 3 4 5 6 7 8 9
| Publishing failed
cannot Deploy SystemRH
Deployment Error for module: SystemRH: Error occurred during deployment: Exception while preparing the app : Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: model.Offre.experts. Please see server.log for more details.
Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method : org.hibernate.AnnotationException: Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: model.Offre.experts
Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements: model.Offre.experts
Could not publish to the server.
java.lang.NullPointerException
Could not publish to the server.
java.lang.NullPointerException |
Il semblerait que l'erreur vienne de l'association entre la classe Offre et la classe Candidature mais je ne vois pas l'erreur. Pouvez-vous m'aidez svp? :?
Voici le diagramme de classe :
http://www.imagup.com/data/1131979252.html
Voici la classe Offre :
Code:
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 model;
import java.util.List;
import java.util.LinkedList;
import java.util.ArrayList;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name="Offre")
public class Offre implements Serializable
{
private static final long serialVersionUID = 1L;
/**
* @uml.property name="idOffre"
*/
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
private String idOffre;
/**
* Getter of the property <tt>idOffre</tt>
* @return Returns the idOffre.
* @uml.property name="idOffre"
*/
public String getIdOffre()
{
return idOffre;
}
/**
* Setter of the property <tt>idOffre</tt>
* @param idOffre The idOffre to set.
* @uml.property name="idOffre"
*/
public void setIdOffre(String idOffre)
{
this.idOffre = idOffre;
}
/**
* @uml.property name="intitule"
*/
@Column(name="intitule")
private String intitule;
/**
* Getter of the property <tt>intitule</tt>
* @return Returns the intitule.
* @uml.property name="intitule"
*/
public String getIntitule()
{
return intitule;
}
/**
* Setter of the property <tt>intitule</tt>
* @param intitule The intitule to set.
* @uml.property name="intitule"
*/
public void setIntitule(String intitule)
{
this.intitule = intitule;
}
/**
* @uml.property name="domaine"
*/
@Column(name="domaine")
private String domaine;
/**
* Getter of the property <tt>domaine</tt>
* @return Returns the domaine.
* @uml.property name="domaine"
*/
public String getDomaine()
{
return domaine;
}
/**
* Setter of the property <tt>domaine</tt>
* @param domaine The domaine to set.
* @uml.property name="domaine"
*/
public void setDomaine(String domaine)
{
this.domaine = domaine;
}
/**
* @uml.property name="description"
*/
@Column(name="description")
private String description;
/**
* Getter of the property <tt>description</tt>
* @return Returns the description.
* @uml.property name="description"
*/
public String getDescription()
{
return description;
}
/**
* Setter of the property <tt>description</tt>
* @param description The description to set.
* @uml.property name="description"
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* @uml.property name="experts"
* @uml.associationEnd multiplicity="(0 3)" ordering="true" inverse="offre:model.Personnel"
*/
@OneToMany(mappedBy="offre")
private LinkedList experts;
/**
* Getter of the property <tt>experts</tt>
* @return Returns the experts.
* @uml.property name="experts"
*/
public LinkedList getExperts()
{
return experts;
}
/**
* Setter of the property <tt>experts</tt>
* @param experts The experts to set.
* @uml.property name="experts"
*/
public void setExperts(LinkedList experts)
{
this.experts = experts;
}
/**
* @uml.property name="candidature"
* @uml.associationEnd multiplicity="(0 -1)" ordering="true" inverse="offre:model.Candidature"
*/
@OneToMany(mappedBy="offre")
private List<Candidature> candidatures = new ArrayList<Candidature>();
public Offre(String intitule, String domaine, String description){
this.intitule=intitule;
this.domaine=domaine;
this.description=description;
experts = new LinkedList<Expert>();
}
} |
Et la classe Candidature :
Code:
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
| package model;
import java.util.LinkedList;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name="Candidature")
public class Candidature implements Serializable
{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
private int idCandidature;
/**
* Getter of the property <tt>idCandidat</tt>
* @return Returns the idCandidat.
* @uml.property name="idCandidat"
*/
public int getIdCandidature()
{
return idCandidature;
}
/**
* Setter of the property <tt>idCandidat</tt>
* @param idCandidat The idCandidat to set.
* @uml.property name="idCandidat"
*/
public void setIdCandidature(int idCandidature)
{
this.idCandidature = idCandidature;
}
/**
* @uml.property name="noteMoyenne"
*/
@Column(name="notemoyenne")
private int noteMoyenne;
/**
* Getter of the property <tt>noteMoyenne</tt>
* @return Returns the noteMoyenne.
* @uml.property name="noteMoyenne"
*/
public int getNoteMoyenne()
{
return noteMoyenne;
}
/**
* Setter of the property <tt>noteMoyenne</tt>
* @param noteMoyenne The noteMoyenne to set.
* @uml.property name="noteMoyenne"
*/
public void setNoteMoyenne(int noteMoyenne)
{
this.noteMoyenne = noteMoyenne;
}
/**
* @uml.property name="notesExperts"
*/
@Column(name="notesexperts")
private LinkedList notesExperts;
/**
* Getter of the property <tt>notesExperts</tt>
* @return Returns the notesExperts.
* @uml.property name="notesExperts"
*/
public LinkedList getNotesExperts()
{
return notesExperts;
}
/**
* Setter of the property <tt>notesExperts</tt>
* @param notesExperts The notesExperts to set.
* @uml.property name="notesExperts"
*/
public void setNotesExperts(LinkedList notesExperts)
{
this.notesExperts = notesExperts;
}
/**
* @uml.property name="etat"
*/
@Column(name="état")
private String etat;
/**
* Getter of the property <tt>etat</tt>
* @return Returns the etat.
* @uml.property name="etat"
*/
public String getEtat()
{
return etat;
}
/**
* Setter of the property <tt>etat</tt>
* @param etat The etat to set.
* @uml.property name="etat"
*/
public void setEtat(String etat)
{
this.etat = etat;
}
/**
* @uml.property name="dateCreation"
*/
@Column(name="datecreation")
private String dateCreation;
/**
* Getter of the property <tt>dateCreation</tt>
* @return Returns the dateCreation.
* @uml.property name="dateCreation"
*/
public String getDateCreation()
{
return dateCreation;
}
/**
* Setter of the property <tt>dateCreation</tt>
* @param dateCreation The dateCreation to set.
* @uml.property name="dateCreation"
*/
public void setDateCreation(String dateCreation)
{
this.dateCreation = dateCreation;
}
/**
* @uml.property name="dateEntretien"
*/
@Column(name="dateentretien")
private String dateEntretien;
/**
* Getter of the property <tt>dateEntretien</tt>
* @return Returns the dateEntretien.
* @uml.property name="dateEntretien"
*/
public String getDateEntretien()
{
return dateEntretien;
}
/**
* Setter of the property <tt>dateEntretien</tt>
* @param dateEntretien The dateEntretien to set.
* @uml.property name="dateEntretien"
*/
public void setDateEntretien(String dateEntretien)
{
this.dateEntretien = dateEntretien;
}
/**
* @uml.property name="candidat"
* @uml.associationEnd multiplicity="(1 1)" inverse="candidature:model.Candidat"
*/
@OneToOne(mappedBy="candidature")
private Candidat candidat;
/**
* Getter of the property <tt>candidat</tt>
* @return Returns the candidat.
* @uml.property name="candidat"
*/
public Candidat getCandidat()
{
return candidat;
}
/**
* Setter of the property <tt>candidat</tt>
* @param candidat The candidat to set.
* @uml.property name="candidat"
*/
public void setCandidat(Candidat candidat)
{
this.candidat = candidat;
}
/**
* @uml.property name="offre"
* @uml.associationEnd multiplicity="(1 1)" inverse="candidature:model.Offre"
*/
@ManyToOne(cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH })
@JoinColumn(name="candidature")
private Offre offre;
/**
* Getter of the property <tt>offre</tt>
* @return Returns the offre.
* @uml.property name="offre"
*/
public Offre getOffre()
{
return offre;
}
/**
* Setter of the property <tt>offre</tt>
* @param offre The offre to set.
* @uml.property name="offre"
*/
public void setOffre(Offre offre)
{
this.offre = offre;
}
/**
* @uml.property name="mail"
* @uml.associationEnd multiplicity="(1 1)" inverse="candidature:model.Mail"
*/
@OneToOne(mappedBy="candidature")
private Mail mail = new model.Mail();
/**
* Getter of the property <tt>mail</tt>
* @return Returns the mail.
* @uml.property name="mail"
*/
public Mail getMail()
{
return mail;
}
/**
* Setter of the property <tt>mail</tt>
* @param mail The mail to set.
* @uml.property name="mail"
*/
public void setMail(Mail mail)
{
this.mail = mail;
}
public Candidature(int noteMoyenne, LinkedList<Expert> notesExperts, String etat, String dateCreation, String dateEntretien){
this.noteMoyenne=noteMoyenne;
this.notesExperts=notesExperts;
this.etat=etat;
this.dateCreation=dateCreation;
this.dateEntretien=dateEntretien;
}
} |
Je vous remercie d'avance de prendre un peu de votre temps pour m'aider !