Class BlobAndClobCreator
java.lang.Object
org.hibernate.engine.jdbc.env.internal.AbstractLobCreator
org.hibernate.engine.jdbc.env.internal.BlobAndClobCreator
- All Implemented Interfaces:
LobCreator
- Direct Known Subclasses:
StandardLobCreator
LobCreator which can use Connection.createBlob() and Connection.createClob(),
but NClob references are created locally.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final LobCreationContext.Callback<Blob>Callback for performing contextual BLOB creationstatic final LobCreationContext.Callback<Clob>Callback for performing contextual CLOB creationstatic final LobCreationContext.Callback<NClob>Callback for performing contextual NCLOB creationprotected final LobCreationContextprotected final boolean -
Method Summary
Modifier and TypeMethodDescriptioncreateBlob(byte[] bytes) createBlob(InputStream stream, long length) createClob(Reader reader, long length) createClob(String string) createNClob(Reader reader, long length) Create a NCLOB reference encapsulating the given character data.createNClob(String string) Create a NCLOB reference encapsulating the given String data.toJdbcBlob(Blob blob) Obtain aBlobinstance which can be written to a JDBCPreparedStatementusingPreparedStatement.setBlob(int, Blob).toJdbcClob(Clob clob) Obtain aClobinstance which can be written to a JDBCPreparedStatementusingPreparedStatement.setClob(int, Clob).toJdbcNClob(NClob clob) Obtain anNClobinstance which can be written to a JDBCPreparedStatementusingPreparedStatement.setNClob(int, NClob).Methods inherited from class org.hibernate.engine.jdbc.env.internal.AbstractLobCreator
wrap, wrap, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.engine.jdbc.LobCreator
wrap, wrap, wrap
-
Field Details
-
CREATE_BLOB_CALLBACK
Callback for performing contextual BLOB creation -
CREATE_CLOB_CALLBACK
Callback for performing contextual CLOB creation -
CREATE_NCLOB_CALLBACK
Callback for performing contextual NCLOB creation -
lobCreationContext
-
useConnectionToCreateLob
protected final boolean useConnectionToCreateLob
-
-
Method Details
-
createBlob
- Specified by:
createBlobin interfaceLobCreator- Parameters:
bytes- The byte array to wrap as a blob.- Returns:
- The created blob, castable to
Blobas well asBlobImplementer
-
createBlob
- Specified by:
createBlobin interfaceLobCreator- Parameters:
stream- The binary stream to wrap as a blob.length- The length of the stream.- Returns:
- The created blob, castable to
Blobas well asBlobImplementer - Implementation Note:
- It's very inefficient to use JDBC LOB locator creation to create
a LOB with the contents of the given stream, since that requires
reading the whole stream. So instead just wrap the given stream,
just like what
NonContextualLobCreatordoes.
-
createClob
- Specified by:
createClobin interfaceLobCreator- Parameters:
string- The String to wrap as a clob.- Returns:
- The created clob, castable to
Clobas well asClobImplementer
-
createClob
- Specified by:
createClobin interfaceLobCreator- Parameters:
reader- The character data reader.length- The length of the reader data.- Returns:
- The created clob, castable to
Clobas well asClobImplementer - Implementation Note:
- It's very inefficient to use JDBC LOB locator creation to create
a LOB with the contents of the given stream, since that requires
reading the whole stream. So instead just wrap the given stream,
just like what
NonContextualLobCreatordoes.
-
createNClob
Description copied from interface:LobCreatorCreate a NCLOB reference encapsulating the given String data.- Specified by:
createNClobin interfaceLobCreator- Parameters:
string- The String to wrap as a NCLOB.- Returns:
- The created NCLOB, castable as
Clobas well asNClobImplementer. In JDK 1.6 environments, also castable to java.sql.NClob
-
createNClob
Description copied from interface:LobCreatorCreate a NCLOB reference encapsulating the given character data.- Specified by:
createNClobin interfaceLobCreator- Parameters:
reader- The character data reader.length- The length of the reader data.- Returns:
- The created NCLOB, castable as
Clobas well asNClobImplementer. In JDK 1.6 environments, also castable to java.sql.NClob
-
toJdbcBlob
Obtain aBlobinstance which can be written to a JDBCPreparedStatementusingPreparedStatement.setBlob(int, Blob).- Specified by:
toJdbcBlobin interfaceLobCreator- Overrides:
toJdbcBlobin classAbstractLobCreator- See Also:
-
toJdbcClob
Obtain aClobinstance which can be written to a JDBCPreparedStatementusingPreparedStatement.setClob(int, Clob).- Specified by:
toJdbcClobin interfaceLobCreator- Overrides:
toJdbcClobin classAbstractLobCreator- See Also:
-
toJdbcNClob
Obtain anNClobinstance which can be written to a JDBCPreparedStatementusingPreparedStatement.setNClob(int, NClob).- Specified by:
toJdbcNClobin interfaceLobCreator- Overrides:
toJdbcNClobin classAbstractLobCreator- See Also:
-