I need to query all rows between two dates i.e. greater than or equal to fromDate and less than or equal to toDate. However, I’m unable to get the data from H2 database.
My AccountAudit Model is
@Data
@NoArgsConstructor
@Entity
public class AccountAudit {
@Id
private String accountId;
private String accountName;
private Date lastUpdateDate;
}
And my JPARepository method is
List<AccountAudit>
findByAccountIdAndLastUpdateDateGreaterThanAndLastUpdateDateLessThan(String accountId, Date
fromDate, Date toDate);
Git Repo: https://github.com/abhijitnath90/spring-data-jpa-demo.git
Sample Data:
insert into account_audit (account_id, account_name, last_update_date) values ('101', 'Roger
Federer', '2024-02-22')
Test Url: http://localhost:8080/accountauditlogs/101?fromdate=2024-01-22&todate=2024-03-22
1