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 LobCreationContext
protected 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 aBlob
instance which can be written to a JDBCPreparedStatement
usingPreparedStatement.setBlob(int, Blob)
.toJdbcClob
(Clob clob) Obtain aClob
instance which can be written to a JDBCPreparedStatement
usingPreparedStatement.setClob(int, Clob)
.toJdbcNClob
(NClob clob) Obtain anNClob
instance which can be written to a JDBCPreparedStatement
usingPreparedStatement.setNClob(int, NClob)
.Methods inherited from class org.hibernate.engine.jdbc.env.internal.AbstractLobCreator
wrap, wrap, wrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
createBlob
in interfaceLobCreator
- Parameters:
bytes
- The byte array to wrap as a blob.- Returns:
- The created blob, castable to
Blob
as well asBlobImplementer
-
createBlob
- Specified by:
createBlob
in interfaceLobCreator
- Parameters:
stream
- The binary stream to wrap as a blob.length
- The length of the stream.- Returns:
- The created blob, castable to
Blob
as 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
NonContextualLobCreator
does.
-
createClob
- Specified by:
createClob
in interfaceLobCreator
- Parameters:
string
- The String to wrap as a clob.- Returns:
- The created clob, castable to
Clob
as well asClobImplementer
-
createClob
- Specified by:
createClob
in interfaceLobCreator
- Parameters:
reader
- The character data reader.length
- The length of the reader data.- Returns:
- The created clob, castable to
Clob
as 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
NonContextualLobCreator
does.
-
createNClob
Description copied from interface:LobCreator
Create a NCLOB reference encapsulating the given String data.- Specified by:
createNClob
in interfaceLobCreator
- Parameters:
string
- The String to wrap as a NCLOB.- Returns:
- The created NCLOB, castable as
Clob
as well asNClobImplementer
. In JDK 1.6 environments, also castable to java.sql.NClob
-
createNClob
Description copied from interface:LobCreator
Create a NCLOB reference encapsulating the given character data.- Specified by:
createNClob
in interfaceLobCreator
- Parameters:
reader
- The character data reader.length
- The length of the reader data.- Returns:
- The created NCLOB, castable as
Clob
as well asNClobImplementer
. In JDK 1.6 environments, also castable to java.sql.NClob
-
toJdbcBlob
Obtain aBlob
instance which can be written to a JDBCPreparedStatement
usingPreparedStatement.setBlob(int, Blob)
.- Specified by:
toJdbcBlob
in interfaceLobCreator
- Overrides:
toJdbcBlob
in classAbstractLobCreator
- See Also:
-
toJdbcClob
Obtain aClob
instance which can be written to a JDBCPreparedStatement
usingPreparedStatement.setClob(int, Clob)
.- Specified by:
toJdbcClob
in interfaceLobCreator
- Overrides:
toJdbcClob
in classAbstractLobCreator
- See Also:
-
toJdbcNClob
Obtain anNClob
instance which can be written to a JDBCPreparedStatement
usingPreparedStatement.setNClob(int, NClob)
.- Specified by:
toJdbcNClob
in interfaceLobCreator
- Overrides:
toJdbcNClob
in classAbstractLobCreator
- See Also:
-