Mybatice-config.xml에
<configuration><!--이태그 안에 써준다-->
<typeAliases>
<typeAlias type="com.kh.junspring.member.domain.Member" alias="Member"/>
</typeAliases>
typeAliase 태그를 넣어준다.
그럼 Mapper클래스에서
<resultMap type="Member" id="memberResultMap">
<id property="memberId" column="MEMBER_ID"/>
<result property="memberPw" column="MEMBER_PWD"/>
<result property="memberName" column="MEMBER_NAME"/>
<result property="memberEmail" column="MEMBER_EMAIL"/>
<result property="memberPhone" column="MEMBER_PHONE"/>
<result property="memberAddress" column="MEMBER_ADDR"/>
<result property="endrollDate" column="ENROLL_DATE"/>
<result property="updateDate" column="UPDATE_DATE"/>
<result property="status" column="M_STATUS"/>
</resultMap>
resultMap의 type을 alias의 값은 Member로 축약가능하다
<select id="selectCount" resultType="_int">
select count(*) from member_tbl where member_id = #{memberId} and m_status='y'
</select>
resultMap이 아니라 resultType을 _int로 선언해주어야 한다.
Mybatice-config.xml에
<configuration>
<!--바로 밑에 써준다-->
<settings>
<setting name="jdbcTypeForNull" value="NULL"/>
<!-- null값이 있으면 null로 제대로 인식하게 한다. -->
</settings>
Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property
만약에 null 데이터가 전달되었으면 빈칸이 아닌 NULL로 인식하도록 설정