O'Reilly logo

Java Data Objects by Craig Russell, David Jordan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieval of Fields

You should not be concerned about how and when the JDO implementation accesses fields from the datastore. When you access a field, the JDO implementation provides the field’s value. But some facilities let you instruct the JDO implementation to load all or a particular subset of fields of an instance together. You can analyze your application’s field-access requirements and optimize the performance of accessing fields from the datastore.

Default Fetch Group

A fetch group is a group of fields retrieved together from the datastore. JDO implementations usually can retrieve a group of fields as a unit more efficiently than they can retrieve each field individually. In addition, you may have a specific subset of fields that your applications always use together; in this case, accessing these fields as a unit may be more efficient. Conversely, fields that are rarely accessed could be placed in a separate fetch group that is retrieved only when necessary. When fields that are not contained in any fetch group are accessed, they can be retrieved from the datastore individually.

JDO defines one fetch group, called the default fetch group (DFG). A field element’s default-fetch-group attribute specifies whether a field should be in the default fetch group. This attribute defaults to "true" for nonkey fields of the following types:

  • Primitive types

  • java.util.Date

  • Fields in the java.lang package of the types listed in Table 4-2

  • java.math.BigDecimal and java.math.BigInteger

An instance ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required