@Override
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void update(IGraphImportState graphImportState) {
Object[] args = new Object[3];
args[0] = graphImportState.getServerName();
args[1] = graphImportState.getViewName();
args[2] = graphImportState.getVersion();
Boolean entryExists = getJdbcTemplate().queryForObject("SELECT EXISTS (SELECT servername FROM " + schema +
GRAPH_IMPORT_STATES_TABLE + " WHERE servername = ? AND viewname = ? AND version = ?)", args, Boolean.class);
if (entryExists != null && entryExists) {
args = new Object[4];
args[0] = graphImportState.getState().toString();
args[1] = graphImportState.getServerName();
args[2] = graphImportState.getViewName();
args[3] = graphImportState.getVersion();
getJdbcTemplate().update("UPDATE " + schema + GRAPH_IMPORT_STATES_TABLE + " SET state = ? "
+ "WHERE servername = ? AND viewname = ? AND version = ?",
args);
} else {
args = new Object[4];
args[0] = graphImportState.getServerName();
args[1] = graphImportState.getViewName();
args[2] = graphImportState.getVersion();
args[3] = graphImportState.getState().toString();
getJdbcTemplate().update("INSERT INTO " + schema + GRAPH_IMPORT_STATES_TABLE
+ " (servername, viewname, version, state, timestamp) "
+ " VALUES (?, ?, ?, ?, now())",
args);
}
}
GraphImportStateDaoImpl.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:graphium
作者:
评论列表
文章目录