java.sql.Blob
and java.sql.Clob instances in the API, as some JDBC drivers
do not support these types as such.
The LOB creation part is where LobHandler implementations usually
differ. Possible strategies include usage of
PreparedStatement.setBinaryStream/setCharacterStream but also
PreparedStatement.setBlob/setClob with either a stream argument or
java.sql.Blob/Clob wrapper objects.
A LobCreator represents a session for creating BLOBs: It is not thread-safe and needs to be instantiated for each statement execution or for each transaction. Each LobCreator needs to be closed after completion.
For convenient working with a PreparedStatement and a LobCreator,
consider using org. with an
org.
implementation. See the latter's javadoc for details.
close(), LobHandler#getLobCreator(), DefaultLobHandler.DefaultLobCreator , java.sql.PreparedStatement#setBlob , java.sql.PreparedStatement#setClob , java.sql.PreparedStatement#setBytes , java.sql.PreparedStatement#setBinaryStream , java.sql.PreparedStatement#setString , java.sql.PreparedStatement#setAsciiStream , java.sql.PreparedStatement#setCharacterStream
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Redeclares java. |
| public void | setBlobAsBinaryStream(PreparedStatement
the PreparedStatement to the set the content on ps, int the parameter index to use paramIndex, InputStream the content as binary stream, or contentStream, int contentLength)null for SQL NULLSet the given content as binary stream on the given statement, using the given parameter index. |
| public void | setBlobAsBytes(PreparedStatement
the PreparedStatement to the set the content on ps, int the parameter index to use paramIndex, byte[] the content as byte array, or content)null for SQL NULLSet the given content as bytes on the given statement, using the given parameter index. |
| public void | setClobAsAsciiStream(PreparedStatement
the PreparedStatement to the set the content on ps, int the parameter index to use paramIndex, InputStream the content as ASCII stream, or asciiStream, int contentLength)null for SQL NULLSet the given content as ASCII stream on the given statement, using the given parameter index. |
| public void | setClobAsCharacterStream(PreparedStatement
the PreparedStatement to the set the content on ps, int the parameter index to use paramIndex, Reader the content as character stream, or characterStream, int contentLength)null for SQL NULLSet the given content as character stream on the given statement, using the given parameter index. |
| public void | setClobAsString(PreparedStatement
the PreparedStatement to the set the content on ps, int the parameter index to use paramIndex, String the content as String, or content)null for SQL NULLSet the given content as String on the given statement, using the given parameter index. |
| close | back to summary |
|---|---|
| public void close() Redeclares java. Close this LobCreator session and free its temporarily created BLOBs and CLOBs. Will not need to do anything if using PreparedStatement's standard methods, but might be necessary to free database resources if using proprietary means. Note Needs to be invoked after the involved PreparedStatements have been executed or the affected O/R mapping sessions have been flushed. Otherwise, the database resources for the temporary BLOBs might stay allocated.
| |
| setBlobAsBinaryStream | back to summary |
|---|---|
| public void setBlobAsBinaryStream(PreparedStatement ps, int paramIndex, InputStream contentStream, int contentLength) throws SQLException Set the given content as binary stream on the given statement, using the given
parameter index. Might simply invoke
| |
| setBlobAsBytes | back to summary |
|---|---|
| public void setBlobAsBytes(PreparedStatement ps, int paramIndex, byte[] content) throws SQLException Set the given content as bytes on the given statement, using the given
parameter index. Might simply invoke
| |
| setClobAsAsciiStream | back to summary |
|---|---|
| public void setClobAsAsciiStream(PreparedStatement ps, int paramIndex, InputStream asciiStream, int contentLength) throws SQLException Set the given content as ASCII stream on the given statement, using the given
parameter index. Might simply invoke
| |
| setClobAsCharacterStream | back to summary |
|---|---|
| public void setClobAsCharacterStream(PreparedStatement ps, int paramIndex, Reader characterStream, int contentLength) throws SQLException Set the given content as character stream on the given statement, using the given
parameter index. Might simply invoke
| |
| setClobAsString | back to summary |
|---|---|
| public void setClobAsString(PreparedStatement ps, int paramIndex, String content) throws SQLException Set the given content as String on the given statement, using the given
parameter index. Might simply invoke
| |