Entities hierarchy are not supported by Spring JPA repositories in Quarkus
See original GitHub issueDescribe the bug If you have entities hierarchy in your application:
@MappedSuperclass
public class NamedEntity {
@NotNull
private String name;
//getters and setters here
}
@Entity
public class Person extends NamedEntity {
private String address;
//getters and setters here
}
and a JPA repository that uses an attribute from the parent entity:
@Repository
public interface PersonRepository extends CrudRepository<Person, Long> {
List<Person> findPersonByName(String name);
}
Then Quarkus application does not start with an error:
12:52:42,475 ERROR [io.qua.dev.DevModeMain] Failed to start Quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.spring.data.deployment.SpringDataJPAProcessor#build threw an exception: io.quarkus.spring.data.deployment.UnableToParseMethodException: Entity org.acme.quickstart.Person does not contain a field named: Name. Offending method is findPersonByName
Expected behavior The application should start properly and the method should search by name.
To Reproduce Steps to reproduce the behavior:
- Check out sample application from here: https://github.com/belyaev-andrey/quarkus-entity-hierarchy-test.git
- Run the application in dev mode
mvn compile quarkus:dev
- See the error.
Configuration Quarkus 1.0.0.CR1
quarkus.datasource.url=jdbc:h2:mem:hierarchy
quarkus.datasource.driver=org.h2.Driver
quarkus.datasource.username=sa
quarkus.datasource.min-size=3
quarkus.datasource.max-size=13
# drop and create the database at startup (use `update` to only update the schema)
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.dialect=org.hibernate.dialect.H2Dialect
quarkus.hibernate-orm.log.sql=true
Environment (please complete the following information):
-
Output of
uname -a
orver
: Linux ubuntu-graal 5.3.0-19-generic #20-Ubuntu SMP Fri Oct 18 09:04:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux -
Output of
java -version
: openjdk version “1.8.0_232” OpenJDK Runtime Environment (build 1.8.0_232-20191008104205.buildslave.jdk8u-src-tar–b07) OpenJDK 64-Bit GraalVM CE 19.2.1 (build 25.232-b07-jvmci-19.2-b03, mixed mode) -
Quarkus version or git rev: 1.0.0.RC1
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Cool, let me know if you need any sort of help 😎
I can try next if no one beats me to it. I think I finally have my brain wrapped around the other one.