question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Entities hierarchy are not supported by Spring JPA repositories in Quarkus

See original GitHub issue

Describe 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:

  1. Check out sample application from here: https://github.com/belyaev-andrey/quarkus-entity-hierarchy-test.git
  2. Run the application in dev mode mvn compile quarkus:dev
  3. 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 or ver: 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:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
geoandcommented, Nov 7, 2019

Cool, let me know if you need any sort of help 😎

0reactions
ebullientcommented, Nov 7, 2019

I can try next if no one beats me to it. I think I finally have my brain wrapped around the other one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Hibernate ORM and JPA - Quarkus
annotate your entities with @Entity and any other mapping annotation as usual ... If hibernate is not auto generating the schema, and Quarkus...
Read more >
Extension for Spring Data API - Quarkus
The FruitRepository above extends Spring Data's org.springframework.data.repository.CrudRepository which means that all the latter's methods are available ...
Read more >
All configuration options - Quarkus
AWS Lambda Type Default AWS Lambda Common Type Default AWS Lambda Gateway REST API Type Default Agroal ‑ Database connection pool Type Default
Read more >
Validation with Hibernate Validator - Quarkus
In this application, we are going to test an elementary object, but we support complicated constraints and can validate graphs of objects.
Read more >
Contexts and Dependency Injection - Quarkus
However, it is not a full CDI implementation verified by the TCK. Only a subset of the CDI features is implemented - see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found