Monday, 24 September 2012

IBATIS 2 SQL Map : Contoh hantar lebih 1 parameter gunakan java.util.Map

Contoh kita ada function dalam DAO IMPL:
public List<StaffSupervise> getExtSuperviseList(String staffId, String superviseCategory, String communityServiceType)
Map<String,String> paramMap = new HashMap<String, String>();
paramMap.put("p_staff_id", staffId);
paramMap.put("p_supervise_category", superviseCategory);
paramMap.put("p_comm_srvc_type", communityServiceType);

List<StaffSupervise> list = this.getSqlMapClientTemplate().queryForList("STAFF_SUPERVISE.getStaffExtSuperv", paramMap);
return list;
} catch (Exception e){
return new ArrayList<StaffSupervise>();

Utk SQL Mapping pula 
(since structure CV-Online dgn APR berbeza sikit, abaikan perbezaan naming mapping.)

  <select id="STAFF_SUPERVISE.getStaffExternalSuperviseByCategoryAndSrvcType" resultMap="StaffSuperviseResultMap_3" parameterClass="java.util.Map" >
select ss.*,
om_name institution_desc, ql_desc level_desc, null duration_month
from staff_supervise ss, organization_main, qualification_level
where ss_institution = om_seq(+)
and ss_supervise_level = ql_code(+)
and ss_supervise_category = #p_supervise_category#
and ss_supervise_type = #p_comm_srvc_type#
and ss_staff_id = #p_staff_id#

Dev info:
Code = APR, CV-Online
Framework = SPRING 2.5.6, IBATIS 2

Thursday, 20 September 2012

Displaytag: Nota format Date

<display:table name="${trainingYear.trainingList}" class="dataTable" uid="row" export="false" excludedParams="*" varTotals="totals">
<display:column style="text-align:center;width:100px;"  titleKey=""  escapeXml="false">
<fmt:formatDate type="date" value="${row.stStartDate}" pattern="dd-MMM-yyyy" />


Ok, sekarang aku xnak hard-code dd-MMM-yyyy, tapi aku nak camni:
  1. masukkan dlm message bundle, code = dd-MMM-yyyy
  2. pada page untuk display:
    • gunakan <spring:message /> untuk set 1 variable, katakan namanya datePattern
    • gunakan datePattern tu pada property pattern dalam <fmt:formateDate />
Untuk info lanjut pasal displaytag ni leh gi ke page

Tuesday, 18 September 2012

STS: something wrong with MAVEN's project nature

Something wrong with a new project imported from SVN since no Maven's project nature embedded.

Right click project folder >> Maven >> Enable Dependency Management

Saturday, 8 September 2012

STS: Web Project Settings >> Context root

Something weird happen when migrate ISAS to APR.
The root still point to ISAS while APR was expected.