No problem.
However, I still cannot see the definition of the subselect
'PurchaseHdrAddr.getPurchaseHdrAddr_shipTo', I think there's the
problem. Result class has been set to java.lang.String, which obviously
does not have a 'orderNo' property.
Niels
-----Original Message-----
From: Voorhoeve, Niels {PBG} [mailto:[EMAIL PROTECTED]
Sent: maandag 20 maart 2006 22:50
To: [email protected]
Subject: RE: Complex property question
Sure. See the following. Thanks for the help.
I had originally used order_no in the column attribute in
PurchaseHeader-report resultMap, but that didn't work, so I tried the
"order_no as such_and_such" stuff below that I mentioned in my original
email.
<sqlMap namespace="PurchaseHeader">
<typeAlias alias="PurchaseHeader"
type="com.pbg.aps.model.PurchaseHeader" />
<resultMap class="PurchaseHeader" id="PurchaseHeader-result">
<result property="orderNo" javaType="java.lang.String"
column="order_no" />
... Some other result columns...
</resultMap>
<resultMap class="PurchaseHeader" id="PurchaseHeader-report"
extends="PurchaseHeader-result">
<result property="purchaseDetails"
column="purchase_details"
select="PurchaseDetail.getPurchaseDetail"/>
<result property="shipToAddress"
column="ship_to_address"
select="PurchaseHdrAddr.getPurchaseHdrAddr_shipTo"/>
<result property="chargeToAddress"
column="charge_to_address"
select="PurchaseHdrAddr.getPurchaseHdrAddr_chargeTo"/>
<result property="requestorAddress"
column="requestor_address"
select="PurchaseHdrAddr.getPurchaseHdrAddr_requestor"/>
<result property="shipFromAddress"
column="{supplierNo=supplier_no,supplierLocationNo=supplier_location_no}
"
select="SupplierLocation.getSupplierLocation"/>
<result property="supplier"
column="supplier_no"
select="Supplier.getSupplier"/>
</resultMap>
<select id="getPurchaseHeader_Report"
parameterClass="java.lang.String"
resultMap="PurchaseHeader-report"
cacheModel="PurchaseHeader-cache">
select
t.order_no as purchase_details,
t.order_no as ship_to_address,
t.order_no as charge_to_address,
t.order_no as requestor_address,
t.order_no
...some other columns...
FROM dbo.PURCHASE_HEADER t where order_no = #value#
</select>
-----Original Message-----
From: Niels Beekman [mailto:[EMAIL PROTECTED]
Sent: Monday, March 20, 2006 2:02 PM
To: [email protected]
Subject: RE: Complex property question
Hi Niels,
Can we see the definition of
'PurchaseHdrAddr.getPurchaseHdrAddr_shipTo'?
This should definitely work...
Niels :)
-----Original Message-----
From: Voorhoeve, Niels {PBG} [mailto:[EMAIL PROTECTED]
Sent: maandag 20 maart 2006 18:40
To: [email protected]
Subject: Complex property question
Hi,
I have a class PurchaseHeader with several complex address properties
(shipToAddress, chargeToAddress, requestorAddress) that are all keyed by
PurchaseHeader.orderNo. I am trying to map the addresses to the correct
property, but Ibatis is complaining about my result map (see the result
map below). Is there a way to map this kind of relationship? Do I have
to tweak the select to return order_no 3 more times under different
names?
<resultMap class="PurchaseHeader" id="PurchaseHeader-report"
extends="PurchaseHeader-result">
<result property="shipToAddress"
column="order_no"
select="PurchaseHdrAddr.getPurchaseHdrAddr_shipTo"/>
<result property="chargeToAddress"
column="order_no"
select="PurchaseHdrAddr.getPurchaseHdrAddr_chargeTo"/>
<result property="requestorAddress"
column="order_no"
select="PurchaseHdrAddr.getPurchaseHdrAddr_requestor"/>
</resultMap>
<resultMap class="PurchaseHeader" id="PurchaseHeader-result">
<result property="orderNo" javaType="java.lang.String"
column="order_no" />
.
.
.
</resultMap>
The error:
--- Check the PurchaseHeader.PurchaseHeader-report.
--- Check the result mapping for the 'shipToAddress' property.
--- Cause: com.ibatis.common.beans.ProbeException: There is no READABLE
property named 'orderNo' in class 'java.lang.String'