本文整理了Java中org.hibernate.cfg.Environment.useStreamsForBinary()
方法的一些代码示例,展示了Environment.useStreamsForBinary()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.useStreamsForBinary()
方法的具体详情如下:
包路径:org.hibernate.cfg.Environment
类名称:Environment
方法名:useStreamsForBinary
[英]Should we use streams to bind binary types to JDBC IN parameters?
[中]我们应该在参数中使用streams将二进制类型绑定到JDBC吗?
代码示例来源:origin: hibernate/hibernate-orm
@Override
public boolean useStreamForLobBinding() {
if ( useStreamForLobBinding == null ) {
useStreamForLobBinding = Environment.useStreamsForBinary()
|| getJdbcServices().getJdbcEnvironment().getDialect().useInputStreamToInsertBlob();
}
return useStreamForLobBinding;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public boolean useStreamForLobBinding() {
return Environment.useStreamsForBinary();
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public boolean useStreamForLobBinding() {
return Environment.useStreamsForBinary();
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public boolean useStreamForLobBinding() {
return Environment.useStreamsForBinary();
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public boolean useStreamForLobBinding() {
return Environment.useStreamsForBinary();
}
代码示例来源:origin: hibernate/hibernate
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
if ( Environment.useStreamsForBinary() ) {
st.setBinaryStream( index, new ByteArrayInputStream( (byte[]) value ), ( (byte[]) value ).length );
}
else {
st.setBytes( index, (byte[]) value );
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
byte[] internalValue = toInternalFormat( value );
if ( Environment.useStreamsForBinary() ) {
st.setBinaryStream( index, new ByteArrayInputStream( internalValue ), internalValue.length );
}
else {
st.setBytes( index, internalValue );
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
byte[] internalValue = toInternalFormat( value );
if ( Environment.useStreamsForBinary() ) {
st.setBinaryStream( index, new ByteArrayInputStream( internalValue ), internalValue.length );
}
else {
st.setBytes( index, internalValue );
}
}
代码示例来源:origin: hibernate/hibernate
public Object get(ResultSet rs, String name) throws HibernateException, SQLException {
if ( Environment.useStreamsForBinary() ) {
InputStream inputStream = rs.getBinaryStream(name);
if (inputStream==null) return null; // is this really necessary?
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(2048);
byte[] buffer = new byte[2048];
try {
while (true) {
int amountRead = inputStream.read(buffer);
if (amountRead == -1) {
break;
}
outputStream.write(buffer, 0, amountRead);
}
inputStream.close();
outputStream.close();
}
catch (IOException ioe) {
throw new HibernateException( "IOException occurred reading a binary value", ioe );
}
return outputStream.toByteArray();
}
else {
return rs.getBytes(name);
}
}
代码示例来源:origin: org.jasypt/jasypt-hibernate4
public void nullSafeSet(final PreparedStatement st, final Object value, final int index,
final SessionImplementor session)
throws HibernateException, SQLException {
checkInitialization();
if (value == null) {
st.setNull(index, sqlType);
} else {
final byte[] encryptedValue = this.encryptor.encrypt((byte[]) value);
if (Environment.useStreamsForBinary()) {
st.setBinaryStream(
index,
new ByteArrayInputStream(encryptedValue),
encryptedValue.length);
} else {
st.setBytes(index, encryptedValue);
}
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public Object get(ResultSet rs, String name) throws HibernateException, SQLException {
if ( Environment.useStreamsForBinary() ) {
InputStream inputStream = rs.getBinaryStream(name);
if (inputStream==null) return toExternalFormat( null ); // is this really necessary?
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(2048);
byte[] buffer = new byte[2048];
try {
while (true) {
int amountRead = inputStream.read(buffer);
if (amountRead == -1) {
break;
}
outputStream.write(buffer, 0, amountRead);
}
inputStream.close();
outputStream.close();
}
catch (IOException ioe) {
throw new HibernateException( "IOException occurred reading a binary value", ioe );
}
return toExternalFormat( outputStream.toByteArray() );
}
else {
return toExternalFormat( rs.getBytes(name) );
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public Object get(ResultSet rs, String name) throws HibernateException, SQLException {
if ( Environment.useStreamsForBinary() ) {
InputStream inputStream = rs.getBinaryStream(name);
if (inputStream==null) return toExternalFormat( null ); // is this really necessary?
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(2048);
byte[] buffer = new byte[2048];
try {
while (true) {
int amountRead = inputStream.read(buffer);
if (amountRead == -1) {
break;
}
outputStream.write(buffer, 0, amountRead);
}
inputStream.close();
outputStream.close();
}
catch (IOException ioe) {
throw new HibernateException( "IOException occurred reading a binary value", ioe );
}
return toExternalFormat( outputStream.toByteArray() );
}
else {
return toExternalFormat( rs.getBytes(name) );
}
}
代码示例来源:origin: org.jasypt/jasypt-hibernate4
if (Environment.useStreamsForBinary()) {
代码示例来源:origin: org.hibernate.orm/hibernate-core
@Override
public boolean useStreamForLobBinding() {
if ( useStreamForLobBinding == null ) {
useStreamForLobBinding = Environment.useStreamsForBinary()
|| getJdbcServices().getJdbcEnvironment().getDialect().useInputStreamToInsertBlob();
}
return useStreamForLobBinding;
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
if ( Environment.useStreamsForBinary() ) {
typeContributions.contributeSqlTypeDescriptor( BlobSqlDescriptor.STREAM_BINDING );
typeContributions.contributeSqlTypeDescriptor( ClobSqlDescriptor.STREAM_BINDING );
内容来源于网络,如有侵权,请联系作者删除!