|
Sometimes a datastore has particular requirements, and maybe is out of direct control of an application
being managed by a different group. In this situation you may have to configure the datastore layer
to meet these requirements.
If your datastore is read-only (you can't add/update/delete any data in it), obviously you
could just configure your application to not perform these operations. An alternative is
to set the EntityManagerFactory as "read-only". You do this by setting the
persistence property
datanucleus.readOnlyDatastore
to
true
.
From now on, whenever you perform a persistence operation that implies a change in datastore
data, the JPA operation will throw an exception. You can change this behaviour
using the persistence property
datanucleus.readOnlyDatastoreAction
with values of "EXCEPTION"
(default), and "IGNORE". "IGNORE" has the effect of simply ignoring all attempted updates to
readonly objects.
Some datastores have a "schema" defining the structure of data stored within that datastore.
In this case we don't want to allow updates to the structure at all. You can set this when creating
your EntityManagerFactory by setting the persistence property
datanucleus.fixedDatastore
to
true
.
|
|