如何在Hibernate JPA CriteriaUpdate [批量更新]

时间:2019-04-28 21:08:31

标签: hibernate jpa

在JPA / Hibernate中,如何利用以下mysql更新查询?

UPDATE ProjectStatus
SET deployable = true
WHERE (projectId = 100 AND team = red) or (projectId = 101 AND team = yellow) or ..
AND vertical = 'ITDept'

我有projectId和team属性的列表集合,该集合输入到此方法中。

public ProjectIdTeam {
 private Integer ProjectId;
 private String team;
 //setters and getters
}

public void updateProjectList(List<ProjectIdTeam> projectIdTeamList, String vertical) {

CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaUpdate<ProjectStatus> criteriaUpdate = criteriaBuilder.createCriteriaUpdate(ProjectStatus.class);
Root<ProjectStatus> lRoot = criteriaUpdate.from(ProjectStatus.class);
lRoot.get("projectId");
lRoot.get("team");
lRoot.get("vertical");

???
}

1 个答案:

答案 0 :(得分:0)

合并多个对 <div id="findcoordinate"> <coordinate-form></coordinate-form> </div> app.coord = "Something"; 的呼叫

VM1674:1 Uncaught ReferenceError: app is not defined