This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 211330 - Add attributes-complete support to the EclipseLink-ORM.XML Schema
Summary: Add attributes-complete support to the EclipseLink-ORM.XML Schema
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard: Fixed in 1.0M8
Keywords:
Depends on:
Blocks: 218082 200040
  Show dependency tree
 
Reported: 2007-11-28 14:57 EST by Guy Pelletier CLA
Modified: 2022-06-09 10:33 EDT (History)
4 users (show)

See Also:


Attachments
Proposed patch (50.22 KB, patch)
2008-05-23 13:54 EDT, Guy Pelletier CLA
no flags Details | Diff
Updated patch (49.15 KB, patch)
2008-05-23 14:01 EDT, Guy Pelletier CLA
no flags Details | Diff
Updated patch (54.58 KB, patch)
2008-05-23 14:32 EDT, Guy Pelletier CLA
no flags Details | Diff
Final patch (55.71 KB, patch)
2008-05-23 15:16 EDT, Guy Pelletier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Guy Pelletier CLA 2007-11-28 14:57:40 EST
Which is a flag to indicate not to auto-generate any unspecified attributes. This is important in XML when the class may continue to evolve.
Comment 1 Guy Pelletier CLA 2008-05-20 14:53:23 EDT
Re-assigning to myself.
Comment 2 Guy Pelletier CLA 2008-05-20 15:38:53 EDT
Two ways we could handle this feature.

1 - add a new xml-attribute-metadata-complete tag who's functionality is equivalent to that of the xml-mapping-metadata-complete tag plus no defaulting for Basic, VariableOneToOne, OneToOne, OneToMany mappings.

Example:

<persistence-unit-metadata>
  <xml-attribute-metadata-complete/>
</persistence-unit-metadata>



2 - expand the existing xml-mapping-metadata-complete tag to specify a type.

Example

<persistence-unit-metadata>
  <xml-mapping-metadata-complete>EXCLUDE_MAPPING_DEFAULTS</xml-mapping-metadata-complete>
</persistence-unit-metadata>

or 

<persistence-unit-metadata>
  <xml-mapping-metadata-complete>INCLUDE_MAPPING_DEFAULTS</xml-mapping-metadata-complete>
</persistence-unit-metadata>

Comment 3 Shaun Smith CLA 2008-05-21 11:26:15 EDT
If the goal is to stop EclipseLink from examining classes that are identified in the mapping file and then coming up with default mappings maybe we need to be more explicit in the element name?  Something like:

<disable-default-mappings/>
Comment 4 Guy Pelletier CLA 2008-05-22 09:02:57 EDT
Hi Shaun,

Thanks for your feedback. So going with the new tag <disable-default-mappings/> and just for completeness sake, would you expect that specifying this tag alone also implies <xml-mapping-metadata-complete>?

I would assume no, therefore, to hash out the usage:

<xml-mapping-metadata-complete/> used with <disable-default-mappings/> means absolutely no class processing is done for annotations or default mappings.

<xml-mapping-metadata-complete/> used alone works as it already does that is, no annotation processing but default mappings are processed (per the spec).

<disable-default-mappings> used alone means process the class for annotations but do not process any default mappings.

Thanks,
Guy


Comment 5 Shaun Smith CLA 2008-05-22 09:31:43 EDT
Guy, I agree with the semantics you've defined.

And based on Mike Keith's comments on the eclipselink-dev list he seems to agree that the suppression of defaults is orthogonal to the processing of explicit annotations and/or XML.
Comment 6 Guy Pelletier CLA 2008-05-22 15:09:04 EDT
So couple other points then to tidy up some loose ends:

1 - How about calling the tag <exclude-default-mappings> instead? Which follows the JPA naming convention (e.g. exclude-default-listeners and exclude-superclass-listeners)

2 - The new element will be available from the <persistence-unit-metadata>. Setting it there means it will be applied to all the classes across the persistence unit.

3 - A new boolean attribute (exclude-default-mappings) will be added to the <entity>, <mapped-superclass> and <embeddable> elements to allow the user to override a global setting.

An example would look like this:

<entity-mappings ...>
    <persistence-unit-metadata>
        <xml-mapping-metadata-complete/>
        <exclude-default-mappings/>
        <persistence-unit-defaults>    
            ...
        </persistence-unit-defaults>
    </persistence-unit-metadata>
    <entity name="Employee" class="Employee" exclude-default-mappings="false">
    ...
    </entity>
    ...
</entity-mappings>

Comment 7 Shaun Smith CLA 2008-05-22 15:27:59 EDT
I'm fine with your refinements and I like the idea that on a class by class basis you can suppress/enable defaults.  

The 'exclude-default-mappings' property on Entity/MappedSuperclass/Embedded suggests there should be corresponding support in annotations.  This would be a separate enhancement that could be deferred to a later release.
Comment 8 Guy Pelletier CLA 2008-05-23 13:54:54 EDT
Created attachment 101782 [details]
Proposed patch
Comment 9 Guy Pelletier CLA 2008-05-23 14:01:43 EDT
Created attachment 101784 [details]
Updated patch
Comment 10 Guy Pelletier CLA 2008-05-23 14:32:55 EDT
Created attachment 101793 [details]
Updated patch
Comment 11 Guy Pelletier CLA 2008-05-23 15:16:42 EDT
Created attachment 101799 [details]
Final patch
Comment 12 Guy Pelletier CLA 2008-05-23 15:22:06 EDT
Patch has been submitted.

Reviewed by: Tom Ware

New test (testExcludeDefaultMappings) added to EntityMappingsRelationshipsJUnitTestCase
Comment 13 Eclipse Webmaster CLA 2022-06-09 10:33:20 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink