You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Manu T George (JIRA)" <de...@geronimo.apache.org> on 2005/12/16 13:21:45 UTC

[jira] Created: (GERONIMO-1374) Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship

Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship
------------------------------------------------------------------------------------------

         Key: GERONIMO-1374
         URL: http://issues.apache.org/jira/browse/GERONIMO-1374
     Project: Geronimo
        Type: Bug
  Components: OpenEJB  
    Versions: 1.0-M5    
 Environment: JDK 1.4.2_09 WindowsXP
    Reporter: Manu T George


I have two CMPs with a 1:n relationship.
CMP1 -  Order - PK = OrderPK which has a single field orderId
CMP2  - OrderItem = OrderItemPk which has 2 fields InventoryId and order_orderId

OrderId and order_orderId are mapped
When i do a setOrder_orderId in the ejbCreate of OrderItem geronimo gives an error during runtime saying cannot set read only field.

When i don't set it geronimo says partial null key . In this case I set the cmr field in the ejbPostCreate method

 org.tranql.identity.UndefinedIdentityException: Partial null key
    at org.tranql.identity.DerivedIdentity.defineIdentity(DerivedIdentity.java:80)
    at org.openejb.entity.cmp.CMPCreateMethod.execute(CMPCreateMethod.java:175)
    at org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
    at org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterceptor.java:56)
    at org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
    at org.openejb.entity.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:136)
    at org.openejb.entity.cmp.InTxCacheInterceptor.invoke(InTxCacheInterceptor.java:90)
    at org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:119)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (GERONIMO-1374) Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship

Posted by "Donald Woods (JIRA)" <de...@geronimo.apache.org>.
     [ http://issues.apache.org/jira/browse/GERONIMO-1374?page=all ]

Donald Woods updated GERONIMO-1374:
-----------------------------------

    Geronimo Info: [Patch Available]
      Fix Version: 1.0.1

> Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship
> ------------------------------------------------------------------------------------------
>
>          Key: GERONIMO-1374
>          URL: http://issues.apache.org/jira/browse/GERONIMO-1374
>      Project: Geronimo
>         Type: Bug
>   Components: OpenEJB
>     Versions: 1.0-M5
>  Environment: JDK 1.4.2_09 WindowsXP
>     Reporter: Manu T George
>     Assignee: Gianny Damour
>      Fix For: 1.0.1
>  Attachments: CMPContainerBuilder.patch, CompoundPKTransform.patch
>
> I have two CMPs with a 1:n relationship.
> CMP1 -  Order - PK = OrderPK which has a single field orderId
> CMP2  - OrderItem = OrderItemPk which has 2 fields InventoryId and order_orderId
> OrderId and order_orderId are mapped
> When i do a setOrder_orderId in the ejbCreate of OrderItem geronimo gives an error during runtime saying cannot set read only field.
> When i don't set it geronimo says partial null key . In this case I set the cmr field in the ejbPostCreate method
>  org.tranql.identity.UndefinedIdentityException: Partial null key
>     at org.tranql.identity.DerivedIdentity.defineIdentity(DerivedIdentity.java:80)
>     at org.openejb.entity.cmp.CMPCreateMethod.execute(CMPCreateMethod.java:175)
>     at org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
>     at org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterceptor.java:56)
>     at org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
>     at org.openejb.entity.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:136)
>     at org.openejb.entity.cmp.InTxCacheInterceptor.invoke(InTxCacheInterceptor.java:90)
>     at org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:119)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (GERONIMO-1374) Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship

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

Gianny Damour closed GERONIMO-1374.
-----------------------------------

    Resolution: Won't Fix

Superseded

> Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship
> ------------------------------------------------------------------------------------------
>
>                 Key: GERONIMO-1374
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-1374
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: OpenEJB
>    Affects Versions: 1.0-M5
>         Environment: JDK 1.4.2_09 WindowsXP
>            Reporter: Manu T George
>            Assignee: Gianny Damour
>             Fix For: 1.x
>
>         Attachments: CMPContainerBuilder.patch, CMPContainerBuilder.patch, CMRCompoundAccessor.java, CMRMultiplePKAsFKAccessor.java, CompoundPKTransform.patch
>
>
> I have two CMPs with a 1:n relationship.
> CMP1 -  Order - PK = OrderPK which has a single field orderId
> CMP2  - OrderItem = OrderItemPk which has 2 fields InventoryId and order_orderId
> OrderId and order_orderId are mapped
> When i do a setOrder_orderId in the ejbCreate of OrderItem geronimo gives an error during runtime saying cannot set read only field.
> When i don't set it geronimo says partial null key . In this case I set the cmr field in the ejbPostCreate method
>  org.tranql.identity.UndefinedIdentityException: Partial null key
>     at org.tranql.identity.DerivedIdentity.defineIdentity(DerivedIdentity.java:80)
>     at org.openejb.entity.cmp.CMPCreateMethod.execute(CMPCreateMethod.java:175)
>     at org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
>     at org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterceptor.java:56)
>     at org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
>     at org.openejb.entity.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:136)
>     at org.openejb.entity.cmp.InTxCacheInterceptor.invoke(InTxCacheInterceptor.java:90)
>     at org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:119)

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


[jira] Updated: (GERONIMO-1374) Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship

Posted by "Manu T George (JIRA)" <de...@geronimo.apache.org>.
     [ http://issues.apache.org/jira/browse/GERONIMO-1374?page=all ]

Manu T George updated GERONIMO-1374:
------------------------------------

    Attachment: CMPContainerBuilder.patch
                CompoundPKTransform.patch

This Fix involves changes to two classes 
org.openejb.deployment.CMPContainerBuilder (createCMPFieldAccessors() method) and  org.tranql.ejb.CompoundPKTransform (getGlobalIdentity() method)


> Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship
> ------------------------------------------------------------------------------------------
>
>          Key: GERONIMO-1374
>          URL: http://issues.apache.org/jira/browse/GERONIMO-1374
>      Project: Geronimo
>         Type: Bug
>   Components: OpenEJB
>     Versions: 1.0-M5
>  Environment: JDK 1.4.2_09 WindowsXP
>     Reporter: Manu T George
>  Attachments: CMPContainerBuilder.patch, CompoundPKTransform.patch
>
> I have two CMPs with a 1:n relationship.
> CMP1 -  Order - PK = OrderPK which has a single field orderId
> CMP2  - OrderItem = OrderItemPk which has 2 fields InventoryId and order_orderId
> OrderId and order_orderId are mapped
> When i do a setOrder_orderId in the ejbCreate of OrderItem geronimo gives an error during runtime saying cannot set read only field.
> When i don't set it geronimo says partial null key . In this case I set the cmr field in the ejbPostCreate method
>  org.tranql.identity.UndefinedIdentityException: Partial null key
>     at org.tranql.identity.DerivedIdentity.defineIdentity(DerivedIdentity.java:80)
>     at org.openejb.entity.cmp.CMPCreateMethod.execute(CMPCreateMethod.java:175)
>     at org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
>     at org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterceptor.java:56)
>     at org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
>     at org.openejb.entity.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:136)
>     at org.openejb.entity.cmp.InTxCacheInterceptor.invoke(InTxCacheInterceptor.java:90)
>     at org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:119)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (GERONIMO-1374) Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship

Posted by "Manu T George (JIRA)" <de...@geronimo.apache.org>.
     [ http://issues.apache.org/jira/browse/GERONIMO-1374?page=all ]

Manu T George updated GERONIMO-1374:
------------------------------------

    Attachment: CMPContainerBuilder.patch
                CMRCompoundAccessor.java
                CMRMultiplePKAsFKAccessor.java

This patch will fix this issue as well as the issue of multiple CMRFields in the primary key as well as  the issue mentioned below

 Consider a Bean A and a bean B in a one to many CMR relationship
            Here A has 2 fields in the PK say a1 and a2
                    B has b1 fka1 and fka2 as the pk where fka1 and fka2 are the foreign keys corressponding to the a1 and a2 of A.
            In the ejbCreate of B when we set fka1 and fka2 won't OpenEJB throw an error saying that they are readonly fields. This will happen even after  implementing the logic for the special case where the CompoundPK has 1 field.  Is this scenario a valid scenario? If so can we change the check in createCMPFieldAccessors to check for primary key and allow write access to CMR fields if they are parts of Primary Keys? What should be the correct behaviour?

The fix for the first patch is as suggested by Gianny. The CMRCompoundAccessor is used whose get Method has been changed to

    public Object get(InTxCache cache, CacheRow cacheRow) {
        GlobalIdentity globalId = (GlobalIdentity) cmrField.get(cache, cacheRow);
        try {
            Field[] fields = pkClass.getFields();            
            return globalId == null ? 
                    null : fields[0].get(transform.getDomainIdentity(globalId));
        } catch (IdentityTransformException e) {
            throw new EJBException("Unable to create proxy for id " + globalId, e);
        } catch (IllegalArgumentException e) {
            throw new EJBException("Cannot extract value from domain identity", e);
        } catch (IllegalAccessException e) {
            throw new EJBException("Cannot extract value from domain identity", e);
        }
    }
This accessor is used only in the case of Single Field Compound PK
For the second issue another Accessor  CMRMultiplePKAsFKAccessor is used.
This accessor is used only if the cmp field involved in a cmr relationship is a part of the primary key.
Since they are multiple cmp fields involved in cmr the global identity is set only after the last CMR field for which the accessor  CMRMultiplePKAsFKAccessor is used.  For other CMPFields involved in CMR we do not use this accessor as we need to set the GlobalIdentity only once.
The slot numbers are passed to set the different fields in the CompoundPrimaryKey as during set method only 1 field is got but we need other fields to extract the identity.



> Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship
> ------------------------------------------------------------------------------------------
>
>          Key: GERONIMO-1374
>          URL: http://issues.apache.org/jira/browse/GERONIMO-1374
>      Project: Geronimo
>         Type: Bug
>   Components: OpenEJB
>     Versions: 1.0-M5
>  Environment: JDK 1.4.2_09 WindowsXP
>     Reporter: Manu T George
>     Assignee: Gianny Damour
>      Fix For: 1.0.1
>  Attachments: CMPContainerBuilder.patch, CMPContainerBuilder.patch, CMRCompoundAccessor.java, CMRMultiplePKAsFKAccessor.java, CompoundPKTransform.patch
>
> I have two CMPs with a 1:n relationship.
> CMP1 -  Order - PK = OrderPK which has a single field orderId
> CMP2  - OrderItem = OrderItemPk which has 2 fields InventoryId and order_orderId
> OrderId and order_orderId are mapped
> When i do a setOrder_orderId in the ejbCreate of OrderItem geronimo gives an error during runtime saying cannot set read only field.
> When i don't set it geronimo says partial null key . In this case I set the cmr field in the ejbPostCreate method
>  org.tranql.identity.UndefinedIdentityException: Partial null key
>     at org.tranql.identity.DerivedIdentity.defineIdentity(DerivedIdentity.java:80)
>     at org.openejb.entity.cmp.CMPCreateMethod.execute(CMPCreateMethod.java:175)
>     at org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
>     at org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterceptor.java:56)
>     at org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
>     at org.openejb.entity.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:136)
>     at org.openejb.entity.cmp.InTxCacheInterceptor.invoke(InTxCacheInterceptor.java:90)
>     at org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:119)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (GERONIMO-1374) Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship

Posted by "Matt Hogstrom (JIRA)" <de...@geronimo.apache.org>.
     [ http://issues.apache.org/jira/browse/GERONIMO-1374?page=all ]

Matt Hogstrom updated GERONIMO-1374:
------------------------------------

    Fix Version: 1.x
                     (was: 1.0.1)

I would like to see this in 1.0.1 but it looks like it might be disruptive.  I'll defer to Gianny for his opinion but moving to 1.x until someone wants to step up and get this one integrated and tested.

> Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship
> ------------------------------------------------------------------------------------------
>
>          Key: GERONIMO-1374
>          URL: http://issues.apache.org/jira/browse/GERONIMO-1374
>      Project: Geronimo
>         Type: Bug
>   Components: OpenEJB
>     Versions: 1.0-M5
>  Environment: JDK 1.4.2_09 WindowsXP
>     Reporter: Manu T George
>     Assignee: Gianny Damour
>      Fix For: 1.x
>  Attachments: CMPContainerBuilder.patch, CMPContainerBuilder.patch, CMRCompoundAccessor.java, CMRMultiplePKAsFKAccessor.java, CompoundPKTransform.patch
>
> I have two CMPs with a 1:n relationship.
> CMP1 -  Order - PK = OrderPK which has a single field orderId
> CMP2  - OrderItem = OrderItemPk which has 2 fields InventoryId and order_orderId
> OrderId and order_orderId are mapped
> When i do a setOrder_orderId in the ejbCreate of OrderItem geronimo gives an error during runtime saying cannot set read only field.
> When i don't set it geronimo says partial null key . In this case I set the cmr field in the ejbPostCreate method
>  org.tranql.identity.UndefinedIdentityException: Partial null key
>     at org.tranql.identity.DerivedIdentity.defineIdentity(DerivedIdentity.java:80)
>     at org.openejb.entity.cmp.CMPCreateMethod.execute(CMPCreateMethod.java:175)
>     at org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
>     at org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterceptor.java:56)
>     at org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
>     at org.openejb.entity.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:136)
>     at org.openejb.entity.cmp.InTxCacheInterceptor.invoke(InTxCacheInterceptor.java:90)
>     at org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:119)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (GERONIMO-1374) Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship

Posted by "Gianny Damour (JIRA)" <de...@geronimo.apache.org>.
     [ http://issues.apache.org/jira/browse/GERONIMO-1374?page=all ]

Gianny Damour reassigned GERONIMO-1374:
---------------------------------------

    Assign To: Gianny Damour

> Open EJB does not allow the setting of a ForiegnKey that is involved in a CMR relationship
> ------------------------------------------------------------------------------------------
>
>          Key: GERONIMO-1374
>          URL: http://issues.apache.org/jira/browse/GERONIMO-1374
>      Project: Geronimo
>         Type: Bug
>   Components: OpenEJB
>     Versions: 1.0-M5
>  Environment: JDK 1.4.2_09 WindowsXP
>     Reporter: Manu T George
>     Assignee: Gianny Damour
>  Attachments: CMPContainerBuilder.patch, CompoundPKTransform.patch
>
> I have two CMPs with a 1:n relationship.
> CMP1 -  Order - PK = OrderPK which has a single field orderId
> CMP2  - OrderItem = OrderItemPk which has 2 fields InventoryId and order_orderId
> OrderId and order_orderId are mapped
> When i do a setOrder_orderId in the ejbCreate of OrderItem geronimo gives an error during runtime saying cannot set read only field.
> When i don't set it geronimo says partial null key . In this case I set the cmr field in the ejbPostCreate method
>  org.tranql.identity.UndefinedIdentityException: Partial null key
>     at org.tranql.identity.DerivedIdentity.defineIdentity(DerivedIdentity.java:80)
>     at org.openejb.entity.cmp.CMPCreateMethod.execute(CMPCreateMethod.java:175)
>     at org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
>     at org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterceptor.java:56)
>     at org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
>     at org.openejb.entity.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:136)
>     at org.openejb.entity.cmp.InTxCacheInterceptor.invoke(InTxCacheInterceptor.java:90)
>     at org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:119)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira