interface allows you to create custom
Java classes that mirror your user-defined database types. But, as my
mother-in-law would say, “What do you get for that?” If
you haven’t used an object database before, using a database to
store objects, that is, both data and methods, requires a shift in
your thinking. Instead of just modeling the data around, and
establishing relationships between, different things, you can
complete the puzzle by including a thing’s behavior. When you
create a user-defined data type in the database, you can also include
methods for its behaviors. You can continue to use relational SQL and
retrieve the object data as though it were in tables, and execute
object methods as though they were separate stored procedures, but
SQLData interface, you don’t have
to. Instead, you can create a Java object that will mimic your
database object and retrieve an object directly from the database
into your Java program as an object. There is no longer any need to
do any relational-to-object mapping in your Java program. Now you can
When you use
SQLData, follow these steps:
Create custom Java classes to represent database user-defined data types.
Add the custom Java classes to the
object’s type map.
For insert and update operations, use a
PreparedStatement object with an appropriately
formulated SQL statement.
getObject( ) or
setObject( ) accessor methods to get and set the object values as needed. ...