By default with JDO implementations when you open a
and obtain a
DataNucleus knows nothing about which classes are to be persisted to that
datastore. JDO implementations only load the Meta-Data for any class when the class is first enlisted
operation. For example you call
on an object.
The first time a particular class is encountered DataNucleus will dynamically load the Meta-Data for
that class. This typically works well since in an application in a particular operation the
may well not encounter all classes that are persistable to that
datastore. The reason for this dynamic loading is that JDO implementations can't be expected to
scan through the whole Java CLASSPATH for classes that could be persisted there.
That would be inefficient. There is an Auto-Start facility to
alleviate this situation. RDBMS datastores allow a further auto-start mechanism option.
This is described below.
When using an RDBMS datastore
auto-start mechanism stores the list
of classes (and their tables, types and version of DataNucleus) in a datastore table
. This table is read at startup of DataNucleus, and provides DataNucleus
with the necessary knowledge it needs to continue persisting these classes.
This table is continuously updated during a session of a DataNucleus-enabled application.
This is the default setting for the auto-start mechanism
so, unless you change the
property, you will have a table NUCLEUS_TABLES created in
your datastore schema.
If the user changes their persistence definition a problem can occur when starting up DataNucleus.
DataNucleus loads up its existing data from NUCLEUS_TABLES and finds that a table/class
required by the NUCLEUS_TABLES data no longer exists. There are 3 options for what DataNucleus
will do in this situation. The property
behaviour of DataNucleus for this situation.
will mean that DataNucleus will throw an exception and the user will be
expected to manually fix their database mismatch (perhaps by removing the existing tables).
(the default) will simply remove the entry from NUCLEUS_TABLES and continue without exception.
will simply continue without doing anything.
The default database schema used the
is described below:
TABLE : NUCLEUS_TABLES
COLUMN : CLASS_NAME VARCHAR(128) PRIMARY KEY, -- Fully qualified persistent Class name
COLUMN : TABLE_NAME VARCHAR(128), -- Table name
COLUMN : TYPE VARCHAR(4), -- FCO | SCO
COLUMN : OWNER VARCHAR(2), -- 1 | 0
COLUMN : VERSION VARCHAR(20), -- DataNucleus version
COLUMN : INTERFACE_NAME VARCHAR(255) -- Fully qualified persistent Class type
-- of the persistent Interface implemented
If you want to change the table name (from NUCLEUS_TABLES) you can set the persistence property