Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
It’s now time to take a look at the SQLData interface. We’ll use JPublisher to generate classes implementing this interface.
The SQLData interface is used for the custom mapping of a SQL object type to a class in the Java programming language. It consists of three methods:
public String getSQLTypeName() throws SQLException
This method returns the fully qualified name of the SQL object type that this object represents (e.g., BENCHMARK.PERSON). It is called by the JDBC driver to get the name of the object type mapped to this instance of SQLData.
public void readSQL(SQLInput stream, String typeName)
throws SQLException
This method populates this object with data read from the database. Here, SQLInput is an input stream that contains a stream of values representing an instance of a SQL object. This interface is used only for custom mapping and is used by the driver behind the scenes.