【发布时间】:2016-05-27 18:01:26
【问题描述】:
public interface ItemRepository extends JpaRepository<Item, Integer> {
List<Item> findByNameAndDescriptionIsNullOrDescription(String name, String desc);
}
在原生Query中,findByNameAndDescriptionIsNullOrDescription的where条件被翻译成
where item0_.NAME=? and (item0_.DESC is null) or item0_.DESC=?
我需要 where item0_.NAME=? and (item0_.DESC is null or item0_.DESC=?)
我正在使用以下
spring-data-commons-1.6.3.RELEASE.jar
spring-data-jpa-1.4.3.RELEASE.jar
(i)hibernate-entitymanager-4.2.14.SP1-redhat-1.jar,(ii) JBOSS 提供的 hibernate-jpa-2.0-api-1.0.1.Final-redhat-2.jar EAP 6.3
【问题讨论】:
-
QueryDSL 与这个问题的相关性?本机查询将是 SQL 查询。
标签: java hibernate jpa spring-data-jpa