Persistence descriptor elements 155 capable class based on the Java modifiers with which the field is defined. The element allows developers to override these defaults. The element has six attributes: . The name attribute identifies the field and corresponds exactly to the field name as defined in the class. . The persistence-modifier attribute determines the extent to which JDO will manage field values. It must have one of three values: persistent, transactional, or none. If the field is persistent, then it is by default transactional. JDO will synchronize the values of such fields of persistent instances with the data store. This is done subject to transaction boundaries unless the instance is explicitly made non-transactional. The persistence modifier persistent is the default for fields of supported types or references to persistence-capable classes that are not defined as static, transient or finalin the un-enhanced class. If the field s persistence modifier is transactional, its values will be cached when the instance is first associated with a transaction, and the cached values restored on transaction rollback. The cache is cleared on transaction commit. However, JDO will not persist the field s value in the data store. Fields with the persistence modifier none are not managed by JDO. This is the default persistence modifier for fields declared as static, transient or final in the un-enhanced class. It is common practice to declare selected fields of a class with the Java modifier transient in order to restrict the size of the object graph to which serialization would be applied. Such fields can then have their persistence modifier explicitly set to persistent in the descriptor, overriding their default value of none, so that their values will be transparently persisted to the data store. . The primary-key attribute has values true or false, with false being the default. It is used to identify those fields that comprise the Object ID of classes with application identity. . The null-value attribute has three possible values and is used to indicate how null values should be handled by the implementation. The default value is none, which requires the implementation to store null values as such and throw a JDODataStoreException if the data store is not capable of storing null values. The value exception requires the implementation to throw a JDOUserException if the field contains a null value at the time it is to be stored. The exception is more likely to occur at commit time than at the time the null value is assigned. The final value of default indicates that a null value should be replaced by the field s default value prior to storage. If such a field s value is set to null in an instance that is subsequently Persistent-New or Persistent-Dirty, the application will typically see the default value after commit. (It is not necessary for the instance to be explicitly retrieved again by Object ID, extent iteration or query execution.)
Hint: If you are looking for high quality and reliable webspace provider to host and run your jsp hosting application check Virtualwebstudio jsp web hosting provider
This entry was posted
on Wednesday, November 1st, 2006 at 4:19 am and is filed under java.
You can follow any responses to this entry through the RSS 2.0 feed.
Responses are currently closed, but you can trackback from your own site.