天天看點

使用 MyBatis 必看兩篇文檔導讀:MyBatis 與 MyBatis-Spring

使用 MyBatis 必看兩篇文檔導讀:MyBatis 與 MyBatis-Spring

<a target="_blank" href="http://blog.csdn.net/opengl_es">轉載請保留此句:太陽火神的美麗人生 -  本部落格專注于 靈活開發及移動和物聯裝置研究:iOS、Android、Html5、Arduino、pcDuino,否則,出自本部落格的文章拒絕轉載或再轉載,謝謝合作。</a>

MyBatis 是支援定制化 SQL、存儲過程以及進階映射的優秀的持久層架構。MyBatis 避免了幾乎所有的 JDBC 代碼和手工設定參數以及抽取結果集。MyBatis 使用簡單的 XML 或注解來配置和映射基本體,将接口和 Java 的 POJOs(Plain Old Java Objects,普通的 Java對象)映射成資料庫中的記錄。

不管你以何種方式發現了文檔的不足,或是某些特性尚且沒有文檔,則你可以做的最好的事情莫過于去研究它并把文檔寫出來。

你将成為這個文檔的最佳作者,像你一樣的使用者定會過來查閱的。

其他語言版本(Users can read about MyBatis in following translations):

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/getting-started.html">English</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/es/index.html">Español</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/ja/index.html">日本語</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/ko/index.html">한국어</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/zh/index.html">簡體中文</a>

Do you want to read about MyBatis in your own native language? Fill an issue providing patches with your mother tongue documentation!

參考文檔

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/index.html">簡介</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/getting-started.html">入門</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/configuration.html">XML 配置</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/sqlmap-xml.html#">XML 映射檔案</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/sqlmap-xml.html#select">select</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/sqlmap-xml.html#insert_update_and_delete">insert, update and delete</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/sqlmap-xml.html#Parameters">Parameters</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/sqlmap-xml.html#Result_Maps">Result Maps</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/sqlmap-xml.html#Auto-mapping">Auto-mapping</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/sqlmap-xml.html#cache">cache</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/dynamic-sql.html">動态 SQL</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/java-api.html">Java API</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/statement-builders.html">SQL 組裝類</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/logging.html">日志處理</a>

項目文檔

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/project-info.html">項目資訊</a>

<a target="_blank" href="http://mybatis.github.io/mybatis-3/zh/project-reports.html">項目報表</a>

MyBatis-Spring 會幫助你将 MyBatis 代碼無縫地整合到 Spring 中。 使用這個類庫中的類, Spring 将會加載必要的 MyBatis 工廠類和 session 類。 這個類庫也提供一個簡單的方式來注入 MyBatis 資料映射器和 SqlSession 到業務層的 bean 中。 而且它也會處理事務, 翻譯 MyBatis 的異常到 Spring 的 DataAccessException 異常(資料通路異常,譯者注)中。最終,它并 不會依賴于 MyBatis,Spring 或 MyBatis-Spring 來建構應用程式代碼。

正如第二版那樣,Spring 3.0 也僅支援 iBatis2。那麼,我們就想将 MyBatis3 的支援添加 到 Spring3.0(參考 Spring Jira 中的問題)中。而不幸的是,Spring 3.0 的開發在 MyBatis 3.0 官方釋出前就結束了。 因為 Spring 開發團隊不想釋出一個基于非釋出版的 MyBatis 的整合支 持,那麼 Spring 官方的支援就不得不繼續等待了。要在 Spring 中支援 MyBatis,MyBatis 社 區認為現在應該是自己團結貢獻者和有興趣的人一起來開始将 Spring 的整合作為 MyBatis 社 區的子項目的時候了。

在開始使用 MyBatis-Spring 的整合之前,很重要的一點是,你要熟悉 Spring 和 MyBatis 這兩個架構還有和它們有關的術語,本手冊中不會提供二者的基本内容,安裝和配置教程。

MyBatis-Spring requires Java 5 or higher and the following MyBatis and Spring versions:

MyBatis-Spring

MyBatis

Spring

1.0.0 and 1.0.1

3.0.1 to 3.0.5

3.0.0 or higher

1.0.2

3.0.6

1.1.0

3.1.0 or higher

特别感謝那些使得本項目成為現實的人們(按字母順序排序)。 Eduardo Macarron, Hunter Presnall和Putthibong Boonbong的編碼, 測試和文檔修改工作; Andrius Juozapaitis, Giovanni Cuccu,Raj Nagappan和Tomas Pinos的貢獻;而Simone Tripodi發現了這些人并 把他們帶入項目之中。沒有他們的努力,這個項目是不可能存在的。

REFERENCE DOCUMENTATION

<a target="_blank" href="http://mybatis.github.io/spring/zh/index.html">簡介</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/getting-started.html">第二章 入門</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/factorybean.html">SqlSessionFactoryBean</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/transactions.html">第四章 事務</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/sqlsession.html">第五章 使用 SqlSession</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/mappers.html#">第六章 注入映射器</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/mappers.html#MapperFactoryBean">MapperFactoryBean</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/mappers.html#MapperScannerConfigurer">MapperScannerConfigurer</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/using-api.html">第七章 使用 MyBatis API</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/sample.html">第八章 示例代碼</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/project-info.html">項目資訊</a>

<a target="_blank" href="http://mybatis.github.io/spring/zh/project-reports.html">項目報表</a>