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


Java DefaultLobHandler类代码示例

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


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

示例1: addExternalIds

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
private void addExternalIds() {
  FudgeMsgEnvelope env = s_fudgeContext.toFudgeMsg(ExternalId.of("A", "B"));
  byte[] bytes = s_fudgeContext.toByteArray(env.getMessage());
  String cls = ExternalId.class.getName();
  LobHandler lobHandler = new DefaultLobHandler();
  final JdbcOperations template = _cfgMaster.getDbConnector().getJdbcOperations();
  template.update("INSERT INTO cfg_config VALUES (?,?,?,?,?, ?,?,?,?)",
      101, 101, toSqlTimestamp(_version1aInstant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1aInstant), MAX_SQL_TIMESTAMP, "TestConfig101", cls,
      new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
  template.update("INSERT INTO cfg_config VALUES (?,?,?,?,?, ?,?,?,?)",
      102, 102, toSqlTimestamp(_version1bInstant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1bInstant), MAX_SQL_TIMESTAMP, "TestConfig102", cls,
      new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
  template.update("INSERT INTO cfg_config VALUES (?,?,?,?,?, ?,?,?,?)",
      201, 201, toSqlTimestamp(_version1cInstant), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version1cInstant), MAX_SQL_TIMESTAMP, "TestConfig201", cls,
      new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
  template.update("INSERT INTO cfg_config VALUES (?,?,?,?,?, ?,?,?,?)",
      202, 201, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, "TestConfig202", cls,
      new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
  _totalExternalIds = 3;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:21,代码来源:AbstractDbConfigMasterWorkerTest.java

示例2: addExternalIdBundles

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
private void addExternalIdBundles() {
  FudgeMsgEnvelope env = s_fudgeContext.toFudgeMsg(ExternalIdBundle.of(ExternalId.of("C", "D"), ExternalId.of("E", "F")));
  byte[] bytes = s_fudgeContext.toByteArray(env.getMessage());
  String cls = ExternalIdBundle.class.getName();
  LobHandler lobHandler = new DefaultLobHandler();
  final JdbcOperations template = _cfgMaster.getDbConnector().getJdbcOperations();
  template.update("INSERT INTO cfg_config VALUES (?,?,?,?,?, ?,?,?,?)",
      301, 301, toSqlTimestamp(_version1aInstant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1aInstant), MAX_SQL_TIMESTAMP, "TestConfig301", cls,
      new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
  template.update("INSERT INTO cfg_config VALUES (?,?,?,?,?, ?,?,?,?)",
      302, 302, toSqlTimestamp(_version1bInstant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version1bInstant), MAX_SQL_TIMESTAMP, "TestConfig302", cls,
      new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
  template.update("INSERT INTO cfg_config VALUES (?,?,?,?,?, ?,?,?,?)",
      401, 401, toSqlTimestamp(_version1cInstant), toSqlTimestamp(_version2Instant), toSqlTimestamp(_version1cInstant), MAX_SQL_TIMESTAMP, "TestConfig401", cls,
      new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
  template.update("INSERT INTO cfg_config VALUES (?,?,?,?,?, ?,?,?,?)",
      402, 401, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, toSqlTimestamp(_version2Instant), MAX_SQL_TIMESTAMP, "TestConfig402", cls,
      new SqlParameterValue(Types.BLOB, new SqlLobValue(bytes, lobHandler)));
  _totalBundles = 3;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:21,代码来源:AbstractDbConfigMasterWorkerTest.java

示例3: addUploadContent

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的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

示例4: insertFile

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
public String insertFile(UploadBase64FileModification file) {
    String digest = DigestUtils.sha256Hex(file.getFile());

    if(Integer.valueOf(1).equals(repository.isPresent(digest))) {
        return digest;
    }

    LobHandler lobHandler = new DefaultLobHandler();


    jdbc.getJdbcOperations().execute(repository.uploadTemplate(),
        new AbstractLobCreatingPreparedStatementCallback(lobHandler) {
            @Override
            protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException {
                ps.setString(1, digest);
                ps.setString(2, file.getName());
                ps.setLong(3, file.getFile().length);
                lobCreator.setBlobAsBytes(ps, 4, file.getFile());
                ps.setString(5, file.getType());
                ps.setString(6, Json.GSON.toJson(getAttributes(file)));
            }
        });
    return digest;
}
 
开发者ID:alfio-event,项目名称:alf.io,代码行数:25,代码来源:FileUploadManager.java

示例5: saveResource

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
public int saveResource(int organizationId, int eventId, UploadBase64FileModification file) {
    if (hasResource(organizationId, eventId, file.getName())) {
        uploadedResourceRepository.delete(organizationId, eventId, file.getName());
    }
    LobHandler lobHandler = new DefaultLobHandler();
    return jdbc.getJdbcOperations().execute(uploadedResourceRepository.uploadTemplate(organizationId, eventId, file.getName()),
        new AbstractLobCreatingPreparedStatementCallback(lobHandler) {
            @Override
            protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException {
                ps.setInt(2, organizationId);
                ps.setInt(3, eventId);
                setFileValues(ps, lobCreator, file, 3);
            }
        });

}
 
开发者ID:alfio-event,项目名称:alf.io,代码行数:17,代码来源:UploadedResourceManager.java

示例6: writeConfiguration

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
/**
 * @param serviceID ID of the service for which the configuration will be
 * inserted
 * @param configurationXMLRepresentation the used MELA configuration to be
 * persisted in XML and reused
 */
public void writeConfiguration(final String serviceID, final ConfigurationXMLRepresentation configurationXMLRepresentation) {
    final StringWriter stringWriter = new StringWriter();
    try {
        JAXBContext context = JAXBContext.newInstance(ConfigurationXMLRepresentation.class);
        context.createMarshaller().marshal(configurationXMLRepresentation, stringWriter);

    } catch (JAXBException e) {
        log.warn("Cannot marshal configuration into string: " + e);
        return;

    }

    String sql = "INSERT INTO Configuration (monSeqID, configuration) " + "VALUES (?, ?)";

    jdbcTemplate.execute(sql, new AbstractLobCreatingPreparedStatementCallback(new DefaultLobHandler()) {
        protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException {
            ps.setString(1, serviceID);
            lobCreator.setClobAsString(ps, 2, stringWriter.toString());
        }
    });
}
 
开发者ID:tuwiendsg,项目名称:MELA,代码行数:28,代码来源:PersistenceSQLAccess.java

示例7: createDefaultLobHandler

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
/**
 * 创建一个通用的的LobHandler,但对SqlServer数据库做了特殊处理.
 * 
 * @param productName
 *            数据库驱动的名称
 * @return 返回DefaultLobHandler对象
 */
private DefaultLobHandler createDefaultLobHandler(String productName) {
	DefaultLobHandler defaultLobHandler = new DefaultLobHandler();
	// 为支持sqljdbc4的处理方式,需要将其大对象流包装到BLOB/CLOB里,否则流将被自动关闭
	if (StringUtils.containsIgnoreCase(productName, SQLSERVER)) {
		defaultLobHandler.setWrapAsLob(true);
	}
	return defaultLobHandler;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:16,代码来源:LobStoreServiceImpl.java

示例8: initInMemoryDatabaseAndTemplate

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
@Before
public void initInMemoryDatabaseAndTemplate() {
	EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
	db = builder.setType(EmbeddedDatabaseType.H2).addScript(PATH_TO_SCRIPT_CREATE_TABLE).addScript(PATH_TO_SCRIPT_FILL_DATA).build();
	LobHandler lobHandler = new DefaultLobHandler();
	templateUnderTest = new SpringJdbcTemplateSamlClientDaoImpl(db, lobHandler, TABLE_NAME, ENVIRONMENT);
}
 
开发者ID:jkacer,项目名称:pac4j-extensions,代码行数:8,代码来源:SpringJdbcTemplateSamlClientDaoImplTest.java

示例9: getBlobAsBytes

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
public byte[] getBlobAsBytes() {
    return (byte[]) getJdbcTemplate().queryForObject(getSql(), getParams(null), new RowMapper<byte[]>() {
        @Override
        public byte[] mapRow(ResultSet rs, int rowNum) throws SQLException {
            return new DefaultLobHandler().getBlobAsBytes(rs, 1);
        }
    });
}
 
开发者ID:nortal,项目名称:petit,代码行数:9,代码来源:LoadStatement.java

示例10: getBlobAsBinaryStream

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
public InputStream getBlobAsBinaryStream(final String columnName) {
    return (InputStream) getJdbcTemplate().queryForObject(getSql(), getParams(null), new RowMapper<InputStream>() {
        @Override
        public InputStream mapRow(ResultSet rs, int rowNum) throws SQLException {
            return new DefaultLobHandler().getBlobAsBinaryStream(rs, columnName);
        }
    });
}
 
开发者ID:nortal,项目名称:petit,代码行数:9,代码来源:LoadStatement.java

示例11: JbpmClobStringType

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
public JbpmClobStringType() {
	super(new DefaultLobHandler(), null);
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:4,代码来源:JbpmClobStringType.java

示例12: lobHandler

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
@Bean
public LobHandler lobHandler() {
    DefaultLobHandler defaultLobHandler = new DefaultLobHandler();
    defaultLobHandler.setStreamAsLob(true);
    return defaultLobHandler;
}
 
开发者ID:bhits,项目名称:context-handler,代码行数:7,代码来源:ApplicationContextConfig.java

示例13: PluginDAOMysqlImpl

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
public PluginDAOMysqlImpl(DataSource dataSource) {
    setDataSource(dataSource);
    lobHandler = new DefaultLobHandler();
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:5,代码来源:PluginDAOMysqlImpl.java

示例14: getLobHandler

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
@Override
public LobHandler getLobHandler() {
  DefaultLobHandler handler = new DefaultLobHandler();
  handler.setWrapAsLob(true);
  return handler;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:7,代码来源:HSQLDbDialect.java

示例15: getLobHandler

import org.springframework.jdbc.support.lob.DefaultLobHandler; //导入依赖的package包/类
@Override
public LobHandler getLobHandler() {
  DefaultLobHandler handler = new DefaultLobHandler();
  handler.setWrapAsLob(false);
  return handler;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:7,代码来源:Oracle11gDbDialect.java


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