Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository method generation regression: 2.4.0 -> 2.5.1 #1009

Closed
4 tasks done
Hc747 opened this issue May 6, 2021 · 2 comments · Fixed by #1017
Closed
4 tasks done

Repository method generation regression: 2.4.0 -> 2.5.1 #1009

Hc747 opened this issue May 6, 2021 · 2 comments · Fixed by #1017
Labels
priority: high High priority type: bug Something isn't working
Milestone

Comments

@Hc747
Copy link
Contributor

Hc747 commented May 6, 2021

Description

Attempting to upgrade from Micronaut 2.4.0 to 2.5.1 has introduced a compile time incompatibility in my repository methods that causes the build to fail.

Repository methods, annotated with Query(value = "INSERT/UPDATE/DELETE ...", readOnly = false) and Executable, that have a numeric return type (long in my use case) prevent the build from succeeding. The behaviour is not documented in the breaking changes against the release of 2.5.x, and was not present in previous versions.

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Create an Entity class (annotated with @entity and @table)
  2. Create a Repository interface that extends io.micronaut.data.repository.CrudRepository<Entity, Id>
  3. Within the repository interface, define methods with the signatures below
  4. Run the Micronaut application with version 2.4.0 and version 2.5.1
@Executable
@Query(value = "insert ... ", readOnly = false)
long insertExample()

@Executable
@Query(value = "update ... ", readOnly = false)
long updateExample()

@Executable
@Query(value = "delete ... ", readOnly = false)
long deleteExample()

Expected Behaviour

The application should compile and run, and when executed, the methods should return the modified row count.

Actual Behaviour

The application fails to compile.

// Unable to implement Repository method: RepositoryInterfaceName.methodName(). Invalid result type: long for 'INSERT' operation

Environment Information

  • Operating System: MacOS BigSur 11.2.3
  • Micronaut Version: 2.4.0 and 2.5.1
  • JDK Version: 1.8.0_212

Example Application

https://github.com/Hc747/micronaut-repository-regression

@Hc747
Copy link
Contributor Author

Hc747 commented May 6, 2021

@graemerocher graemerocher transferred this issue from micronaut-projects/micronaut-core May 6, 2021
@Hc747 Hc747 changed the title Repository method generation regression Repository method generation regression: 2.4.0 -> 2.5.1 May 6, 2021
@graemerocher graemerocher added type: bug Something isn't working priority: high High priority labels May 6, 2021
@dstepanov dstepanov added this to the 2.4.3 milestone May 12, 2021
@Hc747
Copy link
Contributor Author

Hc747 commented May 12, 2021

Thank you @dstepanov and @graemerocher; fantastic job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high High priority type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants