深入淺出MyBatis技術原理與實戰 版權信息
- ISBN:9787121295942
- 條形碼:9787121295942 ; 978-7-121-29594-2
- 裝幀:一般膠版紙
- 冊數:暫無
- 重量:暫無
- 所屬分類:>>
深入淺出MyBatis技術原理與實戰 本書特色
當前已經是移動互聯網時代,java持久框架hibernate沒有辦法適應高性能,靈活,大數據,可優化等要求,這時mybatis就進入了我們的視野,隨著移動互聯網應用的持續發酵,spring mybatis的應用已在java互聯網平臺上得到大量的使用,單單在51job招聘網站中mybatis在全國也有近萬個崗位的需求,加上未在51job發布的企業,可見需求相當大,而在當今市場上卻沒有任何一本介紹mybatis的書籍,為了填補這一空白本書主要介紹了java mybatis技術。本書詳細介紹了mybatis的基礎組成、配置、映射器、動態sql,教會讀者正確使用mybatis,書中包含大量的實例,使讀者可以參考。接著介紹了mybatis的運行原理和插件開發并配有一個完整的插件例子。為了增加實用性,作者還介紹了mybatis-spring項目,使得讀者能夠學習到如何把mybatis整合到spring項目中,*后作者還將講解一些常用實例,比如blob字段、文件上傳、批量、動態表名等實用場景,讓讀者能夠參考和注意一些細節的問題。本書從基礎講到底層,注重實戰,原理,照顧到初中高三類讀者,可以作為mybatis的學習教程和參考技術叢書。
深入淺出MyBatis技術原理與實戰 內容簡介
當前已經是移動互聯網時代,Java持久框架Hibernate沒有辦法適應高性能,靈活,大數據,可優化等要求,這時MyBatis就進入了我們的視野,隨著移動互聯網應用的持續發酵,Spring+MyBatis的應用已在Java互聯網平臺上得到大量的使用,單單在51job招聘網站中MyBatis在全國也有近萬個崗位的需求,加上未在51job發布的企業,可見需求相當大,而在當今市場上卻沒有任何一本介紹MyBatis的書籍,為了填補這一空白本書主要介紹了Java MyBatis技術。本書詳細介紹了MyBatis的基礎組成、配置、映射器、動態SQL,教會讀者正確使用MyBatis,書中包含大量的實例,使讀者可以參考。接著介紹了MyBatis的運行原理和插件開發并配有一個完整的插件例子。為了增加實用性,作者還介紹了MyBatis-Spring項目,使得讀者能夠學習到如何把MyBatis整合到Spring項目中,*后作者還將講解一些常用實例,比如Blob字段、文件上傳、批量、動態表名等實用場景,讓讀者能夠參考和注意一些細節的問題。本書從基礎講到底層,注重實戰,原理,照顧到初中高三類讀者,可以作為MyBatis的學習教程和參考技術叢書。
深入淺出MyBatis技術原理與實戰 目錄
目 錄第1 章 mybatis 簡介.................................................................................................................................. 11.1 傳統的jdbc 編程........................................................................................................................ 11.2 orm 模型....................................................................................................................................... 41.3 hibernate.................................................................................................................................... 41.4 mybatis ..................................................................................................................................... 91.5 什么時候用mybatis....................................................................................................................12第2 章 mybaits 入門.........................................................................................................................132.1 開發環境準備...............................................................................................................................132.1.1 下載mybatis .........................................................................................................................132.1.2 搭建開發環境........................................................................................................................142.2 mybatis 的基本構成....................................................................................................................152.2.1 構建sqlsessionfactory..........................................................................................................152.2.2 創建sqlsession.....................................................................................................................192.2.3 映射器...................................................................................................................................212.3 生命周期.........................................................................................................................................262.3.1 sqlsessionfactorybuilder.......................................................................................................272.3.2 sqlsessionfactory..................................................................................................................272.3.3 sqlsession..............................................................................................................................272.3.4 mapper...................................................................................................................................282.4 實例...........................................................................................................................................29第3 章 配置.........................................................................................................................................373.1 properties 元素...............................................................................................................................383.1.1 property 子元素......................................................................................................................383.1.2 properties 配置文件...............................................................................................................393.1.3 程序參數傳遞........................................................................................................................393.1.4 優先級...................................................................................................................................403.2 設置.........................................................................................................................................413.3 別名........................................................................................................................................443.3.1 系統定義別名........................................................................................................................443.3.2 自定義別名............................................................................................................................473.4 typehandler 類型處理器.............................................................................................................483.4.1 系統定義的typehandler........................................................................................................493.4.2 自定義typehandler................................................................................................................513.4.3 枚舉類型typehandler............................................................................................................553.5 objectfactory.................................................................................................................................623.6 插件..................................................................................................................................................653.7 environments 配置環境...............................................................................................................653.7.1 概述.......................................................................................................................................653.7.2 數據庫事務............................................................................................................................663.7.3 數據源...................................................................................................................................673.8 databaseidprovider 數據庫廠商標識.......................................................................................683.8.1 使用系統默認規則................................................................................................................683.8.2 不使用系統默認規則............................................................................................................693.9 引入映射器的方法.......................................................................................................................71第4 章映射器..............................................................................................................................................734.1 映射器的主要元素.......................................................................................................................734.2 select 元素......................................................................................................................................744.2.1 概述.......................................................................................................................................744.2.2 簡易數據類型的例子............................................................................................................754.2.3 自動映射...............................................................................................................................764.2.4 傳遞多個參數........................................................................................................................784.2.5 使用resultmap 映射結果集..................................................................................................814.3 insert 元素......................................................................................................................................824.3.1 概述.......................................................................................................................................824.3.2 主鍵回填和自定義................................................................................................................834.4 update 元素和delete 元素..........................................................................................................854.5 參數..................................................................................................................................................854.5.1 參數配置...............................................................................................................................864.5.2 存儲過程支持........................................................................................................................864.5.3 特殊字符串替換和處理(#和$).........................................................................................874.6 sql 元素...........................................................................................................................................884.7 resultmap 結果映射集.................................................................................................................894.7.1 resultmap 元素的構成...........................................................................................................894.7.2 使用map 存儲結果集............................................................................................................914.7.3 使用pojo 存儲結果集.........................................................................................................914.7.4 級聯.......................................................................................................................................924.8 緩存cache ....................................................................................................................................1134.8.1 系統緩存(一級緩存和二級緩存)...................................................................................1134.8.2 自定義緩存..........................................................................................................................117第5 章 動態sql ......................................................................................................................................1195.1 概述................................................................................................................................................1195.2 if 元素............................................................................................................................................1205.3 choose、when、otherwise 元素..............................................................................................1205.4 trim、where、set 元素..............................................................................................................1215.5 foreach 元素.................................................................................................................................1235.6 test 的屬性....................................................................................................................................1245.7 bind 元素.......................................................................................................................................125第6 章 mybatis 的解析和運行原理.....................................................................................................1276.1 涉及的技術難點簡介.................................................................................................................1286.1.1 反射技術..............................................................................................................................1296.1.2 jdk 動態代理......................................................................................................................1306.1.3 cglib 動態代理.................................................................................................................1336.2 構建sqlsessionfactory 過程...................................................................................................1346.2.1 構建configuration...............................................................................................................1356.2.2 映射器的內部組成..............................................................................................................1366.2.3 構建sqlsessionfactory........................................................................................................1386.3 sqlsession 運行過程..................................................................................................................1386.3.1 映射器的動態代理..............................................................................................................1386.3.2 sqlsession 下的四大對象....................................................................................................1426.3.3 sqlsession 運行總結............................................................................................................150第7 章 插件.................................................................................................................................................1527.1 插件接口.......................................................................................................................................1527.2 插件的初始化..............................................................................................................................1537.3 插件的代理和反射設計............................................................................................................1547.4 常用的工具類——metaobject................................................................................................1577.5 插件開發過程和實例.................................................................................................................1597.5.1 確定需要攔截的簽名..........................................................................................................1597.5.2 實現攔截方法......................................................................................................................1617.5.3 配置和運行..........................................................................................................................1627.5.4 插件實例..............................................................................................................................1637.6 總結................................................................................................................................................166第8 章 mybatis-spring...........................................................................................................................1688.1 spring 的基礎知識......................................................................................................................1688.1.1 spring ioc 基礎...................................................................................................................1698.1.2 spring aop 基礎..................................................................................................................1718.1.3 spring 事務管理...................................................................................................................1738.1.4 spring mvc 基礎.................................................................................................................1798.2 mybatis-spring 應用..................................................................................................................1818.2.1 概述.....................................................................................................................................1818.2.2 配置sqlsessionfactory........................................................................................................1828.2.3 配置sqlsessiontemplate.....................................................................................................1848.2.4 配置mapper.........................................................................................................................1888.2.5 配置事務..............................................................................................................................1908.3 實例................................................................................................................................................1918.3.1 環境準備..............................................................................................................................1918.3.2 文件目錄..............................................................................................................................1938.3.3 spring 配置文件...................................................................................................................1948.3.4 mybatis 框架相關配置........................................................................................................1988.3.5 配置服務層..........................................................................................................................2058.3.6 編寫控制器..........................................................................................................................2098.3.7 測試.....................................................................................................................................2108.4 總結................................................................................................................................................210第9 章 實用的場景...................................................................................................................................2129.1 數據庫blob 字段讀寫...........................................................................................................2129.2 批量更新.......................................................................................................................................2159.3 調用存儲過程..............................................................................................................................2179.3.1 存儲過程in 和out 參數的使用..........................................................................................2179.3.2 存儲過程游標......................................................................................................................2209.4 分表................................................................................................................................................2259.5 分頁................................................................................................................................................2279.5.1 rowbounds 分頁..................................................................................................................2279.5.2 插件分頁..............................................................................................................................2299.6 上傳文件到服務器.....................................................................................................................2399.7 在映射中使用枚舉.....................................................................................................................2479.8 多對多級聯..................................................................................................................................2499.9 總結................................................................................................................................................253附錄a 數據庫模型描述與級聯學生關系建表語句.......................................................254
展開全部
深入淺出MyBatis技術原理與實戰 作者簡介
楊開振
長期從事Java開發工作,擁有近十年的Java開發經驗,目前就職于一家互聯網金融公司,擔任互聯網軟件開發職位。
IT技術的狂熱愛好者,熱衷于Java互聯網方向的軟件技術開發與研究。
熟練掌握Java基礎、軟件開發設計模式和數據庫相關知識,對Spring、MyBatis等主流Java開源框架有深入研究。