It would probably easier to do it in the SQL statement, then pass the parameter from there. Either way you are hard coding it, so take the simlper path.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That's the way i'am doing it now. It meens i have to define 9 maped statements with the only difference the parameterin it (in my example i only have 2 properties, but in real it are 9). So i hoped there is an other way.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Is it possible to pass a string value, together with the columns, to a mapped statement in a result map?
example:
<result-map name="materialclassification-result" class="com.mhc.domain.MaterialClassification">
<property name ="subsector" column="{code=SUBSECTOR_CODE,version=VERSION_CODE,typeOfClass='Material Subsector'}" mapped-statement="getClassificationDescription"/>
<property name ="brand" column="{code=SUBSECTOR_CODE,version=VERSION_CODE,typeOfClass='Material Brand'}" mapped-statement="getClassificationDescription"/>
The typeOfClass parameter is a string and is used in the getClassificationDescription query.
<mapped-statement name="getClassificationDescription"
cache-model="cr-desc-cache"
result-class="java.lang.String">
select DESCRIPTION from MHC_CLASSIFICATION_REFERENCES
where VERSION_CODE = #version#
and CODE = #code#
and CLASS_TYPE = #typeOfClass#
</mapped-statement>
I'am using iBatis 1.3.1
Cheers
Roel
It would probably easier to do it in the SQL statement, then pass the parameter from there. Either way you are hard coding it, so take the simlper path.
That's the way i'am doing it now. It meens i have to define 9 maped statements with the only difference the parameterin it (in my example i only have 2 properties, but in real it are 9). So i hoped there is an other way.