[
https://issues.apache.org/jira/browse/IBATIS-483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708532#action_12708532
]
Kai Grabfelder commented on IBATIS-483:
---------------------------------------
I can't reproduce this within a unit test within the current iBATIS trunk.
SqlMapExecutorDelegate.java:734 in 2.3.4 looks like:
txManager.end(sessionScope);
So the only thing causing a NPE could be a null txManager.
I guess there must be something wrong with your transaction configuration.
Could you please check this? A unit test showing the exception against the
current iBATIS trunk would also be highly anticipated
> Empty/Null resultset from subselect causes NPE
> ----------------------------------------------
>
> Key: IBATIS-483
> URL: https://issues.apache.org/jira/browse/IBATIS-483
> Project: iBatis for Java
> Issue Type: Bug
> Components: SQL Maps
> Affects Versions: 2.3.2, 2.3.3, 2.3.4
> Environment: Ubuntu Linux, Tomcat 5/6, MySQL
> Reporter: John Crawford
> Fix For: 2.3.5
>
> Attachments: ibatis-npe.txt
>
>
> When doing a subselect (using maps), I get a NPE when the result of the
> subselect is null/empty. I believe that this occurs in every version since
> 2.1.7, but unfortunately, I have to stick with 2.1.7 because of this issue.
> (And, of course, the maven repos only have 2.3, so I have to do an annoying
> workaround for it)
> Example Code: (Issue is with the lineItems mapping from the first resultMap)
> <resultMap class="com.acp.beans.OrderCart" id="cartBean">
> <result property="id" column="cart_id"/>
> <result property="orderId" column="order_id" nullValue="-1"/>
> <result property="lineItems" column="cart_id"
> select="getLineItems"/>
> <result property="user" column="user_id" select="getUserById"/>
> <result property="created" column="create_dt"/>
> </resultMap>
> <resultMap class="com.acp.beans.OrderItems" id="lineItemsBean">
> <result property="id" column="order_item_id" />
> <result property="cartId" column="cart_id"/>
> <result property="quantity" column="quantity"/>
> <result property="orderPictureBean" column="picture_id"
> select="getOrderPictures"/>
> <result property="pictureSize.id" column="picture_size_id"/>
> <result property="pictureSize.title"
> column="picture_size_title"/>
> <result property="pictureSize.cost" column="picture_size_cost"/>
> <result property="pictureSize.pictureUrl"
> column="picture_size_link_url_th"/>
> <result property="pictureType.id" column="picture_type_id"/>
> <result property="pictureType.title"
> column="picture_type_title"/>
> <result property="pictureType.cost" column="picture_type_cost"/>
> </resultMap>
> <select id="getLineItems" parameterClass="java.lang.Integer"
> resultMap="lineItemsBean">
> SELECT
> OI.cart_id,
> OI.order_item_id,
> OI.quantity,
> OI.picture_id,
> OI.picture_size as picture_size_id,
> PS.title AS picture_size_title,
> PS.cost AS picture_size_cost,
> PS.link_url_th AS picture_size_link_url_th,
> OI.picture_type as picture_type_id,
> PT.title AS picture_type_title,
> PT.cost AS picture_type_cost
> FROM
> tb_OrderItem OI
> JOIN tb_PictureSize PS on PS.picture_size_id =
> OI.picture_size
> JOIN tb_PictureType PT on PT.picture_type_id =
> OI.picture_type
> WHERE
> OI.cart_id = #cart_id#
> </select>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.