3.7.4.4. XML extensions
OpenJPA has extended the JPA 2.0 schema to include elements and attributes corresponding to OpenJPA extended metadata and mapping annotations. The schema are contained in 2 files: extendable-orm.xsd and openjpa-orm.xsd. The extendable-orm.xsd file provides copies of some of the JPA 2.0 schema elements with additional schema to make it extendable. The openjpa-orm.xsd file extends the extendable-orm.xsd with OpenJPA specific elements and attributes representing OpenJPA annotations. Currently, only a subset of annotations have actually been implemented, and some of those have been partially tested. The current status can be found by comments in the openjpa-orm.xsd schema file.
In order to use the OpenJPA extensions in your mapping file you must include the namespaces for these 2 new schemas as well as for the schema for JPA 2.0, as shown in the following example:
<entity-mappings xmlns="http://www.apache.org/openjpa/ns/orm/extendable"
xmlns:openjpa="http://www.apache.org/openjpa/ns/orm"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.0">
<entity class="org.apache.openjpa.persistence.jdbc.annotations.MultiColumnVersionPC"
metadata-complete="true">
<table name="MCV"/>
<attributes>
<id name="id">
<orm:generated-value/>
</id>
<basic name="id"/>
<basic name="name"/>
</attributes>
<openjpa:entity version-strategy="version-numbers">
<openjpa:version-columns>
<openjpa:version-column name="v1"/>
<openjpa:version-column name="v2"/>
<openjpa:version-column name="v3"
column-definition="FLOAT"
scale="3"
precision="10"/>
</openjpa:version-columns>
</openjpa:entity>
</entity>
</entity-mappings>