Quarkus: Quarkus Spring JPA Repository query methods is not working, at least like in Spring Boot

Created on 8 Jul 2020  路  6Comments  路  Source: quarkusio/quarkus

Describe the bug
I have these Java classes:
A MappedSuperclass AbstractEntity that is a superclass for all JPA entities:

@MappedSuperclass
public abstract class AbstractEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
...
}

And these JPA entity classes:

The Order class:

@Entity
@Table(name = "orders")
public class Order extends AbstractEntity {
...
    @OneToOne
    @JsonIgnore
    private Cart cart;
...
}

The Cart class:

@Entity
@Table(name = "carts")
public class Cart extends AbstractEntity {

    @ManyToOne
    private Customer customer;
...
}

And finally the Customer class:

@Entity
@Table(name = "customers")
public class Customer extends AbstractEntity {

...
}

I have a JpaRepository to find orders using the Customer Id:

@Repository
public interface OrderRepository extends JpaRepository<Order, Long> {
    List<Order> findByCartCustomerId(Long customerId);
}

Expected behavior
This Query Method needs to be working as it is actually working in Spring Boot framework with Spring Data JPA.

Actual behavior
Runtime exception is thrown:

2020-07-08 18:34:00,858 ERROR [io.qua.dep.dev.DevModeMain] (main) 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 com.targa.labs.quarkus.myboutique.domain.Order does not contain a field named: CartCustomerId. Offending method is findByCartCustomerId

To Reproduce
Steps to reproduce the behavior:

  1. Create new Quarkus app with: Hibernate ORM and Quarkus Extension for Spring Data JPA API dependencies. For DB I used Postgresql
  2. Add these classes
  3. run mvn quarkus:dev

Configuration

quarkus.datasource.db-kind=postgresql
quarkus.hibernate-orm.dialect=org.hibernate.dialect.PostgreSQL10Dialect
quarkus.hibernate-orm.log.sql=true
quarkus.datasource.username=developer
quarkus.datasource.password=p4SSW0rd
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/demo
quarkus.hibernate-orm.database.generation=drop-and-create

Screenshots
None

Environment (please complete the following information):

  • Output of uname -a or ver: Darwin MacBook-Pro-de-Nebrass.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
  • Output of java -version: OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: 1.5.2.Final
  • Build tool (ie. output of mvnw --version or gradlew --version): 3.6.3

Additional context
(Add any other context about the problem here.)

arespring kinbug

Most helpful comment

Thanks! I'm on PTO, so I'll check when I get back

All 6 comments

/cc @geoand

Thanks for reporting, I'll take a look next week

Thank you @geoand 馃槉

@ebullient in the meantime if you want to have a look, I won't stop you :)

@geoand I made a try for the fix 馃榿 can you take a look please ?

Thanks! I'm on PTO, so I'll check when I get back

Was this page helpful?
0 / 5 - 0 ratings