Using variant data types

Database application development is a feature of JBuilder Professional and Enterprise. Distributed application development is a feature of JBuilder Enterprise.

Columns can contain many types of data. This topic discusses storing Java objects in a Column. Columns are introduced more completely in "Working with columns" in the "Retrieving data from a data source" chapter.

Storing Java objects

DataSet and DataStore can store Java objects in columns 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: