micronaut-projects / micronaut-data

Ahead of Time Data Repositories
Apache License 2.0
465 stars 196 forks source link

org.springframework.data.jpa.repository.JpaRepository not working #1260

Open derkoe opened 2 years ago

derkoe commented 2 years ago

Expected Behavior

Application compiles when using org.springframework.data.jpa.repository.JpaRepository like this:

package com.example;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface TestEntityRepository extends JpaRepository<TestEntity, Integer> {
}

Actual Behaviour

An error is shown:

Unable to implement Repository method: TestEntityRepository.flush(). No possible implementations found.

Steps To Reproduce

  1. git clone https://github.com/derkoe/micronaut-spring-jpa-issue.git
  2. ./mvnw package

Environment Information

Example Application

https://github.com/derkoe/micronaut-spring-jpa-issue

Version

3.2.4

graemerocher commented 2 years ago

A workaround is to override the flush method and define it like:


    @DataMethod(interceptor = FlushInterceptor.class)
    void flush();