<xml> </xml>

db4o |

# ObjectClass.PersistStaticFieldValues Method

turns on storing static field values for this class.

void PersistStaticFieldValues();

#### Remarks

turns on storing static field values for this class.
By default, static field values of classes are not stored to the database file. By turning the setting on for a specific class with this switch, all non-simple-typed static field values of this class are stored the first time an object of the class is stored, and restored, every time a database file is opened afterwards, after class meta information is loaded for this class (which can happen by querying for a class or by loading an instance of a class).
To update a static field value, once it is stored, you have to the following in this order:
(1) open the database file you are working agains
(2) make sure the class metadata is loaded

    objectContainer.query().constrain(Foo.class); // Java

    objectContainer.Query().Constrain(typeof(Foo)); // C#

(3) change the static member
(4) store the static member explicitely

    objectContainer.set(Foo.staticMember); // C#

The setting will be ignored for simple types.
Use this setting for constant static object members.
This option will slow down the process of opening database files and the stored objects will occupy space in the database file.

#### See Also

ObjectClass Interface | com.db4o.config Namespace