Chapter 6. Metadata
Prev | Part 3. Reference Guide | Next

## Chapter 6. Metadata

The JPA Overview covers JPA metadata in Chapter 5, Metadata . This chapter discusses OpenJPA's extensions to standard JPA metadata.

## 1. Metadata Factory

The `openjpa.MetaDataFactory` configuration property controls metadata loading and storing. This property takes a plugin string (see Section 4, “ Plugin Configuration ”) describing a concrete `org.apache.openjpa.meta.MetaDataFactory` implementation. A metadata factory can load mapping information as well as persistence metadata, or it can leave mapping information to a separate mapping factory (see Section 5, “ Mapping Factory ”). OpenJPA recognizes the following built-in metadata factories:

- `jpa`: Standard JPA metadata. This is an alias for the `org.apache.openjpa.persistence.PersistenceMetaDataFactory`.

JPA has built-in settings for listing your persistent classes, which the JPA Overview describes. OpenJPA supports these JPA standard settings by translating them into its own internal metadata factory properties. Each internal property represents a different mechanism for locating persistent types; you can choose the mechanism or combination of mechanisms that are most convenient. See Section 1, “ Persistent Class List ” for a discussion of when it is necessary to list your persistent classes.

- `Types`: A semicolon-separated list of fully-qualified persistent class names.

- `Resources`: A semicolon-separated list of resource paths to metadata files or jar archives. Each jar archive will be scanned for annotated JPA entities.

- `URLs`: A semicolon-separated list of URLs of metadata files or jar archives. Each jar archive will be scanned for annotated JPA entities.

- `ClasspathScan`: A semicolon-separated list of directories or jar archives listed in your classpath. Each directory and jar archive will be scanned for annotated JPA entities.

Example 6.1. Setting a Standard Metadata Factory

    <property name="openjpa.MetaDataFactory" value="jpa(ClasspathScan=build;lib.jar)"/>

Example 6.2. Setting a Custom Metadata Factory

    <property name="openjpa.MetaDataFactory" value="com.xyz.CustomMetaDataFactory"/>

Prev | Up | Next
8. Eager Fetching | Home | 2. Metadata Repository