본문으로 바로가기

ibatis to mybatis [query] 수정내역

category JAVA/MYBATIS_IBATIS 2020. 3. 10. 14:29

ibatis to mybatis 툴을 사용할때 수정해줘야하는 내용. 

1. ibatis URL - ibatis.com -> ibatis.apache.org

예전 ibatis.com 이 사라진거 같으니 ibatis.apache.org 로 변경 앞에 www 삭제 해줘야한다.

 

iBATIS Home

iBATIS Project Team Moving to Google Code ANNOUNCEMENT Eight years ago in 2002, I created the iBATIS Data Mapper and introduced SQL Mapping as an approach to persistence layer development. Shortly thereafter, I donated the iBATIS name and code to the Apach

ibatis.apache.org

1-1. 변경 대상

<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd">

1-2. 변경 후

<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">

 

2. migrate.xslt 파일 내용 추가 ibatis <isEmpty><isNotEmpty> 태그 변경을 지원하지 않아 수정

<xsl:template match="isEmpty">
	<xsl:element name="if">
		<xsl:attribute name="test">
			<xsl:if test="substring-before(@property, '.')">
				<xsl:value-of select="substring-before(@property, '.')" /><xsl:text> == null or </xsl:text><xsl:value-of select="substring-before(@property, '.')" /><xsl:text> == '' and </xsl:text>
			</xsl:if>
			<xsl:value-of select="@property" /><xsl:text> == null or </xsl:text><xsl:value-of select="@property" /><xsl:text> == ''</xsl:text>
		</xsl:attribute>
		<xsl:value-of select="@prepend" />
  		<xsl:apply-templates/>
  	</xsl:element>
</xsl:template>

<xsl:template match="isNotEmpty">
	<xsl:element name="if">
		<xsl:attribute name="test">
			<xsl:if test="substring-before(@property, '.')">
				<xsl:value-of select="substring-before(@property, '.')" /><xsl:text> != null and </xsl:text><xsl:value-of select="substring-before(@property, '.')" /><xsl:text> != '' and </xsl:text>
			</xsl:if>
			<xsl:value-of select="@property" /><xsl:text> != null and </xsl:text><xsl:value-of select="@property" /><xsl:text> != ''</xsl:text>
		</xsl:attribute>
		<xsl:value-of select="@prepend" />
  		<xsl:apply-templates/>
  	</xsl:element>
</xsl:template>

 

<xsl:template match="isNotNull">
...
</xsl:template>

//요 부분에 위 코드를 추가

<xsl:template match="isGreaterThan">
...
</xsl:template>

'JAVA > MYBATIS_IBATIS' 카테고리의 다른 글

vo in foreach  (0) 2021.09.10
if 비교 시 java.lang.NumberFormatException  (0) 2020.03.26
ibatis to mybatis [query] error  (0) 2020.03.10
ibatis to mybatis [query]  (0) 2020.03.10