table-mapping tag를 전혀 기술할 필요가 없다. 조회한 결과의 column명 또는 alias명과
동일한 attribute명으로 자동 mapping이 되기 때문이며 테이블의 column명이 "_" 를 이용하는 형태이더라도 camel-case로 변경하여 mapping하므로 문제가 발생하지 않는다.| query | 쿼리문을 정의 한다.
* attribute설명
isDynamic : 동적 쿼리인지 아닌지 식별
(기존Query 서비스는 default가 false이었으나 true로 변경) |
statement(필수) param, result(선택) |
| statement | 사용하고자 하는 쿼리문을 정의한다. Joined 쿼리에서 동일한 조회 칼럼명이 있을 경우, Alias 명을 부여해야 한다. | |
| param | 기존 Query 서비스는 param tag를 입력 Parameter의 개수와 순서에 맞게 추가하고 입력 Parameter의
SQL Type을 jdk API java.sql.Types에 정의된 값을 참조하여 param tag의 attribute인 type에 정의하여야
하였으나 Extended Query 서비스는 정의할 필요가 없다. default가 동적 query로 VO의 attribute의 type을
자동 인지하여 입력하기 때문이다.
* attribute 설정 type : parameter의 DBMS type binding : CallableStatement경우 'IN' 또는 'OUT'를 선택 name : CallableStatement경우 Stored Procedure의 변수 이름 설정 |
|
| result | 해당 쿼리가 SELECT문일 경우에 사용하며, 쿼리 수행 결과를 저장할 클래스명을 정의한다.
result tag가 지정되지 않았을 경우 쿼리 수행 결과에 대해 하나의 Row별로 칼럼명, 해당값을 쌍으로 Map에 put하고
Map들을 ArrayList에 담은 형태로 결과값을 리턴하게 된다.
* attribute 설명 class : 수행 결과를 저장할 클래스명 |
result-mapping(선택) |
| result-mapping | 기존 Query 서비스의 경우 수행 결과를 저장할 클래스와 매핑되는 테이블이 존재하지 않을 경우,
조회된 칼럼별로 이에 매핑되는 해당 클래스의 attribute 명을 정의하여야 하였으나 table-mapping tag와 마찬가지로
자동 mapping이 이루어지므로 정의할 필요가 없다.
* attribute 설명 column : 조회된 칼럼명 attribute : 정의한 칼럼에 매핑되는 클래스의 attribute명 |
<queryservice>
<!-- skipped -->
<queries>
<query id="selectGeneral">
<statement>
SELECT * FROM TBL_CUSTOMER WHERE SSNO like :vo.ssno
</statement>
</query>
</queries>
</queryservice>
<queryservice>
<!-- skipped -->
<queries>
<query id="select">
<statement>
SELECT * FROM TBL_CUSTOMER WHERE SSNO like ?
</statement>
<result class="integration.anyframe.services.query.vo.CustomerVO"/>
</query>
</queries>
</queryservice>
<queryservice>
<!-- skipped -->
<queries>
<query id="dynamicsample">
<statement>select NAME, ADDRESS from TBL_CUSTOMER
where NAME like :vo.name
#if($vo.key.equals("true"))
OR NAME like '%test%'
#end>
</statement>
</query>
</queries>
</queryservice>
<queryservice>
<!-- skipped -->
<queries>
<query id="lobsample">
<statement>insert into binary values($vo.key,$vo.contents)</statement>
</query>
</queries>
</queryservice>