This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 211298 - Provide XML metadata support for existing native EclipseLink annotations
Summary: Provide XML metadata support for existing native EclipseLink annotations
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL: http://wiki.eclipse.org/EclipseLink/D...
Whiteboard: Fixed in 1.0M5
Keywords:
Depends on: 217877 217878 217879 217880 217883
Blocks: 200040
  Show dependency tree
 
Reported: 2007-11-28 14:16 EST by Guy Pelletier CLA
Modified: 2022-06-09 10:36 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Doug Clarke CLA 2008-01-30 18:56:06 EST
Some comments on the design specification

BasicCollection suggestion:
- you missed the name as a require attribute
- the table could be assumed to be the name of the attribute unless the column specifies a different table name

<basic-collection name="responsibilities" fetch="LAZY" private-owned="true" join-fetch="INNER">
    <column name="DESCRIPTION" table="RESPONSIBILITIES"/>
    <join-column name="EMPLOYEE_ID" referenced-column-name="EMP_ID"/>
</basic-collection>

BasicMap suggestion

- missed name attribute as well

 <basic-map name="licenses" fetch="LAZY" private-owned="false" join-fetch="OUTER">
    <key converter="licenseConverter">
        <column name="LICENSE" table="LICENSES"/>
    </key>
    <value converter="Integer2String">
        <column name="STATUS"/>
    </value>
    <join-column name="RESTAURANT_ID" referenced-column-name="ID"/>
</basic-map>

RETURNING POLICY: Added a separate bug for this - 215836



Comment 2 Guy Pelletier CLA 2008-01-31 10:16:44 EST
The collection table name currently defaults to:

className + "_" + attributeName

Specifying a table in the value-column is currently redundant. We don't use the table from there to build the collection-table. 

In your example this would eventually cause an exception, since the value-column maps to a RESPONSIBILITIES table where the the collection table is actually named EMPLOYEE_RESPONSIBILITIES

The name attributes were indeed missed, I will add those.
Comment 3 Doug Clarke CLA 2008-01-31 10:22:40 EST
CONVERTER USAGE: We need to have a common agreement on how converters should be used within mappings. Using annotations converters are defined globally for a persistence unit using:

@Converter or @StructConverter

and then they are used within a given mapping as:

@Convert("myConverter")

In the ECLIPSELINK-ORM.XML configuration file we need to address a couple of issues:

1. Where can customers define their converters. Using annotations you must define them on some entity which is necessary but a little ugly. Within XML customers should be able to define Converter and StructConverter globally for the persistence unit outside of any particular entity definition. This should align with JPA's ORM.XML as well.

2. The usage of a converter within a mapping needs to be consistent across all mapping types. I believe that since usage of a converter is more of a fringe case that it should be addressed as a nested element and not as an attribute of the mapping element.

BASIC USAGE:

<basic name="salary">
    <converter name="money"/>
</basic>

In the case of more complex mappings such as the BasicMap where multiple converters can be used it could mean the XML appears as:

<basic-map name="licenses">
    <key>
        <column name="LICENSE" table="LICENSES"/>
        <convert name="license"/>
    </key>
    <value>
        <column name="STATUS"/>
        <convert name="status"/>
    </value>
    <join-column name="RESTAURANT_ID" referenced-column-name="ID"/>
</basic-map>
Comment 4 Doug Clarke CLA 2008-01-31 10:24:37 EST
Typo in the Basic converter usage. Should have been:

BASIC USAGE:

<basic name="salary">
    <convert name="money"/>
</basic>
Comment 5 Guy Pelletier CLA 2008-01-31 10:38:24 EST
Just spoke to Mike, the convert will changed to an element instead of an attribute. 

The thinking is that anything that has its own annotation should in turn have its own complex element in the schema. I think that is a good rule of thumb to follow. Makes sense ... if the annotation were ever to expand its contents, then the same freedom exists in a complex element (as opposed to an attribute)
Comment 6 Shaun Smith CLA 2008-01-31 10:53:28 EST
>Within XML
>customers should be able to define Converter and StructConverter globally for
>the persistence unit outside of any particular entity definition. This should
>align with JPA's ORM.XML as well.

I suggest we follow a similar approach to JPA GeneratedValue generators and allow Converters to be defined either globally or on an Entity.  Like generators, they would be globally scoped.
Comment 7 Guy Pelletier CLA 2008-01-31 11:11:00 EST
Agreed, right now the plan to allow users to define them at the following levels:

entity-mappings
entity
embeddable
mapped-superclass

Which mirrors the global definition of generators.
Comment 8 Guy Pelletier CLA 2008-03-03 13:26:43 EST
All dependent bugs have now been fixed, therefore this bug is now fixed.
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:36:16 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink