Skip to content

InvalidDataAccessApiUsageException when using IgnoreCase together with Embeddable #4087

@K-e-l-v-i-n-12

Description

@K-e-l-v-i-n-12

After upgrading to the current SNAPSHOT SpringBoot4 version, we get an InvalidDataAccessApiUsageException when calling an IgnoreCase method in CrudRepository if it is a property of an @Embedded object:

InvalidDataAccessApiUsageException: Unable to ignore case of com.example.demo.car.CarDetails types, the property “details” must reference a String

The error only occurs with SpringBoot4. Given is a Car class with a Details embeddable:

@Entity
public class Car {
....
    @Embedded
    private CarDetails details;
....
}

@Embeddable
public class CarDetails {
    private String notice;
.....
}

The repository for this:

@Repository
public interface CarRepository extends CrudRepository<Car, String> {
    public Optional<Car> findByDetailsNoticeIgnoreCase(String notice);
    public Optional<Car> findByDetailsNotice(String notice);
}

The corresponding test only fails for IgnoreCase. With findByDetailsNotice, the property can be resolved correctly:

	@Test
	public void findByNotice() {
		carRepository.findByDetailsNotice("test");
		
	}

	@Test
	public void findByNoticeIgnoreCase() {
		carRepository.findByDetailsNoticeIgnoreCase("test");
		
	}
}

A simple test project can be found here: https://github.com/K-e-l-v-i-n-12/spring-data-jpa-issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions