I am trying to get table data as list using select query between dateFrom and current date using MySQL Native Query in Spring Boot. and MySQL database field datatype is String.
Below is Query in Repository:
@Query(value = "select * from Account where DATETIMESTAMP >= :dateFrom AND DATETIMESTAMP < :DATE_FORMAT(curdate(), '%d/%m/%Y')", nativeQuery = true)
List<Account> findByDate(@Param("dateFrom") String dateFrom);
Getting below error for above query in Spring Boot:
Named parameter not bound : DATE_FORMAT; nested exception is org.hibernate.QueryException: Named parameter not bound : DATE_FORMAT
Can anyone please help me to frame the query for the same.
:
colon beforeDATE_FORMAT
– Exorbitance