ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: Complex property question
Date Tue, 21 Mar 2006 17:32:40 GMT
Hi,

You defined the following:

<resultMap class="PurchaseHeader" id="PurchaseHeader-report"
extends="PurchaseHeader-result">
  <result property="shipToAddress" column="ship_to_address"
select="PurchaseHdrAddr.getPurchaseHdrAddr_shipTo"/>
... some more
</resultMap>

When you access the 'shipToAddress' property, iBATIS passes the value of
the specified column 'ship_to_address' to the specified select query '
PurchaseHdrAddr.getPurchaseHdrAddr_shipTo'. This value is as far as I
can see a java.lang.String.

The definition of 'PurchaseHdrAddr.getPurchaseHdrAddr_shipTo' specifies
'PurchaseHdrAddr' as parameterClass, this is not correct and should be
java.lang.String, hence iBATIS complains about not being able to access
property 'orderNo' from your java.lang.String parameter.

Changing value of parameterClass should fix the problem, or if you need
that select to get shipping address of a PurchaseHdrAddr-class,
introduce a new select.

Niels

BTW 'single column could be the source
for several properties' should work just fine...

-----Original Message-----
From: Voorhoeve, Niels {PBG} [mailto:niels.voorhoeve@pepsi.com] 
Sent: dinsdag 21 maart 2006 17:56
To: Niels Beekman
Subject: RE: Complex property question

What's up Niels?  I was hoping that a single column could be the source
for several properties, but it seems not.  Sometimes it seems like the
documentation is a bit lacking as far as proscribing the limits of what
can be accomplished.  Here's the subselect nonetheless:

Cheers,
Niels

    <resultMap class="PurchaseHdrAddr" id="PurchaseHdrAddr-result" >
        <result 
                property="orderNo" 
                javaType="java.lang.String"
                column="order_no" 
        />
        <result 
                property="addressType" 
                javaType="java.lang.String"
                column="address_type" 
        />
	  ...
    </resultMap>


    <select id="getPurchaseHdrAddr_shipTo" 
    	parameterClass="PurchaseHdrAddr" 
    	resultMap="PurchaseHdrAddr-result" 
    	cacheModel="PurchaseHdrAddr-cache">
        select * from PURCHASE_HDR_ADDR where address_type = 3
        <dynamic>
        	<isNotEmpty prepend="and" property="orderNo">
        		order_no = #orderNo#
        		</isNotEmpty>
        </dynamic>
    </select> 

<snip>


Mime
View raw message