Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EclipseLink/Development/MetadataCollection

< EclipseLink‎ | Development
Revision as of 15:02, 25 November 2010 by Unnamed Poltroon (Talk) (New page: == Metadata Collection Requirements and Design  == Enhancement Request : Bug 330846 This feature will help eclipselink users to gather the metadata configurations annotated on/in se...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Metadata Collection Requirements and Design 

Enhancement Request : Bug 330846

This feature will help eclipselink users to gather the metadata configurations annotated on/in several different entities on to a single centralized location (class)  for better maintenence over time. The prposed feature will leverage existing standards and convensions for grouping metadata and builds upon the same to further simplify its usage and maintenence. 


List of Requirements:

   This feature should provide eclipselink users the ability to group:

  • all types of related named queries
  • all related resultset mappings
  • all related converters
  • all related query redirectors   


at a central place like any ordinary utility class

Metadata

The following sections will give in detail the changes and modifications that are required for implementing this feature.

The Metadata Collection is somewhat similar to the existing support for assembling all metatadata in eclipselink-orm.xml; however, it does not aim to be an all encompassing storehouse for the entire metadata of the project, as is the eclipselink-orm.xml. It is expected to be used to group related metadata for easier maintenance.


This  feature will be available in both the Java annotations and XML mappings.

Annotation:

  @MetadataCollection

/**


    • /

@Target(TYPE)

@Retention(RUNTIME)

public @interface MetadataCollection{

    NamedQueries namedQueries();

    NamedNativeQueries namedNativeQueries();

    NamedStoredProcedureQueries namedStoredProcedureQueries();

    SQLResultSetMappings[] resultSetMappings() default {};

    Convertors convertors();

    QueryRedirectors queryRedirectors;

}


XML Element

A metadata complex xml element will be created to group all related metadata together:

<xs:complexType name="metadata-collection">

    <xs:annotation>

            <xs:documentation>

            </xs:documentation> 

    </xs:annotation>

    <xs:sequence>

             <xs:element name="namedQueries"  minOccurs="0">

             </xs:element>

             <xs:element name="namedNativeQueries" minOccurs="0">

             </xs:element>

             <xs:element name="namedStoredProcedureQueries">

             </xs:element>

             <xs:element name="resultSetMappings" minOccurs="0">

             </xs:element>

             <xs:element name=convertors minOccurs="0"

             </xs:element>

             <xs:element name="query-redirectors" minOccurs="0">

             </xs:element>

</xs:complexType>





Example:

<metadata-collection>

        <named-queries>

                <named-query name="" query=""/>

        </named-query>

        <named-native-queries>

                <named-native-query name="" query=""/>

         </named-native-queries>

         <named-stored-procedure-queries>

                 <named-stored-procedure-query name="" query="" />

         </named-stored-procedure-queries>

         <result-set-mappings>

                 <sql-resultset-mapping>

                         <!-- <entity>and <field> mappings -->

                 </sql-resultset-mapping>

         </resultset-mappings>

         <convertors>

               <convertor name="" class="">

               </convertor>

         </convertors>

          <query-redirectors>

                 <query-redirector allqueries="DefaultRedirector.class"/>

          </query-redirectors>

</metadata-collection>  

which can be annotated on any ordinary top level java class to group metadata that belongs to more than one entity.

Back to the top