All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.onetwo.dbm.jdbc.spi.DbmJdbcOperations Maven / Gradle / Ivy

The newest version!
package org.onetwo.dbm.jdbc.spi;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import javax.sql.DataSource;

import org.onetwo.dbm.jdbc.DbmNamedJdbcTemplate;
import org.onetwo.dbm.jdbc.annotation.DbmJdbcArgsMark;
import org.onetwo.dbm.jdbc.annotation.DbmJdbcOperationMark;
import org.onetwo.dbm.jdbc.annotation.DbmJdbcSqlMark;
import org.onetwo.dbm.jdbc.internal.SimpleArgsPreparedStatementCreator;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.support.KeyHolder;

public interface DbmJdbcOperations /*extends JdbcOperations*/ {
	
	DbmNamedJdbcTemplate getDbmNamedJdbcOperations();
	
	@DbmJdbcOperationMark(type=DbmJdbcOperationType.QUERY)
	 T query(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark Map paramMap, ResultSetExtractor rse) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.QUERY)
	 List query(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark Map paramMap, RowMapper rowMapper) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.QUERY)
	 T queryForObject(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark Map paramMap, RowMapper rowMapper) throws DataAccessException;
	
//	 T queryForObject(String sql, Class requiredType) throws DataAccessException;
	/***
	 * 
	 * @param sql
	 * @param elementType SingleColumnRowMapper
	 * @param args
	 * @return
	 * @throws DataAccessException
	 */
	@DbmJdbcOperationMark(type=DbmJdbcOperationType.QUERY)
	 List queryForList(@DbmJdbcSqlMark String sql, Class elementType, @DbmJdbcArgsMark Object... args) throws DataAccessException;

	/***
	 * 
	 * @param sql
	 * @param requiredType SingleColumnRowMapper
	 * @param args
	 * @return
	 * @throws DataAccessException
	 */
	@DbmJdbcOperationMark(type=DbmJdbcOperationType.QUERY)
	 T queryForObject(@DbmJdbcSqlMark String sql, Class requiredType, @DbmJdbcArgsMark Object... args) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.QUERY)
	 T queryForObject(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark Object[] args, RowMapper rowMapper) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.QUERY)
	 List query(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark Object[] args, RowMapper rowMapper) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.EXECUTE)
	void execute(@DbmJdbcSqlMark String sql) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.EXECUTE)
	Object execute(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark Map paramMap) throws DataAccessException ;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.UPDATE)
	int updateWith(final SimpleArgsPreparedStatementCreator spsc, final KeyHolder generatedKeyHolder) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.UPDATE)
	int updateWith(final SimpleArgsPreparedStatementCreator spsc) throws DataAccessException;

//	@DbmJdbcOperationMark(type=DbmJdbcOperationType.UPDATE)
//	int updateWith(final SimpleArgsPreparedStatementCreator spsc, final AroundPreparedStatementExecute action) throws DataAccessException;

//	@DbmJdbcOperationMark(type=DbmJdbcOperationType.UPDATE)
//	int updateWith(String sql, Object[] args, final AroundPreparedStatementExecute action) throws DataAccessException;

	
	@DbmJdbcOperationMark(type=DbmJdbcOperationType.BATCH_UPDATE)
	int[] batchUpdate(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark List> batchValues, int processSizePerBatch) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.UPDATE)
	int update(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark Object... args) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.UPDATE)
	int update(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark Map paramMap) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.BATCH_UPDATE)
	 int[][] batchUpdateWith(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark Collection batchArgs, int batchSize) throws DataAccessException;

	@DbmJdbcOperationMark(type=DbmJdbcOperationType.BATCH_UPDATE)
	int[] batchUpdate(@DbmJdbcSqlMark String sql, @DbmJdbcArgsMark Map[] batchValues) throws DataAccessException;
	
//	void setDataSource(DataSource dataSource);

	DataSource getDataSource();
	
//	DbmNamedJdbcOperations getDbmNamedJdbcOperations();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy