[MyBatis] selectKey

갓김치·2021년 6월 1일
0

work

목록 보기
4/10

1번 방식

mysql auto-inc를 쓸때, auto-inc된 값이 필요할 때 selectKey 쓰는 방식
https://yookeun.github.io/java/2014/07/11/mybatis-selectkey/

2번 방식

 <insert id="insertBoard"
            parameterType="{packagePath}.BoardVO"
            useGeneratedKeys="true"
            keyProperty="boardNo">
 ...
 </insert>
  • 이렇게 해도 알아서 매핑이 되는군
profile
갈 길이 멀다

0개의 댓글