You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Fay Wang (JIRA)" <ji...@apache.org> on 2009/01/07 04:44:44 UTC

[jira] Created: (OPENJPA-851) Support for enhanced map collection (and corresponding annotations)

Support for enhanced map collection (and corresponding annotations)
-------------------------------------------------------------------

                 Key: OPENJPA-851
                 URL: https://issues.apache.org/jira/browse/OPENJPA-851
             Project: OpenJPA
          Issue Type: Sub-task
            Reporter: Fay Wang
            Assignee: Fay Wang




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-851) Support for enhanced map collection (and corresponding annotations)

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12665731#action_12665731 ] 

Fay Wang commented on OPENJPA-851:
----------------------------------

ManyToMany Map support is checked in r-736245.

> Support for enhanced map collection (and corresponding annotations)
> -------------------------------------------------------------------
>
>                 Key: OPENJPA-851
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-851
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Fay Wang
>            Assignee: Fay Wang
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-851) Support for enhanced map collection (and corresponding annotations)

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661431#action_12661431 ] 

Fay Wang commented on OPENJPA-851:
----------------------------------

This subtask will cover the following items:

(1) Enhanced map collection support 2.7 
(2) Support @MapKeyClass annotation and XML 10.1.27, 10.1.26 
(3) Support @MapKeyColumn annotation and XML 10.1.28, 2.7.1 
(4) Support @MapKeyJoinColumn annotation and XML 10.1.29 
(5) Support @MapKeyJoinColumns annotation and XML 10.1.30 
(6) Support @MappedById annotation and XML 10.1.31 
(7) Support orphanRemoval attribute on relationships 2.9, 10.1.33, 10.1.34 

> Support for enhanced map collection (and corresponding annotations)
> -------------------------------------------------------------------
>
>                 Key: OPENJPA-851
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-851
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Fay Wang
>            Assignee: Fay Wang
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-851) Support for enhanced map collection (and corresponding annotations)

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664022#action_12664022 ] 

Fay Wang commented on OPENJPA-851:
----------------------------------

More map support is committed r-734617 for bi-directional map in update operation

> Support for enhanced map collection (and corresponding annotations)
> -------------------------------------------------------------------
>
>                 Key: OPENJPA-851
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-851
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Fay Wang
>            Assignee: Fay Wang
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-851) Support for enhanced map collection (and corresponding annotations)

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664421#action_12664421 ] 

Fay Wang commented on OPENJPA-851:
----------------------------------

Xml orm support for MapKeyClass, MapKeyColumn, MayKeyJoinColumn is checked in r-734926.

> Support for enhanced map collection (and corresponding annotations)
> -------------------------------------------------------------------
>
>                 Key: OPENJPA-851
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-851
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Fay Wang
>            Assignee: Fay Wang
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-851) Support for enhanced map collection (and corresponding annotations)

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666384#action_12666384 ] 

Fay Wang commented on OPENJPA-851:
----------------------------------

Completed:
==========
Item (1) - (6).

Deferred:
========
Item (7) and (8) .

Limitation:
=========
Bi-directional one-to-many/may-to-one map will not able to accommodate same map value with different map key.

	Spec 2.7.1 indicates that for a bi-directional one-to-many/may-to-one map, by default, the map is mapped in the table of the entity that is the value of the map. Considering the following example:

@Entity
public class Company {
    @Id
    int id;
    
    @OneToMany(mappedBy="co")
    Map<Division, VicePresident> organization = new HashMap<Division, VicePresident>();

...
}

@Entity
public class VicePresident {
    @Id
    int id;
    
    String name;
  
    @ManyToOne
    Company co;
}


The table of the VicePresident have the following columns: id, name, CO_ID, KEY_ID. Suppose the map "organization" has the following entries:
		   key	 value
                --------     ---------
                   Div1      VP1
                   Div2      VP2
                   Div3      VP3
                   Div4      VP1         
           
Note that VP1 appears twice in the map table with different keys. However, due to primary key constraint, the VicePresident table can only have the following entries: 

        id       name      CO_ID    KEY_ID
       -----    -----------  -----------   -----------
    	1        VP1            1            Div1
	2        VP2            1            Div2
	3        VP3            1            Div3

The limitation is therefore clear that for bi-directional map, it is impossible to have multiple entries with the same map value.


Open Issues:
===========
Problem with AttributeOverrides on map key/value when any of them are embeddable.

On page 36 of the Spec, AttributeOverride can be used when map key/value is embeddable. The following examples illustrates the problem of using AttributeOverride when both map key and value are embeddable. 

(1) case 1:

    @ElementCollection
    @AttributeOverrides({
        @AttributeOverride(name="intVal1", column=@Column(name="intVal1_colA")),
        @AttributeOverride(name="intVal2", column=@Column(name="intVal2_colA"))
    })
    Map<EmbeddableA, EmbeddableB> phoneNumbers = new HashMap<AFullPhoneName, PhoneNumber>(); 
	

(1) case 2:
    @ElementCollection
    @AttributeOverrides({
        @AttributeOverride(name="intVal1", column=@Column(name="intVal1_colA")),
        @AttributeOverride(name="intVal2", column=@Column(name="intVal2_colA"))
    })
    @AttributeOverrides({
        @AttributeOverride(name="intVal1", column=@Column(name="intVal1_colB")),
        @AttributeOverride(name="intVal2", column=@Column(name="intVal2_colB"))
    })
    Map<EmbeddableA, EmbeddableB> phoneNumbers = new HashMap<AFullPhoneName, PhoneNumber>(); 

	In both case, there is no way to know which embeddable the AttributeOverride applies to. One proposal is to create @EmbeddedKey and @EmbeddedValue annotations to distinguish these situations as follows:

    @EmbeddedKey
    @AttributeOverrides({
        @AttributeOverride(name="intVal1", column=@Column(name="intVal1_colA")),
        @AttributeOverride(name="intVal2", column=@Column(name="intVal2_colA"))
    })

     This feature can not be implemented until this issue is resolved.
     
     Without the support of AttributeOverrides, the default column names for the embeddables are derived from the field or property names of the embeddable class. In the above example, if EmbeddableA and EmbeddableB have the same field names, there will be column name clashes, causing lost information or sql error.

> Support for enhanced map collection (and corresponding annotations)
> -------------------------------------------------------------------
>
>                 Key: OPENJPA-851
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-851
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Fay Wang
>            Assignee: Fay Wang
>             Fix For: 2.0.0
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-851) Support for enhanced map collection (and corresponding annotations)

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663618#action_12663618 ] 

Fay Wang commented on OPENJPA-851:
----------------------------------

Enhance map support (spec 2.7, 10.1.26, 10.1.27, 10.1.28, 10.1.29, 10.1.30) is committed r-734319.

> Support for enhanced map collection (and corresponding annotations)
> -------------------------------------------------------------------
>
>                 Key: OPENJPA-851
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-851
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Fay Wang
>            Assignee: Fay Wang
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-851) Support for enhanced map collection (and corresponding annotations)

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-851?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fay Wang resolved OPENJPA-851.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0

> Support for enhanced map collection (and corresponding annotations)
> -------------------------------------------------------------------
>
>                 Key: OPENJPA-851
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-851
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Fay Wang
>            Assignee: Fay Wang
>             Fix For: 2.0.0
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.