We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
You should be able to use colons as literals in SQL strings in native queries, or at least, escape them.
Compiler complains about no method parameter found for whatever is after the colon.
This used to work in earlier version when on micronaut 2 (started seeing the error after migrating to micronaut 3)
Similar issue from a long time ago: #423 has there been a regression? 🤔
First an entity pointing to some table in
@MappedEntity("some_table") public record ColonEntity(String example) { }
And then the repository
@Repository("some_repository") @JdbcRepository(dialect = Dialect.POSTGRES) public interface SomeRepository { @Query( value = "SELECT 'one:two:three' as example", nativeQuery = true ) ColonEntity reproduceColonError(); @Query( value = "SELECT 'one\\:two\\:three' as example", nativeQuery = true ) ColonEntity reproduceColonErrorEscaped(); }
Try to compile and you will get the error
Unable to implement Repository method: SomeRepository.reproduceColonError(). No method parameter found for named Query parameter: two
The same goes when trying to escape the colons in the second example function.
No response
3.3.3
The text was updated successfully, but these errors were encountered:
As a workaround you can put your queries in configuration, for example in application.yml:
application.yml
my: query: "SELECT 'one:two:three' as example"
And repository:
@Query( value = "${my.query}", nativeQuery = true ) ColonEntity reproduceColonError();
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Expected Behavior
You should be able to use colons as literals in SQL strings in native queries, or at least, escape them.
Actual Behaviour
Compiler complains about no method parameter found for whatever is after the colon.
This used to work in earlier version when on micronaut 2 (started seeing the error after migrating to micronaut 3)
Similar issue from a long time ago: #423 has there been a regression? 🤔
Steps To Reproduce
First an entity pointing to some table in
And then the repository
Try to compile and you will get the error
The same goes when trying to escape the colons in the second example function.
Environment Information
Example Application
No response
Version
3.3.3
The text was updated successfully, but these errors were encountered: