ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric T. Blue" <ericblu...@gmail.com>
Subject Re: Another n+1 Question NullPointerException
Date Thu, 30 Nov 2006 23:34:21 GMT
Warren,

I believe you'll need to initialize promoPrices on declaration or in the
constructor.

List promoPrices = new ArrayList();

On 11/27/06, Warren <warren@clarksnutrition.com> wrote:
>
> I am getting the following error messages when running an SQL Map:
>
> com.ibatis.dao.client.DaoException:
> Error executing query for list.
> --- The error occurred while applying a result map.
> --- Check the Item.batchedItemPromoResults.
> --- Check the result mapping for the 'promoPrices' property.
> --- Cause: java.lang.NullPointerException
>
> My SQL map:
>
>   <resultMap id="batchedItemPromoResults" class="batchedItemPromos"
> groupBy="item.upc" >
>     <result property="item.invPK" column="INV_PK"  jdbcType="INTEGER"
> nullValue="0"/>
>     <result property="item.invCPK" column="INV_CPK"  jdbcType="INTEGER"
> nullValue="0"/>
>     <result property="item.upc" column="INV_ScanCode" javaType="string"
> jdbcType="CHAR" nullValue="NULL"/>
>     <result property="promoPrices" resultMap="batchedPromoPrices" />
>   </resultMap>
>
>   <resultMap id="batchedPromoPrices" class="promoPrice" >
>     <result property="description" column="PCD_WRKName"
> javaType="string" jdbcType="CHAR" nullValue="NULL"/>
>   </resultMap>
>
>
>     <select id="getBatchedItemPromoPrices"
> resultMap="batchedItemPromoResults">
>      SELECT INV_PK, INV_CPK, INV_ScanCode, PCD_WRKName FROM
> PriceChangeData, v_InventoryMaster, PromotionalSaleWorkSheet, Worksheets
> WHERE INV_PK = PCD_INV_FK AND INV_CPK = PCD_INV_CFK AND PCD_PSW_FK =
> PSW_PK AND PCD_PSW_CFK = PSW_CPK AND PSW_WRK_FK = WRK_PK AND PSW_WRK_CFK
> = WRK_CPK AND INV_ScanCode = '65801011111   ' AND PCD_Permanent = 0
>     </select>
>
> My Objects:
>
> batchedItemPromos with properties
> Item item;
> List promoPrices;
>
> item with properties
> invPK int;
> invCPK int;
> upc String;
>
> promoPrice with properties
> description String;
>
> The static query I am using is for testing and it returns one record.
> How am I getting a NullPointerException? What am I doing wrong?
>
> Thanks,
>
> Warren
>
>

Mime
View raw message