ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Crawford (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Created: (IBATIS-483) Empty/Null resultset from subselect causes NPE
Date Sun, 27 Jan 2008 04:35:34 GMT
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.0
         Environment: Ubuntu Linux, Tomcat 5/6, MySQL
            Reporter: John Crawford
             Fix For: 2.1.7

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.

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 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"/>

	<select id="getLineItems" parameterClass="java.lang.Integer" resultMap="lineItemsBean">
			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
			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
			OI.cart_id = #cart_id#	

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

View raw message