I have some “Card” object:
@Entity
@Table(name = "card", schema = "public")
@Data
@EqualsAndHashCode(callSuper = false)
public class Card {
@Id
@GeneratedValue
private Long id;
@Column(name="name")
private String name;
@Column(name="scope_time_limit")
private LocalDateTime expireDate;
}
and I want to prepare some native query where I can get the List of expiring cards based on the days I specify. I have this method:
List<Card> getExpiringCards(Integer numberOfDaysToExpiringCard) {
return cardRepository.getExpiringCardsByDay(numberOfDaysToExpiringAgreement);
}
What is the most optimal query? I was thinking about native query.
Thanks in advance.