Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

CHAPTER 10: Using Strongly Typed Interfa... > Using the SQLData Interface

Using the SQLData Interface

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.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint