You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by John Chien <jo...@ncmail.net> on 2008/12/01 21:45:33 UTC
Define Hashmap
Dear sir:
This is my first time of using HashMap.
I defined the following structure and statement.
Are they correct ?
What is the key for the HashMap ?
<resultMap id="facilityIdBEAN" class="java.util.HashMap">
<result property="facilityId" column="facility_id",
<result property="countyId" column="county",
<result property="facilityType" column="type",
<result property="seqNo" column="seq_no"
</resultMap>
<statement id="getCountyFacilityMap" parameterClass="java.util.String"
resultMap="facilityIdBEAN">
SELECT LPAD(COUNTY_ID, 3,'0') || LPAD(FAC_TYPE, 2,'0') ||
LPAD(FAC_ID_NUMBER, 4,'0') as facility_id,
COUNTY_ID
as county,
FAC_TYPE
as type,
FAC_ID_NUMBER
as seq_no
FROM EH.BETS_FACILITY
WHERE COUNTY_ID = #value#
</statement>
Thanks,
John Chien
Re: Define Hashmap
Posted by Rick <ri...@gmail.com>.
2008/12/1 John Chien <jo...@ncmail.net>
> Dear sir:
>
> This is my first time of using HashMap.
> I defined the following structure and statement.
>
> Are they correct ?
> What is the key for the HashMap ?
>
> <resultMap id="facilityIdBEAN" class="java.util.HashMap">
> <result property="facilityId" column="facility_id",
> <result property="countyId" column="county",
> <result property="facilityType" column="type",
> <result property="seqNo" column="seq_no"
> </resultMap>
>
>
> <statement id="getCountyFacilityMap" parameterClass="java.util.String"
> resultMap="facilityIdBEAN">
> SELECT LPAD(COUNTY_ID, 3,'0') || LPAD(FAC_TYPE, 2,'0') ||
> LPAD(FAC_ID_NUMBER, 4,'0') as facility_id,
> COUNTY_ID
> as
> county,
> FAC_TYPE
>
> as type,
> FAC_ID_NUMBER
> as
> seq_no
> FROM EH.BETS_FACILITY
> WHERE COUNTY_ID = #value#
> </statement>
>
> Thanks,
>
The map keys will be your property fields you defined in your facilityIdBEAN
resultMap.