1. 程式人生 > >Mybatis配置檔案與約束

Mybatis配置檔案與約束

1.Mybatis主配置檔案mybatis.xml

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE configuration

  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"

  "http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>

	<!-- 配置內容 -->

</configuration>

2.mybits 對映檔案mapper.xml

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE mapper

  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"

  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="名稱空間">

	<!-- SQL語句 -->

</mapper>

MyBatis 約束檔案 是約束xml規範的。常見的有2種*.dtd  *.xsd MyBatis的約束檔案位置,都放在jar包裡面 org.apache.ibatis.builder.xml.mybatis-3-config.dtd

org.apache.ibatis.builder.xml.mybatis-3-mapper.dtd