I have the following repository with the following method
@Query("SELECT m FROM Money m WHERE m.data = CURRENT_DATE()")
Money findTop1IfHasMoneyInCurrentDate();
My money class looks like this:
@Entity
@Table(name="MONEY_DATA", schema="DEMO_PIMS")
@JsonIgnoreProperties(allowGetters=true)
public class Money {
@Id
@Column(name="ID_REG")
private Long Id;
@Column(name="DATA")
@JsonFormat(pattern="dd/MM/yyyy")
@Temporal(TemporalType.TIMESTAMP)
private Date data;
@Column(name="DOLAR")
private Double dolar;
@Column(name="EURO")
private Double euro;
@Column(name="LIBRA")
private Double libra;
public Money() {
}
But it is always returning null when I call the "findTop1IfHasMoneyInCurrentDate ()" being that it has records on the current day.
What to do in Query to get a record according to the current day?