jeongwon
[Error] mybatis - There is no getter for property named 'table' in 'class java.lang.String' 본문
Error log
[Error] mybatis - There is no getter for property named 'table' in 'class java.lang.String'
jeongwon_ 2022. 11. 2. 15:20오류: There is no getter for property named 'table' in 'class java.lang.String'
상황: mybatis 구문에서 테이블명을 변수로 받고자 함. 변수명은 ${table}로 설정.
- DAOImpl:
sqlSession.selectOne("admin.countReservAll", table);
- mybatis sql:
<select id="countReservAll" resultType="int">
select count(*) from ${table}
</select>
해결:
변수명을 ${valu} 로 설정.
mabatis parametertype에서 String을 쓰면 ${value} 작성시 getter 역할을 한다고.
다만 Sql Injection 대비 (사용자의 입력이 DB Query 에 동적으로 영향을 주는 경우, 입력된 값이 개발자가 의도한 값(요효값) 인지 검증)가 필요하다고 한다.
'Error log' 카테고리의 다른 글
[Error] org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "id") (0) | 2022.11.08 |
---|---|
[참고] 영문 자간이 넓어졌을 때 (0) | 2022.11.02 |
[Error] ORA-02292: integrity constraint (~.SYS_C007946) violated - child record found (0) | 2022.10.28 |
[Error] String <-> Date (0) | 2022.10.27 |
[Error] java.sql.SQLException: 부적합한 열 유형: 1111 (0) | 2022.10.26 |