micronaut-projects / micronaut-data

Ahead of Time Data Repositories
Apache License 2.0
468 stars 198 forks source link

Fix mapping with embedded field with generic type #3223

Closed radovanradic closed 1 week ago

radovanradic commented 1 week ago

Without this fix, compile error being thrown

error: Unable to implement Repository method: H2BookEntityRepository.findAllByResourceState(BookState state). Parameter [io.micronaut.data.tck.entities.embedded.BookState state] is not compatible with property [io.micronaut.data.tck.entities.embedded.HouseState state] of entity: io.micronaut.data.tck.entities.embedded.ResourceEntity

Because entityMap used in RepositoryTypeElementVisitor uses classElement.getName() but when there is embedded class with generic type then the error happens so we need to make map key use type parameters as well.

sonarcloud[bot] commented 1 week ago

Quality Gate Failed Quality Gate failed

Failed conditions
52.9% Coverage on New Code (required ≥ 70%)

See analysis details on SonarQube Cloud