Improve error message for invalid update method return
For example:
Todo update(@Id UUID id, String name, LocalDateTime createdAt);
where Todo is an entity
Results in
Unable to implement Repository method: TodoRepository.update(UUID id,String name,LocalDateTime createdAt). No possible implementations found. Todo update(@Id UUID id, String name, LocalDateTime createdAt);
It would be more helpful if the error said:
Unable to implement Repository method: TodoRepository.update(UUID id,String name,LocalDateTime createdAt). Invalid return type. Update methods must return void or a number type.
I think this can be closed? It's happening in 2.4.7 at least
error: Unable to implement Repository method: TestRepository.updateByLocationId(long locationId). Update methods only support void or number based return types
Spotted this when I was trying to find an issue as to why I can't use RETURNING in an explicit Query when it worked in a previous version of micronaut data
micronaut: 2.4.4 Micronaut Data: 2.3.1
@Query(
"""
INSERT INTO locations (location_id, external_location_id, partner)
VALUES( :locationId, :externalLocationId, :partner)
ON CONFLICT (location_id) WHERE deleted_at IS NULL
DO
UPDATE SET external_location_id = EXCLUDED.external_location_id, partner = EXCLUDED.partner
RETURNING id
""")
abstract fun upsert(locationModel: LocationModel): UUID
Unable to implement Repository method: TestRepository.upsert(LocationModel locationModel). Invalid result type: java.util.UUID for 'INSERT' operation
This has been fixed and can be closed. Getting this compilation error
Unable to implement Repository method: TodoRepository.update(UUID id,String name,LocalDateTime createdAt). Update methods only support void or number based return types