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.
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:
Default formatting and editing.
In the UI designer, a formatter is assigned to Object
columns by default. When the object is edited, it will simply be an object of type java.lang.String
regardless of what the type was originally.
Custom formatting and editing.
You can, and probably will want to, define the
formatter
property on a column to override the default functionality, or at least make the column non-editable. You can use a custom formatter to define the proper formatting and parsing of the objects kept in the column.
A column formatter is used for all the records in the data set. The implication of this is that you cannot mix object types in a particular column. This restriction is only for customized editing