Bonjour,
je travaille sur un projet qui nécessiterait d'ajouter les dates. Je cherche un moyen de stocker la date en tant qu'objet Date dans une base de données d'accès, mais chaque méthode génère une erreur. J'utilise des pilotes spring boot avec Java 8.

mon code:

-------------------------classe entite--------------------------------------------------------
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
package vn.ifi.entities;
 
import java.io.Serializable;
import java.sql.Date;
 
 
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
 
@Entity
public class Order implements Serializable{
	@Id
	@GeneratedValue
	private Long id;
	private Date date;
	private int quantite;
	private double prix;
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public int getQuantite() {
		return quantite;
	}
	public void setQuantite(int quantite) {
		this.quantite = quantite;
	}
	public double getPrix() {
		return prix;
	}
	public void setPrix(double prix) {
		this.prix = prix;
	}
	public Order(Date date, int quantite, double prix) {
		super();
		this.date = date;
		this.quantite = quantite;
		this.prix = prix;
	}
	public Order() {
		super();
	}
 
 
}
-----------------------------couche dao----------------------------------------
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
package vn.ifi.dao;
 
import org.springframework.data.jpa.repository.JpaRepository;
 
import vn.ifi.entities.Order;
 
public interface OrderRepository extends JpaRepository<Order, Long>{
 
}
-------------------------------classe principale-------------------------------------------

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
package vn.ifi;
 
import java.util.stream.Stream;
 
 
 
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
 
import vn.ifi.dao.OrderRepository;
import vn.ifi.entities.Order;
 
 
@SpringBootApplication
public class ABourseOrderServiceApplication {
 
	public static void main(String[] args) {
		java.sql.Date date1 = java.sql.Date.valueOf("2016-10-25");
		ApplicationContext ctx=SpringApplication.run(ABourseOrderServiceApplication.class, args);
		OrderRepository orderRepository=ctx.getBean(OrderRepository.class);
		Stream.of(date1,15,120).forEach(s->orderRepository.save(new Order(s,s,s)));
		orderRepository.findAll().forEach(s->System.out.println(s.getId()+" "+s.getPrix()));
 
	}
}
--------------------------message d'erreur----------------------------------
Multiple markers at this line
- The constructor Order(Object&Comparable<? extends Object&Comparable<?>&Serializable>&Serializable, Object&Comparable<?
extends Object&Comparable<?>&Serializable>&Serializable, Object&Comparable<? extends Object&Comparable<?
>&Serializable>&Serializable) is undefined
- The method save(S) in the type CrudRepository<Order,Long> is not applicable for the arguments (Order)
j'utilise la base de donnée H2.