Unable to implement Repository method with java repository and Kotlin data class as Entity
See original GitHub issueTask 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
- Create Micronaut Data application in Java
- Create Kotlin data class as Entity
- Create JdbcRepository for Entity in Java
- Build project
Expected Behaviour
Project should build without error.
Actual Behaviour
Gradle build fails at step kaptKotlin with message:
> Task :kaptKotlin
e: error: Unable to implement Repository method: BookRepository.update(Object arg0). Invalid query method [update] of repository [de.braeluca.javakotlin.BookRepository]: No id found for name entity: null
> Task :kaptKotlin FAILED
Environment Information
- Operating System: Windows 10
- Micronaut Version: 1.3.0.RC1
- JDK Version: 1.8
Example Application
However, if you replace @Id with @EmbeddedId and make corresponding changes to Entity and Repository, it will work just fine.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Micronaut Unable to implement Repository method ...
Hmm entity is OK. This exception is often caused by missing @Entity annotation. But not in this case. Can you try to remove...
Read more >Micronaut Framework/questions - micronautfw/questions - Gitter
Is micronaut-data having issues with Kotlin data classes? First I had to use @field:Id ... @Id val id => error: Unable to implement...
Read more >Working with Kotlin and JPA - Baeldung
In this tutorial, we'll explore how to use Kotlin Classes as JPA entities. 2. Dependencies.
Read more >Spring Data JDBC - Reference Documentation
This prevents Spring Data to try to create an instance of it directly and failing because it can't determine the entity for that...
Read more >Micronaut Data - GitHub Pages
You can use Java 16 records or Kotlin immutable data classes. Integrated support for R2DBC, ... Querying - define a repository method to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The annotation has to be applied to the field:
Thanks it works now