当前位置: 首页>>代码示例>>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;未经允许,请勿转载。