3 pièce(s) jointe(s)
erreur sur appel interface
Bonsoir, je débute en spring java, j'ai un erreur sur l'appelle de l'interface, voici mon arborescence:
Pièce jointe 472164
voici la classe contact repository:
Code:
1 2 3 4
|
public interface ContactRepository extends JpaRepository<Contact, Long>{
} |
Pièce jointe 472169
voici l'erreur:
Pièce jointe 472176
pourquoi le constructeur n'est pas défini de la class Contact ?
voici la class contact:
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
|
import java.io.Serializable;
import java.sql.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
public class Contact implements Serializable{
@Id @GeneratedValue
private Long id;
private String nom;
private String prenom;
@Temporal(TemporalType.DATE)
private Date dateNaissance;
private String email;
private long tel;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getNom() {
return this.nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return this.prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public Date getDateNaissance() {
return this.dateNaissance;
}
public void setDateNaissance(Date dateNaissance) {
this.dateNaissance = dateNaissance;
}
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
public long getTel() {
return this.tel;
}
public void setTel(long tel) {
this.tel = tel;
}
public String getPhoto() {
return this.photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
private String photo;
//constructeur sans paramètre
public Contact() {
super();
}
public Contact( String nom, String prenom, Date dateNaissance, String email, long tel, String photo) {
this.nom = nom;
this.prenom = prenom;
this.dateNaissance = dateNaissance;
this.email = email;
this.tel = tel;
this.photo = photo;
}
} |
Code:
1 2 3 4 5 6
|
@Override
public void run(String... arg0) throws Exception {
DateFormat df=new SimpleDateFormat("dd/MM/yyyy");
contactRepository.save(new Contact("nom", "prenom", df.format("02/11/1960"), "email", 99, "photo"));
} |
si je supprime la ligne contactRepsistory.save(), je n'ai plus de surligne en rouge ?
merci de vos réponse