Download O2 Java Binding Guide

Transcript
3
Importing Java Classes
If you want to assign an array of C (tabI = new C[10]), you must
explicitly import the array of C:
o2jb_import ... -array C[]
Re-importing
During the life of a database, the database schemas may evolve. Some
modifications are logical, for example adding a new method to a class.
Other modifications are physical, for example adding an attribute to a
class.
Re-import facilities are necessary to cope with class evolution. In other
words, the user must be able to re-import a class C into the database
after it has been modified. If the class has been modified, the system
checks for compatibility between the new structure of C and the one
stored in the database in order to assure that any existing persistent
instance of C (and any subclass of C) will not be lost. This means that the
structure stored in the database must be a subset of the new structure. If
the two structures are not compatible the class is not re-imported. In
such a case the user can delete the class, and its associated objects
(using the o2jb_unimport tool) before attempting to import it again.
Various database systems handle database evolution in different ways.
The O2 database accepts any changes in the structure of a class (see
the O2 System Administration Guide). A new schema can be imported at
any time. For relational databases, only limited changes to the class
structure are accepted.
A class update that does not entail any loss of stored instances is called
a conservative update. The only conservative class update supported by
relational databases, is the addition and deletion of a field in a class. All
other class modifications (e.g. changing an attribute type, renaming an
attribute or changing the class hierarchy) entail the loss of existing
persistent instances in the database and are therefore not supported.
Limitations of class evolution are due to restrictions of the underlying
database system concerning structure modification.
Pre-imported classes
JB provides a set of pre-imported classes which are :
38
Java Binding User Manual