Using variant data types

Columns can contain many types of data. This topic discusses storing Java objects in a Column. Columns are introducted more completely in "Working with columns" at the beginning of this chapter.

Storing Java objects

DataSet and DataStore can store Java objects in colums of a DataSet.

Fields in a SQL table, reported by JDBC as being of type java.sql.Types.OTHER, are mapped into columns whose data type isVariant.OBJECT, or you can set a column's data type to Object and set/get values through the normal data set API.

If a DataStore is used, the objects must be serializable. If they are not, an exception is raised whenever the DataStore attempts to save the object. Also, the class must exist on the CLASSPATH when it attempts to read an object. If not, the attempt will fail.

To format and edit a column that contains a Java object: