users@glassfish.java.net

Re: Sematics of the orm.xml file

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Fri, 16 Jun 2006 11:46:50 -0700

It means that you can do partial overrides. It's Java Persistence API
spec :).

-marina

vince kraemer wrote:
> There be a lot of long words in there, miss. We're naught but humble
> coders...
>
> Are there any examples that illuminate this subject a bit "more"?
>
> Is there a pointer to the spec that you are quoting from....
>
> Thanks,
> vbk
>
> Marina Vatkina wrote:
>
>> Hi Vince,
>>
>> You can choose. This is what the spec says:
>>
>> 10.1 XML Overriding Rules
>> ...
>> If the xml-mapping-metadata-complete subelement of the
>> persistence-unit-metadata
>> element is specified, the complete set of mapping metadata for the
>> persistence unit is contained in
>> the XML mapping files for the persistence unit, and annotations on the
>> classes are ignored. When
>> xml-mapping-metadata-complete is specified and XML elements are
>> omitted, the default values
>> apply[47].
>
> Okay....
>
> It sounds like:
>
> 1. by default the orm.xml is not a complete override, but is selective.
>
> 2. an orm.xml can completely override the annotations in a PU.
>
> 3. an orm.xml that says that it completely overrides the annotations in
> a PU doesn't need to be complete....
> (that is a bit unsettling)
>
> It seems like this implies that I can make the classes in a jar entities
> by adding a persistence.xml and an orm.xml
> without adding ANY annotations anywhere???
>
>> [47] If the xml-mapping-metadata-complete element is specified, any
>> metadata-complete attributes specified within
>> the entity, mapped-superclass, and embeddable elements are ignored.
>
> Because they are kind of redundant?
>
>> ...
>>
>> 10.1.3.1 metadata-complete
>> If the metadata-complete attribute is specified on the entity element
>> itself, any annotations on
>> the entity class (and its fields and properties) are ignored. When
>> metadata-complete is specified
>> on the entity element and XML elements are omitted, the default values
>> apply to the given class.
>
> 4. an orm.xml file can completely override the annotations of a single
> entity in a PU. Again, while it says it is complete,
> it doesn't actually need to be....
>
>
>>
>> -marina
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>