锘??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美天堂在线,日韩成人亚洲,欧美专区一区 http://www.aygfsteel.com/freeman1984/archive/2013/01/06/393854.html鐤媯 鐤媯 Sun, 06 Jan 2013 03:09:00 GMT http://www.aygfsteel.com/freeman1984/archive/2013/01/06/393854.html http://www.aygfsteel.com/freeman1984/comments/393854.html http://www.aygfsteel.com/freeman1984/archive/2013/01/06/393854.html#Feedback 0 http://www.aygfsteel.com/freeman1984/comments/commentRss/393854.html http://www.aygfsteel.com/freeman1984/services/trackbacks/393854.html public int update(String sql, ... 闃呰鍏ㄦ枃 ]]> 鍏充簬tomcat鍜宻essionCookieName鍜孲ESSION_PARAMETER_NAME浠ュ強disableURLRewriting鍙傛暟鍘熺悊鍜屼嬌鐢?/title> http://www.aygfsteel.com/freeman1984/archive/2012/12/24/393402.html鐤媯 鐤媯 Mon, 24 Dec 2012 07:16:00 GMT http://www.aygfsteel.com/freeman1984/archive/2012/12/24/393402.html http://www.aygfsteel.com/freeman1984/comments/393402.html http://www.aygfsteel.com/freeman1984/archive/2012/12/24/393402.html#Feedback 0 http://www.aygfsteel.com/freeman1984/comments/commentRss/393402.html http://www.aygfsteel.com/freeman1984/services/trackbacks/393402.html 闃呰鍏ㄦ枃 ]]> hibernate錛宻pring綆$悊浜嬪姟涓?transaction錛孞DBC connection錛孒ibernate Session鐨勪嬌鐢ㄧ爺絀?錛堜竴錛?/title> http://www.aygfsteel.com/freeman1984/archive/2011/11/18/363984.html鐤媯 鐤媯 Fri, 18 Nov 2011 03:25:00 GMT http://www.aygfsteel.com/freeman1984/archive/2011/11/18/363984.html http://www.aygfsteel.com/freeman1984/comments/363984.html http://www.aygfsteel.com/freeman1984/archive/2011/11/18/363984.html#Feedback 0 http://www.aygfsteel.com/freeman1984/comments/commentRss/363984.html http://www.aygfsteel.com/freeman1984/services/trackbacks/363984.html http://www.aygfsteel.com/freeman1984/archive/2011/08/04/355808.html棣栧厛hibernate鐨凜onnection release mode鏈変互涓嬪嚑縐嶏細 1 after_statement 2 after_transaction 3 on_close 鍏朵腑after_statement 鐢ㄥ湪jta涓?錛?span style="color: red">on_close 鏄?.1涔嬪墠閬楃暀鐨勶紙涔熻鏄負spring鐣欑殑-_-錛夛紝涔熷氨鏄?.1涔嬪墠榛樿鏄痮n_close 錛屼絾3.1涔嬪悗榛樿濡傛灉鍗曠嫭浣跨敤hibernate鏄痑fter_transaction錛?/strong>濡傛灉鏈夌涓夋柟浜嬪姟綆$悊錛屽氨鐢ㄧ涓夋柟鎻愪緵鐨勯粯璁ゅ鹼紝spring灝辨槸榛樿浣跨敤浜唎n_close銆?br />鍦╯pring綆$悊浜嬪姟涓垜浠湅鐪嬬郴緇熷惎鍔ㄥ悗榛樿浣跨敤鐨勯厤緗細 1,ransaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory浣跨敤spring浜嬪姟絳栫暐 2錛宧ibernate鍐呴儴 Automatic session close at end of transaction: disabled 鍥犱負宸茬粡浜ょ粰spring浜?br />3 Connection release mode: auto 榛樿錛屼篃灝辨槸娌℃湁閰嶇疆hibernate.connection.release_mode鐨勬椂鍊欙紝浣嗘槸榪欓噷鏈夊湴鏂歸渶瑕佹敞鎰忥細涔熷氨鏄墠闈㈡彁鍒扮殑浣跨敤絎笁鏂圭瓥鐣ユ椂鐨勯棶棰橈細鐪嬩竴涓嬩唬鐮侊細
String releaseModeName = PropertiesHelper.getString( Environment.RELEASE_CONNECTIONS, properties, " auto " ); log.info( " Connection release mode: " + releaseModeName ); ConnectionReleaseMode releaseMode; if ( " auto " .equals(releaseModeName) ) { releaseMode = transactionFactory.getDefaultReleaseMode(); } else { releaseMode = ConnectionReleaseMode.parse( releaseModeName ); if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT && ! connections.supportsAggressiveRelease() ) { log.warn( " Overriding release mode as connection provider does not support 'after_statement' " ); releaseMode = ConnectionReleaseMode.AFTER_TRANSACTION; } } 鍏朵腑綰㈣壊閮ㄥ垎灝辨槸璋冪敤浜唖pring鎻愪緵鐨勯粯璁ゅ鹼紝鑰宻pring鐨勯粯璁ゅ鹼細鍦╦ta鍜宑mt涓兘榛樿浣跨敤鐨勬槸after_statement
/** */ /** * Sets connection release mode "on_close" as default. * <p>This was the case for Hibernate 3.0; Hibernate 3.1 changed * it to "auto" (i.e. "after_statement" or "after_transaction"). * However, for Spring's resource management (in particular for * HibernateTransactionManager), "on_close" is the better default. */ public ConnectionReleaseMode getDefaultReleaseMode() { return ConnectionReleaseMode.ON_CLOSE; } 鑰宻pring涓轟粈涔堣浣跨敤on_close 錛岃屼笉鏄敤after_transaction ,鎴戜滑鎯蟲兂opensessioninview鐨勫師鐞嗕篃璁歌兘鏄庣櫧錛宻ession鍦╲iew鎴愯繕瑕佷嬌鐢紝鎵浠ヤ笉鑳藉啀transaction浣跨敤瀹屽悗鍏抽棴JDBC connection錛屽繀欏昏鍦╯ession涔嬪悗錛屾墍浠ヨ浣跨敤on_close 錛?/span>涔熷氨鏄湪on session(flush.auto錛屾垨鑰協lush.Eagerly) 鍏抽棴錛夈傝繖縐嶆儏鍐礹ibernate鍐呴儴榪樹細鍦╯pring鍏抽棴JDBC connection鍚庢彁紺?璐硅В錛屽洜涓篴fter transaction涔嬪悗session娌℃湁鍏抽棴錛屼絾鏄?nbsp;Connection release mode閰嶇疆鐨勬槸on_close,session鐨勫叧闂拰 Connection 鐨勫叧闂兘鐢眘pring鏉ョ鐞嗭紝hibernate灝變笉鐭ラ亾浜?錛屾墍浠ibernate鏈夊ソ鐨勬彁紺哄涓?鍏跺疄session錛屽凡緇忓叧闂傚綋鐒墮殢鐫session鐨勫叧闂璲dbc閾炬帴閲婃斁鍥炶繛鎺ユ睜)錛?/span>transaction completed on session with on_close connection release mode; be sure to cl ose the session to release JDBC resources!錛?br /> 銆傚綋鐒舵垜浠篃鍙互浣跨敤after_transaction 錛岃繖縐嶆儏鍐靛浣跨敤緙栫▼寮忎簨鍔¢潪甯擱傜敤銆?br /> ]]> spring JdbcTemplate鐨剄ueryForObject涓虹┖榪斿洖寮傚父鎯呭喌鐨勪竴涓鐞?/title> http://www.aygfsteel.com/freeman1984/archive/2011/10/25/361976.html鐤媯 鐤媯 Tue, 25 Oct 2011 02:59:00 GMT http://www.aygfsteel.com/freeman1984/archive/2011/10/25/361976.html http://www.aygfsteel.com/freeman1984/comments/361976.html http://www.aygfsteel.com/freeman1984/archive/2011/10/25/361976.html#Feedback 0 http://www.aygfsteel.com/freeman1984/comments/commentRss/361976.html http://www.aygfsteel.com/freeman1984/services/trackbacks/361976.html 鍏堢湅涓媠pring鐨勮繖孌墊簮鐮侊細
public < T > T queryForObject(String sql, Object[] args, RowMapper < T > rowMapper) throws DataAccessException { List < T > results = query(sql, args, new RowMapperResultSetExtractor < T > (rowMapper, 1 )); return DataAccessUtils.requiredSingleResult(results); } public static < T > T requiredSingleResult(Collection < T > results) throws IncorrectResultSizeDataAccessException { int size = (results != null ? results.size() : 0 ); if (size == 0 ) { // 璁板綍涓簅榪斿洖寮傚父 throw new EmptyResultDataAccessException( 1 ); // 姝ゅ紓甯哥戶鎵胯嚜IncorrectResultSizeDataAccessException } if (results.size() > 1 ) {鏈夊鏉¤褰曡繑鍥炲紓甯?br /> throw new IncorrectResultSizeDataAccessException( 1 , size); } return results.iterator().next(); } 涓嬮潰鏄垜鐨勪竴涓柟娉曪紝鍏朵粬鐨勬柟娉曡澶у琛ュ厖錛?br />鍐欎竴涓帴鍙e畾涔夎鍒欙細
public interface JdbcTemplateCallBack < T > { public T querys(JdbcTemplate jdbcTemplate); } 鐒跺悗鏄疊aseDao鐨勯氱敤鐨勬柟娉曪細
/** */ /** * 鍙互鐢ㄤ簬澶勭悊鏌ヨqueryfor 涓虹┖鎴栬呭鏉$殑鏃跺欒繑鍥炲紓甯哥殑鎯呭喌錛岀幇鍦ㄨ繑鍥瀗ull,涓昏鏄嫤鎴狪ncorrectResultSizeDataAccessException寮傚父,浠ュ強瀛愮被 * @param jdbcTemplateCallBack * @return * @throws DaoException */ public < T > T queryNullAble(JdbcTemplateCallBack < T > jdbcTemplateCallBack) throws DaoException { try { return jdbcTemplateCallBack.querys(getJdbcTemplate()); } catch (Exception e) { if ((e instanceof IncorrectResultSizeDataAccessException) && ((IncorrectResultSizeDataAccessException)e).getActualSize() == 0 ) return null ; // 鍏朵粬鐨勫紓甯告甯告姏鍑?/span> throw new DaoException(e); } } 鏈鍚庢槸璋冪敤瀹炰緥錛堟牴鎹甶d鏌ョ敤鎴鳳級錛?br />
public SUser getUserByColunm( final String columnName, final Object value) throws DaoException { return queryNullAble( new JdbcTemplateCallBack < SUser > () { public SUser querys(JdbcTemplate jdbcTemplate) { return jdbcTemplate.queryForObject( " select * from suser where " + columnName + " =? " , new BeanPropertyRowMapper(SUser. class ),value); } }); } 鍏蜂綋鐨勫伐紼嬪彲浠ュ湪http://www.aygfsteel.com/freeman1984/archive/2011/10/24/361899.html 閲岄潰涓嬭澆銆?br /> ]]> xsocket婧愮爜瑙h http://www.aygfsteel.com/freeman1984/archive/2011/10/19/361593.html鐤媯 鐤媯 Wed, 19 Oct 2011 09:34:00 GMT http://www.aygfsteel.com/freeman1984/archive/2011/10/19/361593.html http://www.aygfsteel.com/freeman1984/comments/361593.html http://www.aygfsteel.com/freeman1984/archive/2011/10/19/361593.html#Feedback 2 http://www.aygfsteel.com/freeman1984/comments/commentRss/361593.html http://www.aygfsteel.com/freeman1984/services/trackbacks/361593.html 闃呰鍏ㄦ枃 ]]> android Tabhost閮ㄤ歡 http://www.aygfsteel.com/freeman1984/archive/2009/11/18/302803.html鐤媯 鐤媯 Wed, 18 Nov 2009 07:44:00 GMT http://www.aygfsteel.com/freeman1984/archive/2009/11/18/302803.html http://www.aygfsteel.com/freeman1984/comments/302803.html http://www.aygfsteel.com/freeman1984/archive/2009/11/18/302803.html#Feedback 9 http://www.aygfsteel.com/freeman1984/comments/commentRss/302803.html http://www.aygfsteel.com/freeman1984/services/trackbacks/302803.html 闃呰鍏ㄦ枃 ]]>
主站蜘蛛池模板:
辉南县 |
岳普湖县 |
双流县 |
库尔勒市 |
旬阳县 |
长葛市 |
顺平县 |
德昌县 |
玉田县 |
鄂尔多斯市 |
天全县 |
龙州县 |
宁明县 |
中宁县 |
财经 |
香港
|
鲁甸县 |
克拉玛依市 |
科尔 |
博乐市 |
绥江县 |
南丹县 |
芦山县 |
新密市 |
广元市 |
平原县 |
托克托县 |
英超 |
怀化市 |
松原市 |
威远县 |
双辽市 |
彰化市 |
红安县 |
镇安县 |
嘉善县 |
桑日县 |
馆陶县 |
萍乡市 |
望城县 |
乃东县 |