當前位置: 首頁>>代碼示例>>Java>>正文


Java PreparedStatementSetter類代碼示例

本文整理匯總了Java中org.springframework.jdbc.core.PreparedStatementSetter的典型用法代碼示例。如果您正苦於以下問題:Java PreparedStatementSetter類的具體用法?Java PreparedStatementSetter怎麽用?Java PreparedStatementSetter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PreparedStatementSetter類屬於org.springframework.jdbc.core包,在下文中一共展示了PreparedStatementSetter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: saveAccessToken

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
@Override
public int saveAccessToken(final AccessToken accessToken) {
    final String sql = "insert into oauth_access_token(token_id,token_expired_seconds,authentication_id," +
            "username,client_id,token_type,refresh_token_expired_seconds,refresh_token) values (?,?,?,?,?,?,?,?) ";

    return jdbcTemplate.update(sql, new PreparedStatementSetter() {
        @Override
        public void setValues(PreparedStatement ps) throws SQLException {
            ps.setString(1, accessToken.tokenId());
            ps.setInt(2, accessToken.tokenExpiredSeconds());
            ps.setString(3, accessToken.authenticationId());

            ps.setString(4, accessToken.username());
            ps.setString(5, accessToken.clientId());
            ps.setString(6, accessToken.tokenType());

            ps.setInt(7, accessToken.refreshTokenExpiredSeconds());
            ps.setString(8, accessToken.refreshToken());
        }
    });
}
 
開發者ID:monkeyk,項目名稱:oauth2-shiro,代碼行數:22,代碼來源:OauthJdbcRepository.java

示例2: lookupPrimaryKeys

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
/**
 * Locates the primary key IDs specified in "findNow", adding AclImpl instances with StubAclParents to the
 * "acls" Map.
 *
 * @param acls the AclImpls (with StubAclParents)
 * @param findNow Long-based primary keys to retrieve
 * @param sids
 */
private void lookupPrimaryKeys(final Map<Serializable, Acl> acls, final Set<Long> findNow, final List<Sid> sids) {
    Assert.notNull(acls, "ACLs are required");
    Assert.notEmpty(findNow, "Items to find now required");

    String sql = computeRepeatingSql(lookupPrimaryKeysWhereClause, findNow.size());

    Set<Long> parentsToLookup = jdbcTemplate.query(sql,
        new PreparedStatementSetter() {
            public void setValues(PreparedStatement ps) throws SQLException {
                int i = 0;

                for (Long toFind : findNow) {
                    i++;
                    ps.setLong(i, toFind);
                }
            }
        }, new ProcessResultSet(acls, sids));

    // Lookup the parents, now that our JdbcTemplate has released the database connection (SEC-547)
    if (parentsToLookup.size() > 0) {
        lookupPrimaryKeys(acls, parentsToLookup, sids);
    }
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:32,代碼來源:BasicLookupStrategy.java

示例3: saveUsers

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
@Override
public int saveUsers(final Users users) {
    String sql = " insert into users(guid,create_time, username,password) values (?,?,?,?) ";
    this.jdbcTemplate.update(sql, new PreparedStatementSetter() {
        @Override
        public void setValues(PreparedStatement ps) throws SQLException {
            ps.setString(1, users.guid());
            ps.setTimestamp(2, new Timestamp(users.createTime().getTime()));
            ps.setString(3, users.username());

            ps.setString(4, users.password());
        }
    });

    return this.jdbcTemplate.queryForObject("select id from users where guid = ?", new Object[]{users.guid()}, Integer.class);
}
 
開發者ID:monkeyk,項目名稱:oauth2-shiro,代碼行數:17,代碼來源:UsersJdbcAuthzRepository.java

示例4: save

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
@Override
public void save(String graphName, String version, IPixelCut xInfo) throws GraphNotExistsException {
	Long graphVersionId = getGraphVersionId(graphName, version);
	getJdbcTemplate().update("INSERT INTO " + schema + TABLE_NAME + " (segment_id, graphversion_id, start_cut_right, start_cut_left, end_cut_right, end_cut_left) VALUES (?,?,?,?,?,?)",
		new PreparedStatementSetter() {

			@Override
			public void setValues(PreparedStatement ps) throws SQLException {
				int pos = 1;
				ps.setLong(pos++, xInfo.getSegmentId());
				ps.setLong(pos++, graphVersionId);
				ps.setDouble(pos++, xInfo.getStartCutRight());
				ps.setDouble(pos++, xInfo.getStartCutLeft());
				ps.setDouble(pos++, xInfo.getEndCutRight());
				ps.setDouble(pos++, xInfo.getEndCutLeft());
			}
			
		}
	);
}
 
開發者ID:graphium-project,項目名稱:graphium,代碼行數:21,代碼來源:PixelCutsDaoImpl.java

示例5: update

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
@Override
public void update(String graphName, String version, IPixelCut xInfo) throws GraphNotExistsException {
	Long graphVersionId = getGraphVersionId(graphName, version);
	getJdbcTemplate().update("UPDATE " + schema + TABLE_NAME + " SET start_cut_right=?, start_cut_left=?, end_cut_right=?, end_cut_left=? WHERE segment_id=? AND graphversion_id=?",
		new PreparedStatementSetter() {

			@Override
			public void setValues(PreparedStatement ps) throws SQLException {
				int pos = 1;
				ps.setDouble(pos++, xInfo.getStartCutRight());
				ps.setDouble(pos++, xInfo.getStartCutLeft());
				ps.setDouble(pos++, xInfo.getEndCutRight());
				ps.setDouble(pos++, xInfo.getEndCutLeft());
				ps.setLong(pos++, xInfo.getSegmentId());
				ps.setLong(pos++, graphVersionId);
			}
			
		}
	);
}
 
開發者ID:graphium-project,項目名稱:graphium,代碼行數:21,代碼來源:PixelCutsDaoImpl.java

示例6: save

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
@Override
public void save(String graphName, String version, IRoadDamage xInfo) throws GraphNotExistsException {
	Long graphVersionId = getGraphVersionId(graphName, version);
	getJdbcTemplate().update("INSERT INTO " + schema + TABLE_NAME + " (segment_id, graphversion_id, direction_tow, start_offset, end_offset, type) VALUES (?,?,?,?,?,?)",
		new PreparedStatementSetter() {

			@Override
			public void setValues(PreparedStatement ps) throws SQLException {
				int pos = 1;
				ps.setLong(pos++, xInfo.getSegmentId());
				ps.setLong(pos++, graphVersionId);
				ps.setBoolean(pos++, xInfo.isDirectionTow());
				ps.setDouble(pos++, xInfo.getStartOffset());
				ps.setDouble(pos++, xInfo.getEndOffset());
				ps.setString(pos++, xInfo.getType());
			}
			
		}
	);
}
 
開發者ID:graphium-project,項目名稱:graphium,代碼行數:21,代碼來源:RoadDamageDaoImpl.java

示例7: update

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
@Override
public void update(String graphName, String version, IRoadDamage xInfo) throws GraphNotExistsException {
	Long graphVersionId = getGraphVersionId(graphName, version);
	getJdbcTemplate().update("UPDATE " + schema + TABLE_NAME + " SET start_offset=?, end_offset=?, type=? WHERE segment_id=? AND direction_tow=? AND graphversion_id=?",
		new PreparedStatementSetter() {

			@Override
			public void setValues(PreparedStatement ps) throws SQLException {
				int pos = 1;
				ps.setDouble(pos++, xInfo.getStartOffset());
				ps.setDouble(pos++, xInfo.getEndOffset());
				ps.setString(pos++, xInfo.getType());
				ps.setLong(pos++, xInfo.getSegmentId());
				ps.setBoolean(pos++, xInfo.isDirectionTow());
				ps.setLong(pos++, graphVersionId);
			}
			
		}
	);
}
 
開發者ID:graphium-project,項目名稱:graphium,代碼行數:21,代碼來源:RoadDamageDaoImpl.java

示例8: doInTransaction

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
public Object doInTransaction(TransactionStatus status) {
    try {
        failedDatas.clear(); // 先清理
        processedDatas.clear();
        interceptor.transactionBegin(context, Arrays.asList(data), dbDialect);
        JdbcTemplate template = dbDialect.getJdbcTemplate();
        int affect = template.update(data.getSql(), new PreparedStatementSetter() {

            public void setValues(PreparedStatement ps) throws SQLException {
                doPreparedStatement(ps, dbDialect, lobCreator, data);
            }
        });
        interceptor.transactionEnd(context, Arrays.asList(data), dbDialect);
        return affect;
    } finally {
        lobCreator.close();
    }
}
 
開發者ID:luoyaogui,項目名稱:otter-G,代碼行數:19,代碼來源:DbLoadAction.java

示例9: getParameters

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
/**
 * 生成PreparedStatementSetter對象.
 * 
 * @return PreparedStatementSetter
 */
public PreparedStatementSetter getParameters() {
	if (list.size() == 0) {
		return null;
	}
	PreparedStatementSetter param = new PreparedStatementSetter() {
		@Override
		public void setValues(PreparedStatement pstmt) {
			try {
				StatementParameter.this.setValues(pstmt);
			}
			catch (SQLException e) {
				throw new InvalidParamDataAccessException(e);
			}
		}

	};
	return param;
}
 
開發者ID:tanhaichao,項目名稱:leopard,代碼行數:24,代碼來源:StatementParameter.java

示例10: addConfigInfo

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
public void addConfigInfo(final ConfigInfo configInfo) {
    final Timestamp time = TimeUtils.getCurrentTime();

    this.jt.update(
        "insert into config_info (data_id,group_id,content,md5,gmt_create,gmt_modified) values(?,?,?,?,?,?)",
        new PreparedStatementSetter() {
            public void setValues(PreparedStatement ps) throws SQLException {
                int index = 1;
                ps.setString(index++, configInfo.getDataId());
                ps.setString(index++, configInfo.getGroup());
                ps.setString(index++, configInfo.getContent());
                ps.setString(index++, configInfo.getMd5());
                ps.setTimestamp(index++, time);
                ps.setTimestamp(index++, time);
            }
        });
}
 
開發者ID:lysu,項目名稱:diamond,代碼行數:18,代碼來源:PersistService.java

示例11: updateConfigInfo

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
public void updateConfigInfo(final ConfigInfo configInfo) {
    final Timestamp time = TimeUtils.getCurrentTime();

    this.jt.update("update config_info set content=?,md5=?,gmt_modified=? where data_id=? and group_id=?",
        new PreparedStatementSetter() {

            public void setValues(PreparedStatement ps) throws SQLException {
                int index = 1;
                ps.setString(index++, configInfo.getContent());
                ps.setString(index++, configInfo.getMd5());
                ps.setTimestamp(index++, time);
                ps.setString(index++, configInfo.getDataId());
                ps.setString(index++, configInfo.getGroup());
            }
        });
}
 
開發者ID:lysu,項目名稱:diamond,代碼行數:17,代碼來源:PersistService.java

示例12: closeActivity

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
@Override
public void closeActivity(final String activityId, final Status orignStatus, final Status targetStatus) {
    log.info("--->start to closeActivity:{},turn status from:{} to:{}", activityId, orignStatus, targetStatus);
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {

        @Override
        protected void doInTransactionWithoutResult(TransactionStatus status) {
            jdbcTemplate.update(ActivitySqlConstance.commit_rollback_activity_by_activity_id,
                    new PreparedStatementSetter() {

                        @Override
                        public void setValues(PreparedStatement ps) throws SQLException {
                            ps.setString(1, targetStatus.name());
                            ps.setTimestamp(2, new Timestamp(new Date().getTime()));
                            ps.setString(3, activityId);
                            ps.setString(4, orignStatus.name());
                        }
                    });
        }
    });
}
 
開發者ID:adealjason,項目名稱:dtsopensource,代碼行數:22,代碼來源:LocalDTSSchedule.java

示例13: saveUser

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
@Override
public void saveUser(final User user) {
    final String sql = " insert into user_(guid,archived,create_time,email,password,username,phone) " +
            " values (?,?,?,?,?,?,?) ";
    this.jdbcTemplate.update(sql, new PreparedStatementSetter() {

        @Override
        public void setValues(PreparedStatement ps) throws SQLException {
            ps.setString(1, user.guid());
            ps.setBoolean(2, user.archived());

            ps.setTimestamp(3, Timestamp.valueOf(user.createTime()));
            ps.setString(4, user.email());

            ps.setString(5, user.password());
            ps.setString(6, user.username());

            ps.setString(7, user.phone());
        }
    });
}
 
開發者ID:yjmyzz,項目名稱:spring-oauth-server,代碼行數:22,代碼來源:UserRepositoryJdbc.java

示例14: updateUser

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
@Override
public void updateUser(final User user) {
    final String sql = " update user_ set username = ?, password = ?, phone = ?,email = ? where guid = ? ";
    this.jdbcTemplate.update(sql, new PreparedStatementSetter() {
        @Override
        public void setValues(PreparedStatement ps) throws SQLException {
            ps.setString(1, user.username());
            ps.setString(2, user.password());

            ps.setString(3, user.phone());
            ps.setString(4, user.email());

            ps.setString(5, user.guid());
        }
    });
}
 
開發者ID:yjmyzz,項目名稱:spring-oauth-server,代碼行數:17,代碼來源:UserRepositoryJdbc.java

示例15: addVisitorData

import org.springframework.jdbc.core.PreparedStatementSetter; //導入依賴的package包/類
public void addVisitorData(final VisitorData visitorData)
  {
if(visitorData!=null){
	//sysId,erpId,menuPath,visitDate,type,remark			
	jdbcTemplate.update(getInsertSql(),   
               new PreparedStatementSetter() {
           	public void setValues(PreparedStatement ps) throws SQLException {   
                ps.setInt(1, visitorData.getSystemId());	                          
                ps.setString(2, visitorData.getMenuPath());
                ps.setString(3, visitorData.getErpId());  
                ps.setTimestamp(4, new Timestamp(visitorData.getVisitDate().getTime()));   
                ps.setInt(5, Integer.parseInt(sdfdate.format(visitorData.getVisitDate())));
                ps.setInt(6, Integer.parseInt(sdfhour.format(visitorData.getVisitDate())));
                ps.setInt(7, visitorData.getPathType());
            }   
       });			
}		
  }
 
開發者ID:koolfret,項目名稱:methodstats,代碼行數:19,代碼來源:VisitorDataDao.java


注:本文中的org.springframework.jdbc.core.PreparedStatementSetter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。