Quarkus extension (io.quarkus:quarkus-spring-data-jpa) repository can't return Collection of Strings

Viewed 570

I'm migrating my service to Quarkus from SpringBoot stack. Why the following code doesn't work in Quarkus? Is that a bug?

public interface GenericDictionaryRepository extends
        JpaRepository<Dictionary, UUID> {

    @Query("select distinct(d.type) from Dictionary d order by d.type")
    List<String> findAllTypes();

}

Error message

io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step io.quarkus.spring.data.deployment.SpringDataJPAProcessor#build threw an exception: java.lang.IllegalStateException: java.lang.String was not part of the Quarkus index

My version properties for Gradle:

quarkusPluginVersion=1.3.1.Final
quarkusPlatformArtifactId=quarkus-universe-bom
quarkusPlatformGroupId=io.quarkus
quarkusPlatformVersion=1.3.1.Final
1 Answers

I had the same problem and it was a method naming problem. I had to put a break point in the quarkus code to find what method was wrongly spelled.

In my case the method was findAllOrderByNameAsc and when I used findAllByOrderByNameAsc, it worked.

To debug the app you have to execute the command ./mvnw quarkus:dev -Ddebug -Dsuspend=true and connect to remote from your IDE.

Hope it helps.

Related