/** * Create a new BLOB/CLOB value with the given stream, * using a DefaultLobHandler. * @param stream the stream containing the LOB value * @param length the length of the LOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(InputStream stream, int length) { this(stream, length, new DefaultLobHandler()); }
@Override public void afterPropertiesSet() { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); DefaultLobHandler lobHandler = new DefaultLobHandler(); lobHandler.setStreamAsLob(true); dbDialect = new MysqlDialect(jdbcTemplate, lobHandler); sqlTemplate = new MysqlSqlTemplate(); }
@Bean public JdbcOperationsSessionRepository sessionRepository() { JdbcTemplate jdbcTemplate = createJdbcTemplate(this.dataSource); JdbcOperationsSessionRepository sessionRepository = new JdbcOperationsSessionRepository( jdbcTemplate, this.transactionManager); if (StringUtils.hasText(this.tableName)) { sessionRepository.setTableName(this.tableName); } sessionRepository .setDefaultMaxInactiveInterval(this.maxInactiveIntervalInSeconds); if (this.lobHandler != null) { sessionRepository.setLobHandler(this.lobHandler); } else if (requiresTemporaryLob(this.dataSource)) { DefaultLobHandler lobHandler = new DefaultLobHandler(); lobHandler.setCreateTemporaryLob(true); sessionRepository.setLobHandler(lobHandler); } if (this.springSessionConversionService != null) { sessionRepository.setConversionService(this.springSessionConversionService); } else if (this.conversionService != null) { sessionRepository.setConversionService(this.conversionService); } else { sessionRepository .setConversionService(createConversionServiceWithBeanClassLoader()); } return sessionRepository; }
public PostgresLobHandler() { super(); DefaultLobHandler wrappedLobHandler = new DefaultLobHandler(); wrappedLobHandler.setWrapAsLob(true); this.wrappedLobHandler = wrappedLobHandler; }
public PluginVO mapRow(ResultSet rs, int rowNum) throws SQLException { URI pluginId = null; try { pluginId = new URI(DaoUtils.getStringIfPresent(rs, DEFAULT_PLUGINID_COLUMN_NAME)); } catch (Exception e) { logger.debug(e); } return new PluginVO(DaoUtils.getIntegerIfPresent(rs, DEFAULT_ID_COLUMN_NAME), DaoUtils.getStringIfPresent(rs, DEFAULT_DISPLAYNAME_COLUMN_NAME), pluginId, new Version(DaoUtils.getStringIfPresent(rs, DEFAULT_VERSION_COLUMN_NAME)), DaoUtils.getStringIfPresent(rs, DEFAULT_STATE_COLUMN_NAME), lobHandler.getBlobAsBytes(rs, DEFAULT_FILE_COLUMN_NAME), DaoUtils.getDateIfPresent(rs, DEFAULT_CHANGEDATE_COLUMN_NAME), DaoUtils.getStringIfPresent(rs, DEFAULT_ORIG_FILENAME_COLUMN_NAME)); }
/** * Create a new CLOB value with the given character stream, * using a DefaultLobHandler. * @param reader the character stream containing the CLOB value * @param length the length of the CLOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(Reader reader, int length) { this(reader, length, new DefaultLobHandler()); }
/** * Create a new BLOB value with the given byte array, * using a DefaultLobHandler. * @param bytes the byte array containing the BLOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(@Nullable byte[] bytes) { this(bytes, new DefaultLobHandler()); }
/** * Create a new CLOB value with the given content string, * using a DefaultLobHandler. * @param content the String containing the CLOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(@Nullable String content) { this(content, new DefaultLobHandler()); }
@Override public void afterPropertiesSet() throws Exception { Assert.notNull(dataSource, "DataSource must not be null."); if (jdbcOperations == null) { jdbcOperations = new JdbcTemplate(dataSource); } if (incrementerFactory == null) { incrementerFactory = new DefaultDataFieldMaxValueIncrementerFactory(dataSource); } if (databaseType == null) { databaseType = DatabaseType.fromMetaData(dataSource).name(); logger.info("No database type set, using meta data indicating: " + databaseType); } if (lobHandler == null && databaseType.equalsIgnoreCase(DatabaseType.ORACLE.toString())) { lobHandler = new DefaultLobHandler(); } if(serializer == null) { Jackson2ExecutionContextStringSerializer defaultSerializer = new Jackson2ExecutionContextStringSerializer(); serializer = defaultSerializer; } Assert.isTrue(incrementerFactory.isSupportedIncrementerType(databaseType), "'" + databaseType + "' is an unsupported database type. The supported database types are " + StringUtils.arrayToCommaDelimitedString(incrementerFactory.getSupportedIncrementerTypes())); if(lobType != null) { Assert.isTrue(isValidTypes(lobType), "lobType must be a value from the java.sql.Types class"); } super.afterPropertiesSet(); }
@Test public void testCustomLobHandler() throws Exception { factory.setDatabaseType("ORACLE"); incrementerFactory = mock(DataFieldMaxValueIncrementerFactory.class); when(incrementerFactory.isSupportedIncrementerType("ORACLE")).thenReturn(true); when(incrementerFactory.getIncrementer("ORACLE", tablePrefix + "JOB_SEQ")).thenReturn(new StubIncrementer()); when(incrementerFactory.getIncrementer("ORACLE", tablePrefix + "JOB_EXECUTION_SEQ")).thenReturn(new StubIncrementer()); when(incrementerFactory.getIncrementer("ORACLE", tablePrefix + "STEP_EXECUTION_SEQ")).thenReturn(new StubIncrementer()); factory.setIncrementerFactory(incrementerFactory); LobHandler lobHandler = new DefaultLobHandler(); factory.setLobHandler(lobHandler); factory.afterPropertiesSet(); assertEquals(lobHandler, ReflectionTestUtils.getField(factory, "lobHandler")); }
private ChannelMessageStorePreparedStatementSetter getMessageGroupPreparedStatementSetter() { return new ChannelMessageStorePreparedStatementSetter() { private SerializingConverter serializer = new SerializingConverter(); private LobHandler lobHandler = new DefaultLobHandler(); @Override public void setValues(PreparedStatement preparedStatement, Message<?> requestMessage, Object groupId, String region, boolean priorityEnabled) throws SQLException { super.setValues(preparedStatement, requestMessage, groupId, region, priorityEnabled); byte[] messageBytes = this.serializer.convert(requestMessage); this.lobHandler.getLobCreator().setBlobAsBytes(preparedStatement, 6, messageBytes); } }; }
/** * Create a new CLOB value with the given content string, * using a DefaultLobHandler. * @param content the String containing the CLOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(String content) { this(content, new DefaultLobHandler()); }
/** * Create a new CLOB value with the given character stream, * using a DefaultLobHandler. * @param reader the character stream containing the CLOB value * @param length the length of the CLOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(Reader reader, int length) { this(reader, length, new DefaultLobHandler()); }
/** * Create a new BLOB value with the given byte array, * using a DefaultLobHandler. * @param bytes the byte array containing the BLOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(byte[] bytes) { this(bytes, new DefaultLobHandler()); }
/** * Create a new BLOB/CLOB value with the given stream, * using a DefaultLobHandler. * @param stream the stream containing the LOB value * @param length the length of the LOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(InputStream stream, int length) { this(stream, length, new DefaultLobHandler()); }
/** * Create a new CLOB value with the given character stream, * using a DefaultLobHandler. * @param reader the character stream containing the CLOB value * @param length the length of the CLOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(Reader reader, int length) { this(reader, length, new DefaultLobHandler()); }
public SymmetricLobHandler() { super(); this.lobHandler = new DefaultLobHandler(); }
public CasDeserializerRowMapper(JCas nextCas) { this.nextCas = nextCas; this.lobHandler = new DefaultLobHandler(); }
/** * Create a new BLOB/CLOB value with the given stream, * using a DefaultLobHandler. * @param stream the stream containing the LOB value * @param length the length of the LOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(InputStream stream, int length) { this(stream, length, new DefaultLobHandler()); }
/** * Create a new BLOB value with the given byte array, * using a DefaultLobHandler. * @param bytes the byte array containing the BLOB value * @see org.springframework.jdbc.support.lob.DefaultLobHandler */ public SqlLobValue(@Nullable byte[] bytes) { this(bytes, new DefaultLobHandler()); }