@Override public LobCreator getLobCreator() { return Hibernate.getLobCreator( this ); }
/** * Obtain a lob creator for the given session. * * @param session The session for which to obtain a lob creator * * @return The log creator reference */ public static LobCreator getLobCreator(Session session) { return getLobCreator( (SessionImplementor) session ); }
@Test public void testLobCreation() throws SQLException { Session session = sessionFactory().getCurrentSession(); session.beginTransaction(); Blob blob = Hibernate.getLobCreator( session ).createBlob( new byte[] {} ); blob.free(); Clob clob = Hibernate.getLobCreator( session ).createClob( "Steve" ); clob.free(); session.getTransaction().commit(); assertFalse( session.isOpen() ); }
protected void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException { if ( value == null ) { st.setNull( index, sqlTypes( null )[0] ); } else { byte[] toSet = unWrap( value ); final boolean useInputStream = session.getFactory().getDialect().useInputStreamToInsertBlob(); if ( useInputStream ) { st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length ); } else { st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) ); } } }
public void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException { if ( value != null ) { byte[] toSet; toSet = toBytes( value ); if ( session.getFactory().getDialect().useInputStreamToInsertBlob() ) { st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length ); } else { st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) ); } } else { st.setNull( index, sqlTypes( null )[0] ); } }
/** * Obtain a lob creator for the given session. * * @param session The session for which to obtain a lob creator * * @return The log creator reference */ public static LobCreator getLobCreator(Session session) { return getLobCreator( (SessionImplementor) session ); }
@Override public LobCreator getLobCreator() { return Hibernate.getLobCreator( this ); }
public static LobCreator getLobCreator(Session session) { return getLobCreator( (SessionImplementor) session ); }
public LobCreator getLobCreator() { return Hibernate.getLobCreator( session ); }
public LobCreator getLobCreator() { return Hibernate.getLobCreator( session ); }
public LobCreator getLobCreator() { return Hibernate.getLobCreator( session ); }
public LobCreator getLobCreator() { return Hibernate.getLobCreator( session ); }
public static LobCreator getLobCreator(Session session) { return getLobCreator( (SessionImplementor) session ); }
public Blob createBlob(InputStream inputStream) { try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(inputStream.available()); StreamUtils.copy(inputStream, buffer); return Hibernate.getLobCreator(getSession()).createBlob(buffer.toByteArray()); } catch (Exception e) { throw new RuntimeException(e); } }
public Blob createBlob(InputStream inputStream, int length) { return Hibernate.getLobCreator(getSession()).createBlob(inputStream, length); }
public Clob createClob(String str) { return Hibernate.getLobCreator(getSession()).createClob(str); }
public void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException { if ( value != null ) { byte[] toSet; toSet = toBytes( value ); if ( session.getFactory().getDialect().useInputStreamToInsertBlob() ) { st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length ); } else { st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) ); } } else { st.setNull( index, sqlTypes( null )[0] ); } }
protected void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException { if ( value == null ) { st.setNull( index, sqlTypes( null )[0] ); } else { byte[] toSet = unWrap( value ); final boolean useInputStream = session.getFactory().getDialect().useInputStreamToInsertBlob(); if ( useInputStream ) { st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length ); } else { st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) ); } } }
public void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException { if ( value != null ) { byte[] toSet; toSet = toBytes( value ); if ( session.getFactory().getDialect().useInputStreamToInsertBlob() ) { st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length ); } else { st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) ); } } else { st.setNull( index, sqlTypes( null )[0] ); } }
protected void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException { if ( value == null ) { st.setNull( index, sqlTypes( null )[0] ); } else { byte[] toSet = unWrap( value ); final boolean useInputStream = session.getFactory().getDialect().useInputStreamToInsertBlob(); if ( useInputStream ) { st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length ); } else { st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) ); } } }