1.ibatisåhibernate
2.ibatisåhibernateçåºå«
3.mybatisåhibernateçåºå«
ibatisåhibernate
ibatis:sqléè¦èªå·±å
hibernate:sqlèªå¨çæ
ä¸é¢æ¯æ大çåºå«,手写喷子源码源码双生元素流派ä¸é¢æ¯ä¸äºç»è.
éæ©Hibernateè¿æ¯iBATISé½æå®çéçï¼
Hibernateçç¹ç¹ï¼
Hibernateåè½å¼ºå¤§ï¼æ°æ®åºæ å ³æ§å¥½ï¼O/Ræ å°è½å强ï¼å¦æä½ å¯¹Hibernateç¸å½ç²¾éï¼èä¸å¯¹Hibernateè¿è¡äºéå½çå°è£ ï¼é£ä¹ä½ ç项ç®æ´ä¸ªæä¹ å±ä»£ç ä¼ç¸å½ç®åï¼éè¦åç代ç å¾å°ï¼å¼åé度å¾å¿«ï¼é常ç½ã以æ°æ®åºå段ä¸ä¸å¯¹åºæ å°å¾å°çPOåHibernteè¿ç§å¯¹è±¡åæ å°å¾å°çPOæ¯æªç¶ä¸åçï¼æ¬è´¨åºå«å¨äºè¿ç§POæ¯æå¹³åçï¼ä¸åHibernateæ å°çPOæ¯å¯ä»¥è¡¨è¾¾ç«ä½ç对象继æ¿ï¼èåççå ³ç³»çï¼è¿å°ä¼ç´æ¥å½±åå°ä½ çæ´ä¸ªè½¯ä»¶ç³»ç»ç设计æè·¯ãHibernate对æ°æ®åºç»ææä¾äºè¾ä¸ºå®æ´çå°è£ ï¼HibernateçO/R Mappingå®ç°äºPOJO åæ°æ®åºè¡¨ä¹é´çæ å°ï¼ä»¥åSQL çèªå¨çæåæ§è¡ãç¨åºåå¾å¾åªéå®ä¹å¥½äºPOJO å°æ°æ®åºè¡¨çæ å°å ³ç³»ï¼å³å¯éè¿Hibernate æä¾çæ¹æ³å®ææä¹ å±æä½ãç¨åºåçè³ä¸éè¦å¯¹SQL ççç»ææ¡ï¼ Hibernate/OJB ä¼æ ¹æ®å¶å®çåå¨é»è¾ï¼èªå¨çæ对åºçSQL 并è°ç¨JDBC æ¥å£å 以æ§è¡ãHibernateç缺ç¹å°±æ¯å¦ä¹ é¨æ§ä¸ä½ï¼è¦ç²¾éé¨æ§æ´é«ï¼èä¸æä¹è®¾è®¡O/Ræ å°ï¼å¨æ§è½å对象模åä¹é´å¦ä½æè¡¡åå¾å¹³è¡¡ï¼ä»¥åææ ·ç¨å¥½Hibernateæ¹é¢éè¦ä½ çç»éªåè½åé½å¾å¼ºæè¡ï¼ä½æ¯Hibernateç°å¨å·²ç»æ¯ä¸»æµO/R Mappingæ¡æ¶ï¼ä»ææ¡£ç丰å¯æ§ï¼äº§åçå®åæ§ï¼çæ¬çå¼åé度é½è¦å¼ºäºiBATISã
iBATISçç¹ç¹ï¼
iBATISå ¥é¨ç®åï¼å³å¦å³ç¨ï¼æä¾äºæ°æ®åºæ¥è¯¢çèªå¨å¯¹è±¡ç»å®åè½ï¼èä¸å»¶ç»äºå¾å¥½çSQL使ç¨ç»éªï¼å¯¹äºæ²¡æé£ä¹é«ç对象模åè¦æ±ç项ç®æ¥è¯´ï¼ç¸å½å®ç¾ãiBATISç缺ç¹å°±æ¯æ¡æ¶è¿æ¯æ¯è¾ç®éï¼åè½å°æ缺失ï¼è½ç¶ç®åäºæ°æ®ç»å®ä»£ç ï¼ä½æ¯æ´ä¸ªåºå±æ°æ®åºæ¥è¯¢å®é è¿æ¯è¦èªå·±åçï¼å·¥ä½éä¹æ¯è¾å¤§ï¼èä¸ä¸å¤ªå®¹æéåºå¿«éæ°æ®åºä¿®æ¹ãå½ç³»ç»å±äºäºæ¬¡å¼å,æ æ³å¯¹æ°æ®åºç»æåå°æ§å¶åä¿®æ¹,é£iBATISççµæ´»æ§å°æ¯Hibernateæ´éåãç³»ç»æ°æ®å¤çé巨大ï¼æ§è½è¦æ±æ为èå»ï¼è¿å¾å¾æå³çæä»¬å¿ é¡»éè¿ç»è¿é«åº¦ä¼åçSQLè¯å¥ï¼æåå¨è¿ç¨ï¼æè½è¾¾å°ç³»ç»æ§è½è®¾è®¡ææ ãå¨è¿ç§æ åµä¸iBATISä¼ææ´å¥½çå¯æ§æ§å表ç°ã
对äºå®é çå¼åè¿è¡çæ¯è¾ï¼
1ï¼ iBATISéè¦æåsqlè¯å¥ï¼ä¹å¯ä»¥çæä¸é¨åï¼Hibernateååºæ¬ä¸å¯ä»¥èªå¨çæï¼å¶å°ä¼åä¸äºHqlãåæ ·çéæ±,iBATISçå·¥ä½éæ¯ Hibernateè¦å¤§å¾å¤ã类似çï¼å¦ææ¶åå°æ°æ®åºå段çä¿®æ¹ï¼Hibernateä¿®æ¹çå°æ¹å¾å°ï¼èiBATISè¦æé£äºsql mappingçå°æ¹ä¸ä¸ä¿®æ¹ã
2. iBatis å¯ä»¥è¿è¡ç»ç²åº¦çä¼å
æ¯å¦è¯´ææä¸ä¸ªè¡¨ï¼è¿ä¸ªè¡¨æå 个æè å å个å段ï¼æéè¦æ´æ°å ¶ä¸çä¸ä¸ªå段ï¼iBatis å¾ç®åï¼æ§è¡ä¸ä¸ªsql UPDATE TABLE_A SET column_1=#column_1# WHERE id=#id# ä½æ¯ç¨ Hibernate çè¯å°±æ¯è¾éº»ç¦äº,缺ççæ åµä¸ hibernate ä¼æ´æ°ææå段ã å½ç¶æè®°å¾ hibernate æä¸ä¸ªé项å¯ä»¥æ§å¶åªä¿åä¿®æ¹è¿çå段ï¼ä½æ¯æä¸å¤ªç¡®å®è¿ä¸ªåè½çè´é¢ææã
ä¾å¦ï¼æéè¦ååºä¸ä¸ªè¡¨çé¨åå 容ï¼ç¨ iBatis çæ¶åï¼è¿éé¢ç好å¤æ¯å¯ä»¥å°ä»æ°æ®åºè¯»å¾å¤æ°æ®ï¼èçæµéSELECT ID, NAME FROM TABLE_WITH_A_LOT_OF_COLUMN WHERE ...ä¸è¬æ åµä¸Hibernate ä¼æææçå段é½éåºæ¥ãæ¯å¦è¯´æä¸ä¸ªä¸é¢è¡¨æ8个å段ï¼å ¶ä¸æä¸ä¸¤ä¸ªæ¯è¾å¤§çå段ï¼varchar()/textãä¸é¢çåºæ¯ä¸æ为ä»ä¹è¦æä»ä»¬ä¹éåºæ¥å¢ï¼ç¨hibernate çè¯ï¼ä½ åä¸è½æè¿ä¸¤ä¸ªä¸éè¦çå段设置为lazy loadï¼å 为è¿æå¾å¤å°æ¹éè¦ä¸æ¬¡ææ´ä¸ª domain object å è½½åºæ¥ãè¿ä¸ªæ¶åå°±è½æ¾ç°åºibatis ç好å¤äºãå¦ææéè¦æ´æ°ä¸æ¡è®°å½ï¼ä¸ä¸ªå¯¹è±¡ï¼ï¼å¦æä½¿ç¨ hibernateï¼éè¦ç°æ对象 select åºæ¥ï¼ç¶ååå updateãè¿å¯¹æ°æ®åºæ¥è¯´å°±æ¯ä¸¤æ¡sqlãèiBatisåªéè¦ä¸æ¡updateçsqlå°±å¯ä»¥äºãåå°ä¸æ¬¡ä¸æ°æ®åºç交äºï¼å¯¹äºæ§è½çæåæ¯é常éè¦ã
3. å¼åæ¹é¢ï¼
å¼åæçä¸ï¼æè§å¾ä¸¤è åºè¯¥å·®ä¸å¤ãå¯ç»´æ¤æ§æ¹é¢ï¼æè§å¾ iBatis æ´å¥½ä¸äºãå 为 iBatis ç sql é½ä¿åå°åç¬çæ件ä¸ãè Hibernate å¨æäºæ åµä¸å¯è½ä¼å¨ java 代ç ä¸ä¿sql/hqlãç¸å¯¹HibernateâO/Râèè¨ï¼iBATIS æ¯ä¸ç§âSql MappingâçORMå®ç°ã èiBATIS ççåç¹ï¼åå¨äºPOJO ä¸SQLä¹é´çæ å°å ³ç³»ãä¹å°±æ¯è¯´ï¼iBATIS并ä¸ä¼ä¸ºç¨åºåå¨è¿è¡æèªå¨çæSQL æ§è¡ãå ·ä½çSQL éè¦ç¨åºåç¼åï¼ç¶åéè¿æ å°é ç½®æ件ï¼å°SQLæéçåæ°ï¼ä»¥åè¿åçç»æå段æ å°å°æå®POJOã使ç¨iBATIS æä¾çORMæºå¶ï¼å¯¹ä¸å¡é»è¾å®ç°äººåèè¨ï¼é¢å¯¹çæ¯çº¯ç²¹çJava对象ï¼è¿ä¸å±ä¸éè¿Hibernate å®ç°ORM èè¨åºæ¬ä¸è´ï¼è对äºå ·ä½çæ°æ®æä½ï¼Hibernateä¼èªå¨çæSQL è¯å¥ï¼èiBATIS åè¦æ±å¼åè ç¼åå ·ä½çSQL è¯å¥ãç¸å¯¹Hibernateèè¨ï¼iBATIS 以SQLå¼åçå·¥ä½éåæ°æ®åºç§»æ¤æ§ä¸ç让æ¥ï¼ä¸ºç³»ç»è®¾è®¡æä¾äºæ´å¤§çèªç±ç©ºé´ã
4. è¿è¡æç
å¨ä¸èè cache çæ åµä¸ï¼iBatis åºè¯¥ä¼æ¯hibernate å¿«ä¸äºæè å¾å¤ã
ibatisåhibernateçåºå«
IBatisåHibernateåºå«
1. ç®ä»
Hibernateæ¯å½åææµè¡çO/R
mappingæ¡æ¶ãå®åºèº«äºsf.netï¼ç°å¨å·²ç»æ为Jbossçä¸é¨åäºãiBATISæ¯å¦å¤ä¸ç§ä¼ç§çO/R
mappingæ¡æ¶ï¼ç°å·²æ¹åå«myBATISãç®åå±äºapacheçä¸ä¸ªå项ç®äºãç¸å¯¹Hibernate"O/R"èè¨ï¼iBATIS
æ¯ä¸ç§"Sql Mapping"çORMå®ç°ã
Hibernate对æ°æ®åºç»ææä¾äºè¾ä¸ºå®æ´çå°è£ ï¼HibernateçO/R
Mappingå®ç°äºPOJOåæ°æ®åºè¡¨ä¹é´çæ å°ï¼ä»¥åSQLçèªå¨çæåæ§è¡ãç¨åºåå¾å¾åªéå®ä¹å¥½äºPOJOå°æ°æ®åºè¡¨çæ å°å ³ç³»ï¼å³å¯éè¿
Hibernateæä¾çæ¹æ³å®ææä¹ å±æä½ãç¨åºåçè³ä¸éè¦å¯¹SQLççç»ææ¡ï¼Hibernate/OJBä¼æ ¹æ®å¶å®çåå¨é»è¾ï¼èªå¨çæ对åºç
SQL并è°ç¨JDBCæ¥å£å 以æ§è¡ã
èiBATISççåç¹ï¼åå¨äºPOJOä¸SQLä¹é´çæ å°å ³ç³»ãä¹å°±æ¯è¯´ï¼iBATIS并ä¸ä¼ä¸ºç¨åºåå¨è¿è¡æèªå¨çæSQLæ§è¡ã
å ·ä½çSQLéè¦ç¨
åºåç¼åï¼ç¶åéè¿æ å°é ç½®æ件ï¼å°SQLæéçåæ°ï¼ä»¥åè¿åçç»æå段æ å°å°æå®POJOã使ç¨iBATISæä¾çORMæºå¶ï¼å¯¹ä¸å¡é»è¾å®ç°äººåè
è¨ï¼é¢å¯¹çæ¯çº¯ç²¹çJava对象ï¼è¿ä¸å±ä¸éè¿Hibernate
å®ç°ORMèè¨åºæ¬ä¸è´ï¼è对äºå ·ä½çæ°æ®æä½ï¼Hibernateä¼èªå¨çæSQLè¯å¥ï¼èiBATISåè¦æ±å¼åè ç¼åå ·ä½çSQLè¯å¥ãç¸å¯¹
Hibernateèè¨ï¼iBATIS以SQLå¼åçå·¥ä½éåæ°æ®åºç§»æ¤æ§ä¸ç让æ¥ï¼ä¸ºç³»ç»è®¾è®¡æä¾äºæ´å¤§çèªç±ç©ºé´ã
2. äºè ç对æ¯
1)iBATISé常ç®åæå¦ï¼Hibernateç¸å¯¹è¾å¤æï¼é¨æ§è¾é«ãiBATISæ¿æ¥ææ¡£çå天å°ä¸¤å¤©å°±å¯ä»¥ææ¡äºãHibernateå¯è½éè¦3å以ä¸çæ¶é´æ¥ææ¡ã
2) äºè é½æ¯æ¯è¾ä¼ç§çå¼æºäº§åãä½Hibernateç°å¨å·²ç»æ¯ä¸»æµO/R Mappingæ¡æ¶ï¼ä»ææ¡£ç丰å¯æ§ï¼äº§åçå®åæ§ï¼çæ¬çå¼åé度é½è¦å¼ºäºiBATISã
3) å½ç³»ç»å±äºäºæ¬¡å¼åï¼æ æ³å¯¹æ°æ®åºç»æåå°æ§å¶åä¿®æ¹ï¼é£iBATISççµæ´»æ§å°æ¯Hibernateæ´éåã
4) ç³»ç»æ°æ®å¤çé巨大ï¼æ§è½è¦æ±æ为èå»ï¼è¿å¾å¾æå³çæä»¬å¿ é¡»éè¿ç»è¿é«åº¦ä¼åçSQLè¯å¥ï¼æåå¨è¿ç¨ï¼æè½è¾¾å°ç³»ç»æ§è½è®¾è®¡ææ ãå¨è¿ç§æ åµä¸iBATISä¼ææ´å¥½çå¯æ§æ§å表ç°ãiBatisæ¯Hibernateæ´å®¹æè¿è¡sqlçä¼åãé´äºä¸è¬ç³»ç»æ§è½çç¶é¢é½å¨æ°æ®åºä¸ï¼æ以è¿ä¸ç¹æ¯iBatisé常éè¦çä¸ä¸ªä¼å¿ã
5) iBatis å¯ä»¥è¿è¡ç»ç²åº¦çä¼å
æ¯å¦è¯´ææä¸ä¸ªè¡¨ï¼è¿ä¸ªè¡¨æå 个æè å å个å段ï¼æéè¦æ´æ°å ¶ä¸çä¸ä¸ªå段ï¼iBatiså¾ç®
åï¼æ§è¡ä¸ä¸ªsqlï¼UPDATE TABLE_A SET column_1=#column_1# WHERE
id=#id# ä½æ¯ç¨Hibernateçè¯å°±æ¯è¾éº»ç¦äºï¼ç¼ºççæ åµä¸hibernateä¼æ´æ°ææå段ãå½ç¶ï¼hibernateæä¸ä¸ªé项å¯ä»¥æ§
å¶åªä¿åä¿®æ¹è¿çå段ã
æéè¦ååºä¸ä¸ªè¡¨çé¨åå 容ï¼ç¨iBatisçæ¶åï¼è¿éé¢ç好å¤æ¯å¯ä»¥å°ä»æ°æ®åºè¯»å¾å¤æ°æ®ï¼èçæµéSELECT ID, NAME FROM TABLE_WITH_A_LOT_OF_COLUMN WHERE ...
ä¸è¬æ åµä¸Hibernateä¼æææçå段é½éåºæ¥ãæ¯å¦è¯´æä¸ä¸ªä¸é¢è¡¨æ8个å段ï¼å ¶ä¸æä¸ä¸¤ä¸ªæ¯è¾å¤§çå段ï¼varchar()/textãä¸é¢çåºæ¯ä¸æ为ä»ä¹è¦æä»ä»¬ä¹éåºæ¥å¢ï¼
ç¨hibernateçè¯ï¼ä½ åä¸è½æè¿ä¸¤ä¸ªä¸éè¦çå段设置为lazy loadï¼å 为è¿æå¾å¤å°æ¹éè¦ä¸æ¬¡ææ´ä¸ª domain object å è½½åºæ¥ãè¿ä¸ªæ¶åå°±è½æ¾åºibatisç好å¤äºã
Hibernateè¿æä¸ä¸ªæ¹æ¡ï¼å°±æ¯çæjavabean/map/object[](æè°¢leelun/cjmm)ï¼ä½æ¯è¿æ ·çè¯å°±å¯è½ä¼äº§ç大éçå¤ä½classãmap/object[] çæ¹å¼åºè¯¥ä¸éï¼ææ¯è¾å欢è¿ç§æ¹å¼ã
å¦ææéè¦æ´æ°ä¸æ¡è®°å½ï¼ä¸ä¸ªå¯¹è±¡ï¼ï¼å¦æ使ç¨hibernateï¼éè¦ç°æ对象selectåºæ¥ï¼ç¶åååupdateãè¿å¯¹æ°æ®åºæ¥è¯´å°±æ¯ä¸¤æ¡ sqlãèiBatisåªéè¦ä¸æ¡updateçsqlå°±å¯ä»¥äºãåå°ä¸æ¬¡ä¸æ°æ®åºç交äºï¼å¯¹äºæ§è½çæåæ¯é常éè¦ã
6) iBatisé
è¦æåsqlè¯å¥ï¼ä¹å¯ä»¥çæä¸é¨åï¼Hibernateååºæ¬ä¸å¯ä»¥èªå¨çæï¼å¶å°ä¼åä¸äºHqlãåæ ·çéæ±ï¼iBATISçå·¥ä½éæ¯
Hibernateè¦å¤§å¾å¤ã类似çï¼å¦ææ¶åå°æ°æ®åºå段çä¿®æ¹ï¼Hibernateä¿®æ¹çå°æ¹å¾å°ï¼èiBATISè¦æé£äºsql
mappingçå°æ¹ä¸ä¸ä¿®æ¹ã
7) å¼åæ¹é¢
å¼åæçä¸ï¼æè§å¾ä¸¤è åºè¯¥å·®ä¸å¤
å¯ç»´æ¤æ§æ¹é¢ï¼æè§å¾iBatisæ´å¥½ä¸äºãå 为iBatisçsqlé½ä¿åå°åç¬çæ件ä¸ãèHibernateå¨æäºæ åµä¸å¯è½ä¼å¨java代ç ä¸ä¿åsql/hqlã
8) è¿è¡æç
å¨ä¸èècacheçæ åµä¸ï¼iBatisåºè¯¥ä¼æ¯hibernateå¿«ä¸äºæè å¾å¤ï¼æ ¹æ®å®é æ åµä¼ææä¸åï¼ã
9) 对ä¸åæ°æ®åºç±»åçæ¯æãiBatis对ä¸åæ°æ®åºç±»åçæ¯æä¸å¤å¥½ï¼å¦æä½ è¦å¼åçç³»ç»æ¯è¦å¨å¯¹ä¸æ°æ®é´ç§»æ¤ï¼é£å¯è½ç¨hibernateæ¯è¾å¥½ã
)对缺ççcacheæ¯æãiBatis对缺ççcacheæ¯æä¸å¤å¥½ï¼ä½æ¯hibernateçcacheæ¯æå ¶å®ä¹ä¸æ¯å¾å¥½ï¼èä¸å¾å¤æãå°¤å ¶æ¯å¯¹äºå¤§å¹¶åéçåºç¨ãæ以ææ´å¾åäºèªå·±ç®¡çcacheã
) 以æ°æ®åºå段ä¸ä¸å¯¹åºæ å°å¾å°çPO(persistant object)åHibernteè¿ç§å¯¹è±¡åæ å°å¾å°çPOæ¯æªç¶ä¸åçï¼æ¬è´¨åºå«å¨äºè¿ç§POæ¯æå¹³åçï¼ä¸åHibernateæ å°çPOæ¯å¯ä»¥è¡¨è¾¾ç«ä½ç对象继æ¿ï¼èåççå ³ç³»çï¼è¿å°ä¼ç´æ¥å½±åå°ä½ çæ´ä¸ªè½¯ä»¶ç³»ç»ç设计æè·¯ã
) æå ³é®çä¸å¥è¯æ¯iBATISçä½è 说çï¼If you are starting a new project and
you're in full control of your object model and database design,
Hibernate is a good choice of O/R tool.If you are accessing any 3rd
party databases (e.g. vendor supplied), or you're working with a legacy
database, or even just a really poorly designed database, then an O/R
mapper might not be capable of handling the situation. That's were an
SQL Mapper comes in handy
3. å¦ä½éæ©
éæ©Hibernateè¿æ¯iBATISé½æå®çéçï¼
Hibernateåè½å¼ºå¤§ï¼æ°æ®åºæ å ³æ§å¥½ï¼O/Ræ å°è½å强ï¼å¦æä½ å¯¹Hibernateç¸å½ç²¾éï¼èä¸å¯¹Hibernateè¿è¡äºéå½çå°è£ ï¼é£ä¹ä½ ç项ç®æ´ä¸ªæä¹ å±ä»£ç ä¼ç¸å½ç®åï¼éè¦åç代ç å¾å°ï¼å¼åé度å¾å¿«ï¼é常ç½ã
Hibernateç缺ç¹å°±æ¯å¦ä¹ é¨æ§ä¸ä½ï¼è¦ç²¾éé¨æ§æ´é«ï¼èä¸æä¹è®¾è®¡O/Ræ å°ï¼å¨æ§è½å对象模åä¹é´å¦ä½æè¡¡åå¾å¹³è¡¡ï¼ä»¥åææ ·ç¨å¥½Hibernateæ¹é¢éè¦ä½ çç»éªåè½åé½å¾å¼ºæè¡ã
iBATISå ¥é¨ç®åï¼å³å¦å³ç¨ï¼æä¾äºæ°æ®åºæ¥è¯¢çèªå¨å¯¹è±¡ç»å®åè½ï¼èä¸å»¶ç»äºå¾å¥½çSQL使ç¨ç»éªï¼å¯¹äºæ²¡æé£ä¹é«ç对象模åè¦æ±ç项ç®æ¥è¯´ï¼ç¸å½å®ç¾ã
iBATISç缺ç¹å°±æ¯æ¡æ¶è¿æ¯æ¯è¾ç®éï¼åè½å°æ缺失ï¼è½ç¶ç®åäºæ°æ®ç»å®ä»£ç ï¼ä½æ¯æ´ä¸ªåºå±æ°æ®åºæ¥è¯¢å®é è¿æ¯è¦èªå·±åçï¼å·¥ä½éä¹æ¯è¾å¤§ï¼èä¸ä¸å¤ªå®¹æéåºå¿«éæ°æ®åºä¿®æ¹ã
mybatisåhibernateçåºå«
mybatisåhibernateçåºå«æ¯ï¼
1ãhibernateæ¯å ¨èªå¨ï¼èmybatisæ¯åèªå¨ãhibernateå®å ¨å¯ä»¥éè¿å¯¹è±¡å ³ç³»æ¨¡åå®ç°å¯¹æ°æ®åºçæä½ï¼æ¥æå®æ´çJavaBean对象ä¸æ°æ®åºçæ å°ç»ææ¥èªå¨çæsqlãèmybatisä» æåºæ¬çå段æ å°ï¼å¯¹è±¡æ°æ®ä»¥å对象å®é å ³ç³»ä»ç¶éè¦éè¿æåsqlæ¥å®ç°å管çã
2ãhibernateæ°æ®åºç§»æ¤æ§è¿å¤§äºmybatisãhibernateéè¿å®å¼ºå¤§çæ å°ç»æåhqlè¯è¨ï¼å¤§å¤§éä½äºå¯¹è±¡ä¸æ°æ®åºï¼oracleãmysqlçï¼çè¦åæ§ï¼èmybatisç±äºéè¦æåsqlï¼å æ¤ä¸æ°æ®åºçè¦åæ§ç´æ¥åå³äºç¨åºååsqlçæ¹æ³ï¼å¦æsqlä¸å ·éç¨æ§èç¨äºå¾å¤ææ°æ®åºç¹æ§çsqlè¯å¥çè¯ï¼ç§»æ¤æ§ä¹ä¼éä¹éä½å¾å¤ï¼ææ¬å¾é«ã
3ãhibernateæ¥æå®æ´çæ¥å¿ç³»ç»ï¼mybatisåæ¬ ç¼ºä¸äºãhibernateæ¥å¿ç³»ç»é常å¥å ¨ï¼æ¶å广æ³ï¼å æ¬ï¼sqlè®°å½ãå ³ç³»å¼å¸¸ãä¼åè¦åãç¼åæ示ãèæ°æ®è¦åçï¼èmybatisåé¤äºåºæ¬è®°å½åè½å¤ï¼åè½èå¼±å¾å¤ã
4ãmybatisç¸æ¯hibernateéè¦å ³å¿å¾å¤ç»èãhibernateé ç½®è¦æ¯mybatiså¤æçå¤ï¼å¦ä¹ ææ¬ä¹æ¯mybatisé«ãä½ä¹æ£å 为mybatis使ç¨ç®åï¼æ导è´å®è¦æ¯hibernateå ³å¿å¾å¤ææ¯ç»èãmybatisç±äºä¸ç¨èèå¾å¤ç»èï¼å¼å模å¼ä¸ä¸ä¼ ç»jdbcåºå«å¾å°ï¼å æ¤å¾å®¹æä¸æ并å¼å项ç®ï¼ä½å¿½ç¥ç»èä¼å¯¼è´é¡¹ç®åæbugè¾å¤ï¼å èå¼ååºç¸å¯¹ç¨³å®ç软件å¾æ ¢ï¼èå¼ååºè½¯ä»¶å´å¾å¿«ãhibernateåæ£å¥½ä¸ä¹ç¸åãä½æ¯å¦æ使ç¨hibernateå¾çç»çè¯ï¼å®é ä¸å¼åæçä¸æ¯«ä¸å·®äºçè³è¶ è¶mybatisã
5ãsqlç´æ¥ä¼åä¸ï¼mybatisè¦æ¯hibernateæ¹ä¾¿å¾å¤ã