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


Java AbstractLobCreatingPreparedStatementCallback类代码示例

本文整理汇总了Java中org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback的典型用法代码示例。如果您正苦于以下问题:Java AbstractLobCreatingPreparedStatementCallback类的具体用法?Java AbstractLobCreatingPreparedStatementCallback怎么用?Java AbstractLobCreatingPreparedStatementCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AbstractLobCreatingPreparedStatementCallback类属于org.springframework.jdbc.core.support包,在下文中一共展示了AbstractLobCreatingPreparedStatementCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: storeBytes

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public String storeBytes(final byte[] content) throws SQLException {
	final String sql = "INSERT INTO BDF2_BLOB_STORE(ID_,CONTENT_) VALUES (?,?)";
	final String id = this.generateId();
	int updatedRowCount = super.getJdbcTemplate().execute(
			sql,
			new AbstractLobCreatingPreparedStatementCallback(this
					.getLobHandler()) {
				@Override
				protected void setValues(
						PreparedStatement preparedstatement,
						LobCreator lobcreator) throws SQLException,
						DataAccessException {
					preparedstatement.setString(1, id);
					lobcreator.setBlobAsBytes(preparedstatement, 2, content);
				}
			});
	if (0 == updatedRowCount) {
		throw new SQLException("未能成功存储Byte");
	}
	return id;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:22,代码来源:LobStoreServiceImpl.java

示例2: updateBytes

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public void updateBytes(final String id, final byte[] content)
		throws SQLException {
	final String sql = "UPDATE BDF2_BLOB_STORE SET CONTENT_=? WHERE ID_=?";
	int updatedRowCount = super.getJdbcTemplate().execute(
			sql,
			new AbstractLobCreatingPreparedStatementCallback(this
					.getLobHandler()) {

				@Override
				protected void setValues(
						PreparedStatement preparedstatement,
						LobCreator lobcreator) throws SQLException,
						DataAccessException {
					lobcreator
							.setBlobAsBytes(preparedstatement, 1, content);
					preparedstatement.setString(2, id);

				}
			});
	if (0 == updatedRowCount) {
		throw new SQLException(String.format(
				"未能成功更新Byte[id=%s],请检查此记录是否存在", id));
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:25,代码来源:LobStoreServiceImpl.java

示例3: storeBinaryStream

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public String storeBinaryStream(final InputStream inputStream,final int contentLength) throws SQLException {
	final String sql = "INSERT INTO BDF2_BLOB_STORE (ID_,CONTENT_) VALUES (?,?)";
	final String id = this.generateId();
	int updatedRowCount = super.getJdbcTemplate().execute(
			sql,
			new AbstractLobCreatingPreparedStatementCallback(this
					.getLobHandler()) {

				@Override
				protected void setValues(
						PreparedStatement preparedstatement,
						LobCreator lobcreator) throws SQLException,
						DataAccessException {
					preparedstatement.setString(1, id);
					lobcreator.setBlobAsBinaryStream(preparedstatement, 2,
							inputStream, contentLength);
				}
			});
	if (0 == updatedRowCount) {
		throw new SQLException("未能成功存储二进制流");
	}
	return id;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:24,代码来源:LobStoreServiceImpl.java

示例4: updateBinaryStream

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public void updateBinaryStream(final String id,
		final InputStream inputStream, final int contentLength)
		throws SQLException {
	final String sql = "UPDATE BDF2_BLOB_STORE SET CONTENT_=? WHERE ID_=?";
	int updatedRowCount = super.getJdbcTemplate().execute(
			sql,
			new AbstractLobCreatingPreparedStatementCallback(this
					.getLobHandler()) {

				@Override
				protected void setValues(
						PreparedStatement preparedstatement,
						LobCreator lobcreator) throws SQLException,
						DataAccessException {
					lobcreator.setBlobAsBinaryStream(preparedstatement, 1,
							inputStream, contentLength);
					preparedstatement.setString(2, id);

				}
			});
	if (0 == updatedRowCount) {
		throw new SQLException(String.format(
				"未能成功更新Byte[id=%s],请检查此记录是否存在", id));
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:26,代码来源:LobStoreServiceImpl.java

示例5: storeString

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public String storeString(final String content) throws SQLException {
	final String sql = "INSERT INTO BDF2_CLOB_STORE (ID_,CONTENT_) VALUES(?,?)";
	final String id = this.generateId();
	int updatedRowCount = super.getJdbcTemplate().execute(
			sql,
			new AbstractLobCreatingPreparedStatementCallback(this
					.getLobHandler()) {

				@Override
				protected void setValues(
						PreparedStatement preparedstatement,
						LobCreator lobcreator) throws SQLException,
						DataAccessException {
					preparedstatement.setString(1, id);
					lobcreator.setClobAsString(preparedstatement, 2,
							content);
				}
			});
	if (0 == updatedRowCount) {
		throw new SQLException("未能成功储存大字符串");
	}
	return id;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:24,代码来源:LobStoreServiceImpl.java

示例6: updateString

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public void updateString(final String id, final String content)
		throws SQLException {
	final String sql = "UPDATE BDF2_CLOB_STORE SET CONTENT_=? WHERE ID_=?";
	int updatedRowCount = super.getJdbcTemplate().execute(
			sql,
			new AbstractLobCreatingPreparedStatementCallback(this
					.getLobHandler()) {

				@Override
				protected void setValues(
						PreparedStatement preparedstatement,
						LobCreator lobcreator) throws SQLException,
						DataAccessException {
					preparedstatement.setString(2, id);
					lobcreator.setClobAsString(preparedstatement, 1,
							content);

				}

			});
	if (0 == updatedRowCount) {
		throw new SQLException(String.format("未能成功更新大字符串[%s],请检查其是否存在", id));
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:25,代码来源:LobStoreServiceImpl.java

示例7: storeAsciiStream

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public String storeAsciiStream(final InputStream asciiStream,
		final int contentLength) throws SQLException {
	final String sql = "INSERT INTO BDF2_CLOB_STORE (ID_,CONTENT_) VALUES(?,?)";
	final String id = this.generateId();
	int updatedRowCount = super.getJdbcTemplate().execute(
			sql,
			new AbstractLobCreatingPreparedStatementCallback(this
					.getLobHandler()) {

				@Override
				protected void setValues(
						PreparedStatement preparedstatement,
						LobCreator lobcreator) throws SQLException,
						DataAccessException {
					preparedstatement.setString(1, id);
					lobcreator.setClobAsAsciiStream(preparedstatement, 2,
							asciiStream, contentLength);
				}
			});
	if (0 == updatedRowCount) {
		throw new SQLException("未能成功储存大字符串");
	}
	return id;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:25,代码来源:LobStoreServiceImpl.java

示例8: updateAsciiStream

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public void updateAsciiStream(final String id,
		final InputStream asciiStream, final int contentLength)
		throws SQLException {
	final String sql = "UPDATE BDF2_CLOB_STORE SET CONTENT_=? WHERE ID_=?";
	int updatedRowCount = super.getJdbcTemplate().execute(
			sql,
			new AbstractLobCreatingPreparedStatementCallback(this
					.getLobHandler()) {

				@Override
				protected void setValues(
						PreparedStatement preparedstatement,
						LobCreator lobcreator) throws SQLException,
						DataAccessException {
					preparedstatement.setString(2, id);
					lobcreator.setClobAsAsciiStream(preparedstatement, 1,
							asciiStream, contentLength);

				}

			});
	if (0 == updatedRowCount) {
		throw new SQLException(String.format("未能成功更新大字符串[%s],请检查其是否存在", id));
	}

}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:27,代码来源:LobStoreServiceImpl.java

示例9: storeCharacterStream

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public String storeCharacterStream(final Reader reader,
		final int contentLength) throws SQLException {
	final String sql = "INSERT INTO BDF2_CLOB_STORE (ID_,CONTENT_) VALUES(?,?)";
	final String id = this.generateId();
	int updatedRowCount = super.getJdbcTemplate().execute(
			sql,
			new AbstractLobCreatingPreparedStatementCallback(this
					.getLobHandler()) {

				@Override
				protected void setValues(
						PreparedStatement preparedstatement,
						LobCreator lobcreator) throws SQLException,
						DataAccessException {
					preparedstatement.setString(1, id);
					lobcreator.setClobAsCharacterStream(preparedstatement,
							2, reader, contentLength);
				}
			});
	if (0 == updatedRowCount) {
		throw new SQLException("未能成功储存大字符串");
	}
	return id;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:25,代码来源:LobStoreServiceImpl.java

示例10: updateCharacterStream

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public void updateCharacterStream(final String id, final Reader reader,
		final int contentLength) throws SQLException {
	final String sql = "UPDATE BDF2_CLOB_STORE SET CONTENT_=? WHERE ID_=?";
	int updatedRowCount = super.getJdbcTemplate().execute(
			sql,
			new AbstractLobCreatingPreparedStatementCallback(this
					.getLobHandler()) {

				@Override
				protected void setValues(
						PreparedStatement preparedstatement,
						LobCreator lobcreator) throws SQLException,
						DataAccessException {
					preparedstatement.setString(2, id);
					lobcreator.setClobAsCharacterStream(preparedstatement,
							1, reader, contentLength);

				}

			});
	if (0 == updatedRowCount) {
		throw new SQLException(String.format("未能成功更新大字符串[%s],请检查其是否存在", id));
	}

}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:26,代码来源:LobStoreServiceImpl.java

示例11: insertAndUpdateHelper

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
protected void insertAndUpdateHelper(final CamelContext camelContext, final String key, final Exchange exchange, String sql, final boolean idComesFirst) throws Exception {
    final byte[] data = codec.marshallExchange(camelContext, exchange, allowSerializedHeaders);
    jdbcTemplate.execute(sql,
            new AbstractLobCreatingPreparedStatementCallback(getLobHandler()) {
                @Override
                protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException {
                    int totalParameterIndex = 0;
                    lobCreator.setBlobAsBytes(ps, ++totalParameterIndex, data);
                    if (idComesFirst) {
                        ps.setString(++totalParameterIndex, key);
                    }
                    if (storeBodyAsText) {
                        ps.setString(++totalParameterIndex, exchange.getIn().getBody(String.class));
                    }
                    if (hasHeadersToStoreAsText()) {
                        for (String headerName : headersToStoreAsText) {
                            String headerValue = exchange.getIn().getHeader(headerName, String.class);
                            ps.setString(++totalParameterIndex, headerValue);
                        }
                    }
                    if (!idComesFirst) {
                        ps.setString(++totalParameterIndex, key);
                    }
                }
            });
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:JdbcAggregationRepository.java

示例12: storeImage

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
@Transactional
public void storeImage(
    final String name, final InputStream contentStream, final int contentLength, final String description)
    throws DataAccessException {

	getJdbcTemplate().execute(
			"INSERT INTO imagedb (image_name, content, description) VALUES (?, ?, ?)",
			new AbstractLobCreatingPreparedStatementCallback(this.lobHandler) {
				protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException {
					ps.setString(1, name);
					lobCreator.setBlobAsBinaryStream(ps, 2, contentStream, contentLength);
					lobCreator.setClobAsString(ps, 3, description);
				}
			}
	);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:17,代码来源:DefaultImageDatabase.java

示例13: addUploadContent

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
@Transactional(readOnly = false)
public int addUploadContent(final String digest, final long fileSize, final InputStream content,
		final String contentType) {
	LobHandler lobHandler = new DefaultLobHandler();
	return jdbc.getJdbcOperations().execute(queries.addUploadContent(),
			new AbstractLobCreatingPreparedStatementCallback(lobHandler) {

				@Override
				protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException {
					ps.setString(1, digest);
					ps.setLong(2, fileSize);
					lobCreator.setBlobAsBinaryStream(ps, 3, content, (int) fileSize);
					ps.setString(4, contentType);
				}
			});
}
 
开发者ID:digitalfondue,项目名称:lavagna,代码行数:17,代码来源:CardDataRepository.java

示例14: saveProcess

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public void saveProcess(final Process process) {
	super.saveProcess(process);
	if(process.getBytes() != null) {
		template.execute(PROCESS_UPDATE_BLOB, new AbstractLobCreatingPreparedStatementCallback(lobHandler) {
			
			protected void setValues(PreparedStatement ps, LobCreator lobCreator)
					throws SQLException, DataAccessException {
				try {
					lobCreator.setBlobAsBytes(ps, 1, process.getBytes());
					StatementCreatorUtils.setParameterValue(ps, 2, Types.VARCHAR, process.getId());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
}
 
开发者ID:snakerflow,项目名称:snakerflow,代码行数:18,代码来源:SpringJdbcAccess.java

示例15: updateProcess

import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback; //导入依赖的package包/类
public void updateProcess(final Process process) {
	super.updateProcess(process);
	if(process.getBytes() != null) {
		template.execute(PROCESS_UPDATE_BLOB, new AbstractLobCreatingPreparedStatementCallback(lobHandler) {
			
			protected void setValues(PreparedStatement ps, LobCreator lobCreator)
					throws SQLException, DataAccessException {
				try {
					lobCreator.setBlobAsBytes(ps, 1, process.getBytes());
					StatementCreatorUtils.setParameterValue(ps, 2, Types.VARCHAR, process.getId());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
}
 
开发者ID:snakerflow,项目名称:snakerflow,代码行数:18,代码来源:SpringJdbcAccess.java


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