openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <>
Subject OpenJPA annotations XML
Date Mon, 27 Nov 2006 03:02:27 GMT
The JPA spec defines entity annotations and a corresponding XML
deployment descriptor format (the orm.xml format, not the
persistence.xml format). The XML deployment descriptor data overrides
the annotation data, and does so on a per-attribute basis. This means
that if there is an XML element for a given persistent field / property
(attribute), then the data in the XML is used, and any data in the
annotation is ignored.

OpenJPA further defines some of its own entity annotations. However,
currently, these annotations cannot be expressed in XML.

(IMO, configuring OpenJPA extensions in XML is more important for the
JDBC-related annotations than for the non-JDBC annotations, as the
non-JDBC annotations are largely things that I think annotations are
suitable for. My litmus test is that if something is intrinsic to the
class when the class is designed, it makes sense as an annotation;
otherwise, it should be externalized from the class.)

The goal of this message is to kick off a discussion about what we want
the XML configuration pathway to look for OpenJPA. I'll start off with a
couple of high-level guidelines:

1. XML configuration should parallel the rules and conventions of the
JPA spec.

2. The rules for overriding annotations should be carefully thought out.
In particular, how do we design a long-term solution *and* resolve the
short-term issue that currently prevents OpenJPA annotations from being
picked up if spec XML is used?

I think that my ideal solution would be one that allowed the
OpenJPA-specific info to be placed inline inside the orm.xml file, maybe
like so:

<entity-mappings xmlns=""
orm_1_0.xsd" version="1.0">
    <entity class="Person">
            <id name="pk"/>
            <basic name="firstName"/>
            <basic name="lastName"/>



Patrick Linskey
BEA Systems, Inc. 

Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

View raw message