Pinchez25 opened a new pull request, #4535:
URL: https://github.com/apache/fineract/pull/4535
# Fix Type Mismatch in Survey Validation Query
## Problem
When creating a survey, the system was throwing an
`InvalidDataAccessApiUsageException` due to a type mismatch between
`LocalDateTime` and `LocalDate` in the survey validation query. The error
occurred because the repository was using `LocalDateTime` for the `pointInTime`
parameter while the entity fields `validFrom` and `validTo` were of type
`LocalDate`.
## Changes Made
1. Modified `SurveyRepository` to use `LocalDate` instead of `LocalDateTime`
for the `pointInTime` parameter in:
- `fetchActiveSurveys()` method
- `findByKey()` method
2. Updated `SpmService` to use `DateUtils.getLocalDateOfTenant()` instead of
`DateUtils.getLocalDateTimeOfSystem()` when calling repository methods:
- In `fetchValidSurveys()`
- In `createSurvey()`
## Impact
This fix ensures type consistency between the database columns, entity
fields, and repository queries, resolving the error when creating new surveys.
## Testing
- Create a new survey with valid data
- Verify that the survey is created successfully without any type mismatch
errors
- Confirm that existing survey functionality (fetching, updating,
deactivating) continues to work as expected
## Related Issues
Fixes the error:
`[org.springframework.dao.InvalidDataAccessApiUsageException: You have
attempted to set a value of type class java.time.LocalDateTime for parameter
pointInTime with expected type of class java.time.LocalDate]`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]