-1

I want get Specification<Entity>. I am use criteriaBuilder in my code. I have only start_date and duration. please refer table structure.

start_date | duration |
-----------|----------|
2022-06-07 |     10   |
2022-06-23 |      6   |

Please refer code example. I want to use. expireDate = start_date + duration

Specification<Entity> endDateSpec = (root, query, criteriaBuilder)->criteriaBuilder.equal(root.get("expireDate"), Date.valueOf('2022-06-07'));

please help me to write correct code according below code.

Thilina Sampath
  • 3,615
  • 6
  • 39
  • 65

1 Answers1

0
start_date, duration, DATE_ADD(`start_date`, INTERVAL `duration` DAY)AS expireDate FROM tableName
Prodip Das
  • 31
  • 3
  • expireDate? **Specification endDateSpec = (root, query, criteriaBuilder)->criteriaBuilder.equal(root.get("start_date, duration, DATE_ADD(`start_date`, INTERVAL `duration` DAY)AS expireDate FROM tableName"), Date.valueOf('2022-06-07'));** It's that correct? – Thilina Sampath Jun 09 '22 at 11:07