Java 8 Spring Data JPA Parameter binding

前端 未结 3 706
轻奢々
轻奢々 2021-01-11 09:35

In my @Repository interface I created custom find method with JPQL @Query that contains parameter (addressType).

from Address a where a.addressType = :addressT

3条回答
  •  一个人的身影
    2021-01-11 10:05

    Answer from JB Nizet and Xtreme Biker are both corrects. I just want to add that if you use Spring Boot the -parameters compiler flag is already added for you by spring-boot-starter-parent (Gradle or Maven) :

    plugin {
        delegate.groupId('org.apache.maven.plugins')
        delegate.artifactId('maven-compiler-plugin')
        configuration {
            delegate.parameters('true')
        }
    }
    

提交回复
热议问题