小编Rad*_*u D的帖子

Hibernate 运行不需要的更新语句

我有要运行的本机查询:

String sqlSelect =
"select r.id_roster as id, " +
                    "count(roster_cat.id_category), " +
            "       sum(case when roster_cat.id_category IN ( :categoryIds)                       then 1 else 0 end) as counter " +
            "from roster r " +
            "inner join roster_sa_categories roster_cat " +
                "on r.id_roster = roster_cat.id_roster " +
            "where r.day = :dayToLookFor " +
                "and r.id_shop = :idShop " +
            "group by r.id_roster " +
            "having count(roster_cat.id_category) = :nrCategories " +
                "and count(roster_cat.id_category) = counter" ;

    Query selectRostersQuery = entityManager.createNativeQuery(sqlSelect);

    selectRostersQuery.setParameter("categoryIds", Arrays.asList(categoryIds)); …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate jpa

2
推荐指数
1
解决办法
2545
查看次数

标签 统计

hibernate ×1

java ×1

jpa ×1

spring ×1