1 pièce(s) jointe(s)
paramètre refusé avec la méthode save
Bonsoir, je tente d'enregistrer 2 paramètre , mais il les refusent pourquoi ?
visual studio me dit qu'il faut créer une méthode save ?
Pièce jointe 476283
voici mon bout de code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
@SpringBootApplication
public class JwtToDoList implements CommandLineRunner{
@Autowired
private TaskRepository taskRepository;
public static void main(String[] args) {
SpringApplication.run(JwtToDoList.class, args);
}
@Override
public void run(String... args) throws Exception {
Stream.of("T1","T2","T3").forEach(t->{
taskRepository.save(new Task(null,t));
});
}
} |
voici mon interface repository:
Code:
1 2 3 4
|
public interface TaskRepository extends JpaRepository<Task,Long>{
} |
apparement, le plugin lombok n'a pas fait son travail ? car en ajoutant la méthode manuellement cela fonctionne, pourtant l'ide ne dit pas qu'il y a une erreur il est met automatiquement les dép
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Data @AllArgsConstructor @NoArgsConstructor
public class Task{
public Task(Long id, String taskName) {
this.id = id;
this.taskName = taskName;
}
@Id @GeneratedValue
private Long id;
private String taskName;
} |
merci de votre réponse :)