当前位置: 首页>>代码示例>>Java>>正文


Java JdbcOperations.queryForList方法代码示例

本文整理汇总了Java中org.springframework.jdbc.core.JdbcOperations.queryForList方法的典型用法代码示例。如果您正苦于以下问题:Java JdbcOperations.queryForList方法的具体用法?Java JdbcOperations.queryForList怎么用?Java JdbcOperations.queryForList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.jdbc.core.JdbcOperations的用法示例。


在下文中一共展示了JdbcOperations.queryForList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMapList

import org.springframework.jdbc.core.JdbcOperations; //导入方法依赖的package包/类
/**
 * return a map of the objects, divided into their transactions indexes.
 *
 * @param jdbcOperations
 *            the jdbc operations to use.
 * @param sqlKey
 *            the sql key to use.
 * @param sqlArgsBaList
 *            the byte arrays to use for SQL arguments.
 * @param mapToObject
 *            the mapToObject to use.
 * @param <T>
 *            the object type to use.
 * @return a map of the objects, divided into their transactions indexes.
 */
private <T> Map<Integer, List<T>> getMapList(final JdbcOperations jdbcOperations, final String sqlKey,
		final AbstractMapToObject<T> mapToObject, final byte[]... sqlArgsBaList) {
	final String sql = getSql(sqlKey);

	final List<Map<String, Object>> mapList = jdbcOperations.queryForList(sql, (Object[]) sqlArgsBaList);

	final Map<Integer, List<T>> tMapList = new TreeMap<>();
	for (final Map<String, Object> map : mapList) {
		final byte[] transactionIndexBa = (byte[]) map.get(TRANSACTION_INDEX);
		final T t = mapToObject.toObject(map);
		final int transactionIndex = getTransactionIndex(transactionIndexBa);
		if (!tMapList.containsKey(transactionIndex)) {
			tMapList.put(transactionIndex, new ArrayList<>());
		}
		tMapList.get(transactionIndex).add(t);
	}

	return tMapList;
}
 
开发者ID:coranos,项目名称:neo-java,代码行数:35,代码来源:BlockDbH2Impl.java

示例2: getCurrentSequence

import org.springframework.jdbc.core.JdbcOperations; //导入方法依赖的package包/类
/**
 * Return current sequence.
 */
protected int getCurrentSequence(final String sequenceName, final JdbcOperations jdbcTemplate) {
	final Long currentSequence;
	final List<Long> sequence = jdbcTemplate
			.queryForList("SELECT SEQ_ID FROM SEQUENCE_VALUE_ITEM WHERE SEQ_NAME = ?", Long.class, sequenceName);
	if (sequence.isEmpty()) {
		// New sequence, start from an arbitrary sequence to be sure JIRA
		// does not fill it
		currentSequence = 10000L;
		jdbcTemplate.update("INSERT INTO SEQUENCE_VALUE_ITEM (SEQ_NAME,SEQ_ID) values(?,?)", sequenceName,
				currentSequence);
	} else {
		currentSequence = sequence.get(0);
	}
	return currentSequence.intValue();
}
 
开发者ID:ligoj,项目名称:plugin-bt-jira,代码行数:19,代码来源:JiraUpdateDao.java


注:本文中的org.springframework.jdbc.core.JdbcOperations.queryForList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。