日期:2014-05-16 浏览次数:20490 次
private LobHandler lobHandler; public LobHandler getLobHandler() { return lobHandler; } public void setLobHandler(LobHandler lobHandler) { this.lobHandler = lobHandler; } @Override @Transactional public int uploadSysFile(final DataInputStream file,final int version,final String name,final int formDataLength) throws Exception { getJdbcTemplate().execute("update t_pos_file t set t.value =? ,t.ver = ? where t.name = ? ", new AbstractLobCreatingPreparedStatementCallback(lobHandler) { @Override protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException, DataAccessException { lobCreator.setBlobAsBinaryStream(ps, 1, file,formDataLength); ps.setInt(2, version+1); ps.setString(3, name); }} ); file.close(); return 0; }
<bean id="busiDAO" class="com.zysoft.busi.dao.impl.BusiDAOImpl"> <property name="dataSource" ref="dataSource" /> <property name="lobHandler" ref="lobHandler"/> </bean>