CMP Many-to-Many NullPointerException - Weblogic

This is a discussion on CMP Many-to-Many NullPointerException - Weblogic ; Here is an interesting one that has me stumped. If you could take the time to read ahead, it would be most appreciated. java.lang.NullPointerException at nz.govt.cyf.fundingPlanning.entity.FundingItemEnti tyBean_9q4sq5__WebLogic_CMP_RDBMS_areaTypes_Set.re move(FundingItemEntityBean_9q4sq5__WebLogic_CMP_RD BMS_areaTypes_Set.java:755) at nz.govt.cyf.fundingPlanning.entity.FundingItemEnti tyBean_9q4sq5__WebLogic_CMP_RDBMS_areaTypes_Set.re move(FundingItemEntityBean_9q4sq5__WebLogic_CMP_RD BMS_areaTypes_Set.java:673) at nz.govt.cyf.fundingPlanning.entity.FundingItemEnti tyBean_9q4sq5__WebLogic_CMP_RDBMS_areaTypes_Set.cl ear(FundingItemEntityBean_9q4sq5__WebLogic_CMP_RDB MS_areaTypes_Set.java:510) at ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: CMP Many-to-Many NullPointerException

  1. CMP Many-to-Many NullPointerException


    Here is an interesting one that has me stumped. If you could take the time to read
    ahead, it would be most appreciated.

    java.lang.NullPointerException
    at nz.govt.cyf.fundingPlanning.entity.FundingItemEnti tyBean_9q4sq5__WebLogic_CMP_RDBMS_areaTypes_Set.re move(FundingItemEntityBean_9q4sq5__WebLogic_CMP_RD BMS_areaTypes_Set.java:755)
    at nz.govt.cyf.fundingPlanning.entity.FundingItemEnti tyBean_9q4sq5__WebLogic_CMP_RDBMS_areaTypes_Set.re move(FundingItemEntityBean_9q4sq5__WebLogic_CMP_RD BMS_areaTypes_Set.java:673)
    at nz.govt.cyf.fundingPlanning.entity.FundingItemEnti tyBean_9q4sq5__WebLogic_CMP_RDBMS_areaTypes_Set.cl ear(FundingItemEntityBean_9q4sq5__WebLogic_CMP_RDB MS_areaTypes_Set.java:510)
    at

    Background: I have just added our first many-to-many CMP relationship to our existing
    application consisting of a large number of CMP Entity Beans.

    The descriptors below show that the FP_FUNDING_ITEMS (FundingItemEntity) table
    has a many to many relationship with FP_AREA_TYPES_V (AreaTypeEntity), bridged
    by the joining table FP_FUNDING_ITEM_AREAS (simply a table with foreign keys to
    the outer tables). The outer tables naturally have entities, where the joining
    table does not. FP_AREA_TYPES_V is a read-only table.

    The FundingItemEntity thus contains a Collection of AreaTypeEntities, where the
    Collection actually resolves into records on the joining/bridging table.

    I can successfully create a FundingItemEntity with a Collection of AreaTypeEntities,
    which creates records in FP_FUNDING_ITEM_AREAS.

    The problem occurs when I attempt to update the Collection of AreaTypeEntities
    on an existing FundingItemEntity. I get a NullPointerException in the depths of
    the CMP generated source!

    Looking at the stack trace, when I attempt to overwrite the existing collection,
    the container attempts to first remove the existing records. Sounds fine to me,
    but why a NullPointer, I canít fathom.

    Within the FundingItemEntityBean, my update code looks like this:

    //get the area home
    AreaTypeEntityHome areaTypeHome= (AreaTypeEntityHome)ServiceCallState.getInstance() .ejbLocalLookup("AreaTypeEntity");
    Collection areaTypeEntities = null; //will always be instantiated below as areas
    always exist
    //iterate through the new area idís, obtain the associated entities and add them
    to a Collection
    for (Iterator i=pDTO.getAreaCodes().iterator(); i.hasNext() {
    if (areaTypeEntities == null) {
    areaTypeEntities = new ArrayList(pDTO.getAreaCodes().size());
    }
    //Use the idís to find the actual area entities
    AreaTypeEntity areaType = areaTypeHome.findByPrimaryKey((String)i.next());
    //add the entities to the Collection
    areaTypeEntities.add(areaType);
    }
    //add the Collection of area entities to the funding item entity
    this.setAreaTypes(areaTypeEntities); // FundingItemEntityBean.updateFromDTO line
    503

    It is at this point where I get the NullPointerException above.

    Whilst remote debugging through the following unattractive generated source, I
    notice that the last line is where the NullPointerException is thrown. The ďgetAddSet()Ē
    returns null.

    If you donít know what the problem is, but you do know what the addSet is meant
    to be/contain, Iím all ears as this would at least give me something to investigate
    further.

    __WL_bean.__WL_setMethodState(WLEnterpriseBean.STA TE_BUSINESS_METHOD);
    RDBMSM2NSet __WL_collection = (RDBMSM2NSet)
    __WL_bean.getFundingItemEntityBean_areaTypes();
    __WL_collection.doRemove(__WL_createEo);
    // remove from other cached INSERT AddSet if entry exists
    __WL_collection.getAddSet().remove(__WL_createPk);

    P.S. My descriptors are as follows:


    fundingItemEntity-areaTypeEntity
    FP_FUNDING_ITEM_AREAS

    FundingItemEntityRelationshipRole

    FUNDING_ITEM_ID
    ID


    FP_FUNDING_ITEM_AREAS
    FP_FUNDING_ITEMS

    FUNDING_ITEM_ID
    ID




    AreaTypeEntityRelationshipRole

    AREA_CODE
    CODE


    FP_FUNDING_ITEM_AREAS
    FP_AREA_TYPES_V

    AREA_CODE
    CODE






  2. Re: CMP Many-to-Many NullPointerException (RESOLVED)


    This has been resolved by BEA.

    "Mobes" wrote:
    >
    >Here is an interesting one that has me stumped. If you could take the
    >time to read
    >ahead, it would be most appreciated.
    >
    >java.lang.NullPointerException
    > at nz.govt.cyf.fundingPlanning.entity.FundingItemEnti tyBean_9q4sq5__WebLogic_CMP_RDBMS_areaTypes_Set.re move(FundingItemEntityBean_9q4sq5__WebLogic_CMP_RD BMS_areaTypes_Set.java:755)
    > at nz.govt.cyf.fundingPlanning.entity.FundingItemEnti tyBean_9q4sq5__WebLogic_CMP_RDBMS_areaTypes_Set.re move(FundingItemEntityBean_9q4sq5__WebLogic_CMP_RD BMS_areaTypes_Set.java:673)
    > at nz.govt.cyf.fundingPlanning.entity.FundingItemEnti tyBean_9q4sq5__WebLogic_CMP_RDBMS_areaTypes_Set.cl ear(FundingItemEntityBean_9q4sq5__WebLogic_CMP_RDB MS_areaTypes_Set.java:510)
    > at
    >
    >Background: I have just added our first many-to-many CMP relationship
    >to our existing
    >application consisting of a large number of CMP Entity Beans.
    >
    >The descriptors below show that the FP_FUNDING_ITEMS (FundingItemEntity)
    >table
    >has a many to many relationship with FP_AREA_TYPES_V (AreaTypeEntity),
    >bridged
    >by the joining table FP_FUNDING_ITEM_AREAS (simply a table with foreign
    >keys to
    >the outer tables). The outer tables naturally have entities, where the
    >joining
    >table does not. FP_AREA_TYPES_V is a read-only table.
    >
    >The FundingItemEntity thus contains a Collection of AreaTypeEntities,
    >where the
    >Collection actually resolves into records on the joining/bridging table.
    >
    >I can successfully create a FundingItemEntity with a Collection of AreaTypeEntities,
    >which creates records in FP_FUNDING_ITEM_AREAS.
    >
    >The problem occurs when I attempt to update the Collection of AreaTypeEntities
    >on an existing FundingItemEntity. I get a NullPointerException in the
    >depths of
    >the CMP generated source!
    >
    >Looking at the stack trace, when I attempt to overwrite the existing
    >collection,
    >the container attempts to first remove the existing records. Sounds fine
    >to me,
    >but why a NullPointer, I canít fathom.
    >
    >Within the FundingItemEntityBean, my update code looks like this:
    >
    >//get the area home
    >AreaTypeEntityHome areaTypeHome= (AreaTypeEntityHome)ServiceCallState.getInstance() .ejbLocalLookup("AreaTypeEntity");
    >Collection areaTypeEntities = null; //will always be instantiated below
    >as areas
    >always exist
    >//iterate through the new area idís, obtain the associated entities and
    >add them
    >to a Collection
    >for (Iterator i=pDTO.getAreaCodes().iterator(); i.hasNext() {
    > if (areaTypeEntities == null) {
    > areaTypeEntities = new ArrayList(pDTO.getAreaCodes().size());
    > }
    > //Use the idís to find the actual area entities
    > AreaTypeEntity areaType = areaTypeHome.findByPrimaryKey((String)i.next());
    > //add the entities to the Collection
    > areaTypeEntities.add(areaType);
    >}
    >//add the Collection of area entities to the funding item entity
    >this.setAreaTypes(areaTypeEntities); // FundingItemEntityBean.updateFromDTO
    >line
    >503
    >
    >It is at this point where I get the NullPointerException above.
    >
    >Whilst remote debugging through the following unattractive generated
    >source, I
    >notice that the last line is where the NullPointerException is thrown.
    >The ďgetAddSet()Ē
    >returns null.
    >
    >If you donít know what the problem is, but you do know what the addSet
    >is meant
    >to be/contain, Iím all ears as this would at least give me something
    >to investigate
    >further.
    >
    >__WL_bean.__WL_setMethodState(WLEnterpriseBean.STA TE_BUSINESS_METHOD);
    >RDBMSM2NSet __WL_collection = (RDBMSM2NSet)
    >__WL_bean.getFundingItemEntityBean_areaTypes();
    >__WL_collection.doRemove(__WL_createEo);
    >// remove from other cached INSERT AddSet if entry exists
    >__WL_collection.getAddSet().remove(__WL_createPk);
    >
    >P.S. My descriptors are as follows:
    >
    >
    > fundingItemEntity-areaTypeEntity
    > FP_FUNDING_ITEM_AREAS
    >
    > FundingItemEntityRelationshipRole
    >
    > FUNDING_ITEM_ID
    > ID
    >

    >
    > FP_FUNDING_ITEM_AREAS
    > FP_FUNDING_ITEMS
    >
    > FUNDING_ITEM_ID
    > ID
    >

    >

    >

    >
    > AreaTypeEntityRelationshipRole
    >
    > AREA_CODE
    > CODE
    >

    >
    > FP_FUNDING_ITEM_AREAS
    > FP_AREA_TYPES_V
    >
    > AREA_CODE
    > CODE
    >

    >

    >

    >

    >



+ Reply to Thread