Top Description Inners Constructors Methods
org.springframework.jdbc.support.xml

public Class Jdbc4SqlXmlHandler

extends Object
implements SqlXmlHandler
Class Inheritance
All Implemented Interfaces
org.springframework.jdbc.support.xml.SqlXmlHandler
Imports
java.io.IOException, .InputStream, .Reader, java.sql.PreparedStatement, .ResultSet, .SQLException, .SQLXML, javax.xml.transform.Result, .Source, javax.xml.transform.dom.DOMResult, .DOMSource, org.w3c.dom.Document, org.springframework.dao.DataAccessResourceFailureException, org.springframework.lang.Nullable

Default implementation of the SqlXmlHandler interface. Provides database-specific implementations for storing and retrieving XML documents to and from fields in a database, relying on the JDBC 4.0 java.sql.SQLXML facility.
Authors
Thomas Risberg, Juergen Hoeller
Since
2.5.6
See Also
java.sql.SQLXML, java.sql.ResultSet#getSQLXML, java.sql.PreparedStatement#setSQLXML

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
Jdbc4SqlXmlHandler.AbstractJdbc4SqlXmlValue

Internal base class for SqlXmlValue implementations.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public InputStream
getXmlAsBinaryStream(ResultSet
the ResultSet to retrieve the content from
rs
,
String
the column name to use
columnName
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsBinaryStream.

Retrieve the given column as binary stream from the given ResultSet.

public InputStream
getXmlAsBinaryStream(ResultSet
the ResultSet to retrieve the content from
rs
,
int
the column index to use
columnIndex
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsBinaryStream.

Retrieve the given column as binary stream from the given ResultSet.

public Reader
getXmlAsCharacterStream(ResultSet
the ResultSet to retrieve the content from
rs
,
String
the column name to use
columnName
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsCharacterStream.

Retrieve the given column as character stream from the given ResultSet.

public Reader
getXmlAsCharacterStream(ResultSet
the ResultSet to retrieve the content from
rs
,
int
the column index to use
columnIndex
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsCharacterStream.

Retrieve the given column as character stream from the given ResultSet.

public Source
getXmlAsSource(ResultSet
the ResultSet to retrieve the content from
rs
,
String
the column name to use
columnName
,
Class<? extends Source>
the implementation class to be used
sourceClass
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsSource.

Retrieve the given column as Source implemented using the specified source class from the given ResultSet.

public Source
getXmlAsSource(ResultSet
the ResultSet to retrieve the content from
rs
,
int
the column index to use
columnIndex
,
Class<? extends Source>
the implementation class to be used
sourceClass
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsSource.

Retrieve the given column as Source implemented using the specified source class from the given ResultSet.

public String
getXmlAsString(ResultSet
the ResultSet to retrieve the content from
rs
,
String
the column name to use
columnName
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsString.

Retrieve the given column as String from the given ResultSet.

public String
getXmlAsString(ResultSet
the ResultSet to retrieve the content from
rs
,
int
the column index to use
columnIndex
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsString.

Retrieve the given column as String from the given ResultSet.

public SqlXmlValue
newSqlXmlValue(final String
the XML String value providing XML data
value
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

public SqlXmlValue
newSqlXmlValue(final XmlBinaryStreamProvider
the XmlBinaryStreamProvider providing XML data
provider
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

public SqlXmlValue
newSqlXmlValue(final XmlCharacterStreamProvider
the XmlCharacterStreamProvider providing XML data
provider
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

public SqlXmlValue
newSqlXmlValue(final Class<? extends Result>
the Result implementation class to be used
resultClass
,
final XmlResultProvider
the XmlResultProvider that will provide the XML data
provider
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

public SqlXmlValue
newSqlXmlValue(final Document
the XML Document to be used
document
)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Jdbc4SqlXmlHandlerback to summary
public Jdbc4SqlXmlHandler()

Method Detail

getXmlAsBinaryStreamback to summary
public InputStream getXmlAsBinaryStream(ResultSet rs, String columnName) throws SQLException

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsBinaryStream.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsBinaryStream.

Retrieve the given column as binary stream from the given ResultSet.

Might simply invoke ResultSet.getAsciiStream or work with SQLXML or database-specific classes depending on the database and driver.

Parameters
rs:ResultSet

the ResultSet to retrieve the content from

columnName:String

the column name to use

Returns:InputStream

the content as a binary stream, or null in case of SQL NULL

Annotations
@Override
@Nullable
Exceptions
SQLException:
if thrown by JDBC methods
getXmlAsBinaryStreamback to summary
public InputStream getXmlAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsBinaryStream.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsBinaryStream.

Retrieve the given column as binary stream from the given ResultSet.

Might simply invoke ResultSet.getAsciiStream or work with SQLXML or database-specific classes depending on the database and driver.

Parameters
rs:ResultSet

the ResultSet to retrieve the content from

columnIndex:int

the column index to use

Returns:InputStream

the content as binary stream, or null in case of SQL NULL

Annotations
@Override
@Nullable
Exceptions
SQLException:
if thrown by JDBC methods
getXmlAsCharacterStreamback to summary
public Reader getXmlAsCharacterStream(ResultSet rs, String columnName) throws SQLException

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsCharacterStream.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsCharacterStream.

Retrieve the given column as character stream from the given ResultSet.

Might simply invoke ResultSet.getCharacterStream or work with SQLXML or database-specific classes depending on the database and driver.

Parameters
rs:ResultSet

the ResultSet to retrieve the content from

columnName:String

the column name to use

Returns:Reader

the content as character stream, or null in case of SQL NULL

Annotations
@Override
@Nullable
Exceptions
SQLException:
if thrown by JDBC methods
getXmlAsCharacterStreamback to summary
public Reader getXmlAsCharacterStream(ResultSet rs, int columnIndex) throws SQLException

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsCharacterStream.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsCharacterStream.

Retrieve the given column as character stream from the given ResultSet.

Might simply invoke ResultSet.getCharacterStream or work with SQLXML or database-specific classes depending on the database and driver.

Parameters
rs:ResultSet

the ResultSet to retrieve the content from

columnIndex:int

the column index to use

Returns:Reader

the content as character stream, or null in case of SQL NULL

Annotations
@Override
@Nullable
Exceptions
SQLException:
if thrown by JDBC methods
getXmlAsSourceback to summary
public Source getXmlAsSource(ResultSet rs, String columnName, Class<? extends Source> sourceClass) throws SQLException

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsSource.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsSource.

Retrieve the given column as Source implemented using the specified source class from the given ResultSet.

Might work with SQLXML or database-specific classes depending on the database and driver.

Parameters
rs:ResultSet

the ResultSet to retrieve the content from

columnName:String

the column name to use

sourceClass:Class<? extends Source>

the implementation class to be used

Returns:Source

the content as character stream, or null in case of SQL NULL

Annotations
@Override
@Nullable
Exceptions
SQLException:
if thrown by JDBC methods
getXmlAsSourceback to summary
public Source getXmlAsSource(ResultSet rs, int columnIndex, Class<? extends Source> sourceClass) throws SQLException

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsSource.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsSource.

Retrieve the given column as Source implemented using the specified source class from the given ResultSet.

Might work with SQLXML or database-specific classes depending on the database and driver.

Parameters
rs:ResultSet

the ResultSet to retrieve the content from

columnIndex:int

the column index to use

sourceClass:Class<? extends Source>

the implementation class to be used

Returns:Source

the content as character stream, or null in case of SQL NULL

Annotations
@Override
@Nullable
Exceptions
SQLException:
if thrown by JDBC methods
getXmlAsStringback to summary
public String getXmlAsString(ResultSet rs, String columnName) throws SQLException

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsString.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsString.

Retrieve the given column as String from the given ResultSet.

Might simply invoke ResultSet.getString or work with SQLXML or database-specific classes depending on the database and driver.

Parameters
rs:ResultSet

the ResultSet to retrieve the content from

columnName:String

the column name to use

Returns:String

the content as String, or null in case of SQL NULL

Annotations
@Override
@Nullable
Exceptions
SQLException:
if thrown by JDBC methods
getXmlAsStringback to summary
public String getXmlAsString(ResultSet rs, int columnIndex) throws SQLException

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsString.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.getXmlAsString.

Retrieve the given column as String from the given ResultSet.

Might simply invoke ResultSet.getString or work with SQLXML or database-specific classes depending on the database and driver.

Parameters
rs:ResultSet

the ResultSet to retrieve the content from

columnIndex:int

the column index to use

Returns:String

the content as String, or null in case of SQL NULL

Annotations
@Override
@Nullable
Exceptions
SQLException:
if thrown by JDBC methods
newSqlXmlValueback to summary
public SqlXmlValue newSqlXmlValue(final String value)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Parameters
value:String

the XML String value providing XML data

Returns:SqlXmlValue

the implementation specific instance

Annotations
@Override
newSqlXmlValueback to summary
public SqlXmlValue newSqlXmlValue(final XmlBinaryStreamProvider provider)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Parameters
provider:XmlBinaryStreamProvider

the XmlBinaryStreamProvider providing XML data

Returns:SqlXmlValue

the implementation specific instance

Annotations
@Override
newSqlXmlValueback to summary
public SqlXmlValue newSqlXmlValue(final XmlCharacterStreamProvider provider)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Parameters
provider:XmlCharacterStreamProvider

the XmlCharacterStreamProvider providing XML data

Returns:SqlXmlValue

the implementation specific instance

Annotations
@Override
newSqlXmlValueback to summary
public SqlXmlValue newSqlXmlValue(final Class<? extends Result> resultClass, final XmlResultProvider provider)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Parameters
resultClass:Class<? extends Result>

the Result implementation class to be used

provider:XmlResultProvider

the XmlResultProvider that will provide the XML data

Returns:SqlXmlValue

the implementation specific instance

Annotations
@Override
newSqlXmlValueback to summary
public SqlXmlValue newSqlXmlValue(final Document document)

Implements org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Doc from org.springframework.jdbc.support.xml.SqlXmlHandler.newSqlXmlValue.

Create a SqlXmlValue instance for the given XML data, as supported by the underlying JDBC driver.

Parameters
document:Document

the XML Document to be used

Returns:SqlXmlValue

the implementation specific instance

Annotations
@Override
org.springframework.jdbc.support.xml back to summary

private abstract Class Jdbc4SqlXmlHandler.AbstractJdbc4SqlXmlValue

extends Object
implements SqlXmlValue
Class Inheritance
  • java.lang.Object
  • org.springframework.jdbc.support.xml.Jdbc4SqlXmlHandler.AbstractJdbc4SqlXmlValue
All Implemented Interfaces
org.springframework.jdbc.support.xml.SqlXmlValue, org.springframework.jdbc.support.SqlValue

Internal base class for SqlXmlValue implementations.

Field Summary

Modifier and TypeField and Description
private SQLXML

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
cleanup()

Implements org.springframework.jdbc.support.SqlValue.cleanup.

Clean up resources held by this value object.

protected abstract void
provideXml(SQLXML xmlObject)

public void
setValue(PreparedStatement
the PreparedStatement to work on
ps
,
int
the index of the parameter for which we need to set the value
paramIndex
)

Implements org.springframework.jdbc.support.SqlValue.setValue.

Set the value on the given PreparedStatement.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

xmlObjectback to summary
private SQLXML xmlObject
Annotations
@Nullable

Constructor Detail

AbstractJdbc4SqlXmlValueback to summary
private AbstractJdbc4SqlXmlValue()

Method Detail

cleanupback to summary
public void cleanup()

Implements org.springframework.jdbc.support.SqlValue.cleanup.

Doc from org.springframework.jdbc.support.SqlValue.cleanup.

Clean up resources held by this value object.

Annotations
@Override
provideXmlback to summary
protected abstract void provideXml(SQLXML xmlObject) throws SQLException, IOException
setValueback to summary
public void setValue(PreparedStatement ps, int paramIndex) throws SQLException

Implements org.springframework.jdbc.support.SqlValue.setValue.

Doc from org.springframework.jdbc.support.SqlValue.setValue.

Set the value on the given PreparedStatement.

Parameters
ps:PreparedStatement

the PreparedStatement to work on

paramIndex:int

the index of the parameter for which we need to set the value

Annotations
@Override
Exceptions
SQLException:
if an SQLException is encountered while setting parameter values