users@glassfish.java.net

RE: Sematics of the orm.xml file

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Mon, 19 Jun 2006 11:32:43 -0400

Hello Vince,
    1. Yes I ment "metadata-complete" for the element of the Entity tag.
    2. The entity-persistence-tests module contains test models that use XML in these combinations the orm.xmls can be found under config/meta-inf:
          incomplete-owning-entity-mappings.xml - contains overridding mappings
          orm-annotation-merge-advanced-entity-mappings.xml - contains a "metadata-complete" entity
          
        There are currently no examples of 'xml-mapping-metadata-complete'

--Gordon

-----Original Message-----
From: Vince.Kraemer_at_Sun.COM [mailto:Vince.Kraemer_at_Sun.COM]On Behalf Of
vince kraemer
Sent: Friday, June 16, 2006 5:20 PM
To: users_at_glassfish.dev.java.net
Subject: Re: Sematics of the orm.xml file


Gordon Yorke wrote:
> Hello Vince,
> The JPA specification gives the developer the tools to configure persistence 'by exception' to fit their deployment requirements. 'by exception' means that for every annotation and XML element the specification has defined a default or a mechanism for determining defaults (eg. column names are generated by joining the field name with the pk name of the target). This means the developer need only specify the configuration that does not follow the defaults and the Persistence Provider will 'default' the rest based on the rules in the Specification.
>
> XML and annotations can be used in many combinations. A persistence unit can have only XML and no Annotations (including @Entity) for mapping pre JDK 1.5 classes. A persistence unit can have only Annotations and no XML. An important thing to note is that XML will override annotations. This gives deployers the opportunity to tweak the persistence configuration based on the deployment target.
>
> Overriding has 3 levels. The first and most straight-forward is per annotation overriding. When a single annotation is overridden by xml all other existing annotations and defaults continue to be used. This is usually limited to schema based changes like table names.
>
Is there a practical example (java and xml code) that illustrates this
available somewhere?
> The next level is Entity overriding. This is when 'xml-mapping-metadata-complete' is specified on the Entity. This will cause the Persistence Provider to ignore all annotations for that Entity.
Is there an example (java and xml code) of this available somewhere?

by-the-by: are you referring to 'metadata-complete' here???
> Not because they are redundant but because the configuration may be different entirely. This would be used in cases where a model class is reused in a different deployment accessing an entirely different table structure.
>
> The third level is when 'xml-mapping-metadata-complete' is specified. This will cause the Persistence Provider to ignore all annotations in the Persistence Unit.
An example of this?
> Not because they are redundant but the deployer wants to ensure that configuration is fully isolated (or controlled) by the XML file and that no annotations will 'sneak' into the Persistence Unit.
>
>
Thanks,
vbk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: users-help_at_glassfish.dev.java.net