build.gradle
ext { |
| | javaGeneratedSources = file("build/classes/generated") |
| | } |
| |
|
| | idea { |
| | module { |
| | outputDir file('build/classes') |
| | sourceDirs += javaGeneratedSources |
| | generatedSourceDirs += javaGeneratedSources |
| | } |
| | } |
| |
|
| | compileJava { |
| | doFirst { |
| | javaGeneratedSources.mkdirs() |
| | } |
| | options.compilerArgs += [ |
| | '-parameters', '-s', javaGeneratedSources |
| | ] |
| | } |
// QueryDSL |
| | implementation "com.querydsl:querydsl-jpa:4.2.2" |
| | annotationProcessor("com.querydsl:querydsl-apt:4.2.2:jpa") |
| | annotationProcessor("org.springframework.boot:spring-boot-starter-data-jpa")
|
Repository.java class
extend the Repository with QueryDSL repository interfaces
public interface SomeRepository extends |
| | JpaRepository<SomeEntity, Long>, QuerydslPredicateExecutor<SomeEntity>, QuerydslBinderCustomizer<QSomeEntity> |
create a method
@Override |
| | default void customize(QuerydslBindings bindings, QSomeEntity root) { |
| | bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); |
| | } |