//Google AdSense

제곧내...

 


<update id="companyBoardCountUpadate" parameterType="CompanyBoardContent">
	<selectKey order="BEFORE" keyProperty="companyCount" resultType="String">		
		SELECT 
			c.company_count+1
			from
				tb_company AS c
			where
				c.company_code = #{companyCode}
	</selectKey>
    
    UPDATE tb_company
    	SET
    		company_count= #{companyCount}
    	WHERE 
    		company_code = #{companyCode}
            
</update>

쿼리문도 전부 정상이고 오탈자도 없으며,, DTO에 알맞은 getter, setter도 전부 있었는데!!!!!!!!!!!

org.apache.ibatis.executor.ExecutorException: No setter found for the keyProperty 'companyCount' in java.lang.String.

이 오류로 인해 진행이 안되는 상황이었다..

조언도 구해봤는데 원인을 전혀 모르겠어서 서브쿼리로 처리했다...

마이바티스!!!!!! 나는 너를 믿었는데!! 

 

그래도 서브쿼리로 바꾼 코드가 더 간결해서 기분이 좋아졌다 ~~ ^^~!!

<update id="companyBoardCountUpadate" parameterType="CompanyBoardContent">
	UPDATE tb_company
		SET
			company_count= (SELECT company_count +1)
		WHERE 
			company_code = #{companyCode}
</update>

 

'SpringBoot' 카테고리의 다른 글

[SpringBoot] Batch study...!  (0) 2021.04.28
[SpringBoot] Batch  (0) 2021.04.27
[mybatis] multiple select key  (0) 2020.06.23
파일 업로드  (0) 2020.06.19

+ Recent posts