Community
Participate
Working Groups
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.
Re-assigning to myself.
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>
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/>
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
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.
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>
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.
Created attachment 101782 [details] Proposed patch
Created attachment 101784 [details] Updated patch
Created attachment 101793 [details] Updated patch
Created attachment 101799 [details] Final patch
Patch has been submitted. Reviewed by: Tom Ware New test (testExcludeDefaultMappings) added to EntityMappingsRelationshipsJUnitTestCase
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink