목록Server/Mybatis (.xml) (9)
써먹는 웹개발
resultType에 LinkedHashMap 추가 1 2 Colored by Color Scripter cs
에러메시지 : Could not set parameter at position 1 (values was 10) 원인 : 나의 경우 #{파라미터명} 대신에 ?를 추가해서 생긴 현상 해결방법 : Mybatis 소스에서 ? 대신 #{파라미터명}으로 변경
SELECT * FROM board fetchSize 미 입력시 (기본 값) 10 fetchSize 가 10 이면 5000건을 조회하면 실제 db에서 500번을 조회 fetchSize 가 1000 이면 5번만 조회 MYbatis fetchSize 설정 :: 또리야 개발하자 - https://ddoriya.tistory.com/entry/MYbatis-fetchSize-%EC%84%A4%EC%A0%95
Spring 환경에서 구현한 소스입니다. 1. view 소스 ※ 벨로시티 문법 1 2 3 4 5 6 #foreach($row in $List) if($foreach.index == 0) { vStr = $row.parentCrsCode; } vStr += "," + $row.courseCode; #end Colored by Color Scripter cs 1 courseNos = vStr; cs 결과 : '0,1,2' 2. vo파일 1 2 3 4 5 6 7 8 9 private String courseNos; public String getCourseNos() { return courseNos; } public void setCourseNos(String courseNos) { this.courseNos..
Mybatis가 XML에 정의하기 때문에 부등호를 그냥 쓰면 오류가 나는데 태그에 존재하는 꺽쇠랑 동일하기 때문에 파싱에러가 난다. 문법은 예시 select * from A where A.START_DATE > TO_CHAR(sysdate,'yyyy-mm-dd') ]]>
1. Array 파라미터를 넘길때 AND 컬럼명 IN #{item} 2. Array 파라미터를 안 넘길때 service 부분 package kr.co.develop.service; import ...; @... public class CmCodeService { // 파라미터값이 없을때 public static boolean isEmpty(Object obj){ if( obj instanceof String ) return obj==null || "".equals(obj.toString().trim()); else if( obj instanceof List ) return obj==null || ((List)obj).isEmpty(); else if( obj instanceof Map ) return o..
*Mapper.xml에 databaseId를 명시한게 에러 원인중 하나입니다.
MyBatis / iBatis에서 조건절에 Like 검색시 처리하는 방법이다. 검색하고자 하는 필드명이 "title" 이고 해당 필드에서 검색할 내용을 파라미터를 "keyword" 라고 하면 아래와 같이 검색할 수 있다. [MySQL] title like CONCAT('%',#{keyword},'%') [Oracle] title like '%' || #{keyword} || '%' [MSSQL] title like '%' + #{keyword} + '%' 출처: https://fruitdev.tistory.com/60 [과일가게 개발자]