锘??xml version="1.0" encoding="utf-8" standalone="yes"?>高清毛片在线看,久久精品视频在线,久久久久成人精品免费播放动漫http://www.aygfsteel.com/Tamino/category/10530.htmlzh-cnThu, 01 Mar 2007 02:39:53 GMTThu, 01 Mar 2007 02:39:53 GMT60Spring涓璈ibernate鐨勪嬌鐢ㄩ棶棰?閰嶇疆鍜孒ibernate寤惰繜鍔犺澆)http://www.aygfsteel.com/Tamino/articles/50494.htmlTaminoTaminoMon, 05 Jun 2006 06:55:00 GMThttp://www.aygfsteel.com/Tamino/articles/50494.htmlhttp://www.aygfsteel.com/Tamino/comments/50494.htmlhttp://www.aygfsteel.com/Tamino/articles/50494.html#Feedback0http://www.aygfsteel.com/Tamino/comments/commentRss/50494.htmlhttp://www.aygfsteel.com/Tamino/services/trackbacks/50494.html1銆傚緩璁嬌鐢℉iberante榪涜Session鍜孴ransaction鐨勭鐞?/p>

聽聽聽 灝嗛渶瑕佽繘琛屼簨鍔$殑澶氫釜鍘熷瓙DAO璁劇疆鍒癝ervice閲岋紝鍦⊿ervice灞傝繘琛屼簨鍔℃帶鍒跺拰浼氳瘽鎺у埗

聽聽聽 璁劇疆涓涓熀紜鐨刣ao錛屽嵆baseDAO 涓旂戶鎵夸箣HibernateDaoSupport錛岃屼笟鍔″璞″師瀛怐AO錛屾寔鏈変竴涓猙aseDAO鐨勫紩鐢紝閫氳繃setter娉ㄥ皠璁劇疆鍒頒笟鍔AO涓?/p>

聽聽聽 澶氫釜鍘熷瓙DAO錛岄氳繃setter娉ㄥ皠鍒癝ervice灞傘?/p>

2銆傚湪鏄劇ず灞傦紝涓瀵瑰鏄劇ず鏃訛紝鎻愮ずSession鍏抽棴鐨勯棶棰?/p>

聽聽聽 涓や釜瑙e喅鏂規硶錛?
聽聽聽 1錛夊湪one錛峵o錛峬any璁劇疆lazy錛漟alse錛屽嵆涓嶅歡榪熷姞杞藉瓙瀵硅薄錛屼絾榪欐牱鍙兘浼氬甫鏉ユц兘鐨勯棶棰橈紝鐗瑰埆鏄埗瀛愬叧緋繪ā鍨嬫槸鏍戠姸緇撴瀯鏃躲?br />聽聽聽 2錛変嬌鐢℉ibernate鎻愪緵鐨刼penSessiojnInView鎶鏈紝鍗沖湪瑙嗗浘灞傚紑鍚拰鍏抽棴Session錛屽湪service灞傝繘琛? Transaction綆$悊錛岃繖涓緝涓虹畝鍗曪紝鍙渶瑕佽緗竴涓猣ilter鍗沖彲錛屽湪web.xml涓厤緗?/p>

<filter>
聽聽<filter-name>hibernateFilter</filter-name>
聽聽<filter-class>org.springframework.orm.hibernate.support.OpenSessionInViewFilter</filter-class>
聽</filter>
聽<filter-mapping>
聽聽<filter-name>hibernateFilter</filter-name>
聽聽<url-pattern>/*</url-pattern>
聽</filter-mapping>

闇瑕佹敞鎰忕殑鏄紝OpenSessionInViewFilter鍦ㄨ皟鐢ㄨ繃紼嬩腑錛岄渶瑕佸紩鐢⊿pring鐨凙pplicationContext錛岃岃 瀵硅薄瀹炰緥蹇呴』鏄繚瀛樺湪ServletContext涓殑錛屽洜姝ら渶瑕佸湪web.xml涓濮嬪寲Spring鐨勭幆澧冿紝澧炲姞閰嶇疆濡備笅錛?/p>

聽<context-param>
聽聽聽聽聽聽聽聽聽聽聽聽 <param-name>contextConfigLocation</param-name>
聽聽聽聽聽聽聽聽聽聽聽聽 <param-value>/WEB-INF/spring/applicationContext-hibernate.xml</param-value>
聽聽聽聽聽聽 聽</context-param>

聽聽聽聽 <servlet>
聽聽聽聽 <servlet-name>context</servlet-name>
聽聽聽聽聽聽聽聽聽聽聽聽 <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
聽聽聽聽聽聽聽聽聽聽聽聽 <load-on-startup>1</load-on-startup>
聽聽聽 聽</servlet>

鍏朵腑

<servlet-name>context</servlet-name>
聽聽聽聽聽聽聽聽聽聽聽聽 <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
聽聽聽聽聽聽聽聽聽聽聽聽 <load-on-startup>1</load-on-startup>
聽聽聽 聽</servlet>

琛ㄧず鍦ㄥ惎鍔ㄦ椂錛岃繘琛孲pring鐜鐨勫濮嬪寲錛屽洜姝や互鍚庡鏋滆寮曠敤Spring涓殑鏌愪釜bean瀹炰緥

濡備笅浠g爜鍗沖彲

org.springframework.context.ApplicationContext ctx = (org.springframework.context.ApplicationContext)application.getAttribute(org.springframework.web.context.WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);

鐒跺悗璋冪敤ctx.getBean榪斿洖bean瀹炰緥

Spring涓嶅彧鏄疉OP鍜孖OC錛屾洿鎻愪緵浜嗗ぇ閲忕殑鍙噸鐢ㄦ妧鏈紝璀request涓殑閲嶈緙栫爜錛孲pring鎻愪緵浜嗙浉搴旂殑Filter錛?strong>org.springframework.web.filter.CharacterEncodingFilter 閫氳繃鐩存帴閰嶇疆錛屽嵆鍙В鍐砏eb搴旂敤涓璓OST鐨勪腑鏂囦貢鐮侀棶棰橈紝JMS鐨?strong>org.springframework.jms 鍖吢?JavaMail鐨?strong>org.springframework.mail鍖?/strong>絳夌瓑錛屾洿澶氱殑錛岃鍙傜湅Spring鐨剅eference錛?/p>

Spring鑳芥敼鍠勭幇鏈変唬鐮佺粨鏋勶紝澶ч噺鐨勫噺灝慼ard code錛屽姞蹇紑鍙戣繘搴︼紱

涓鐩存湁涓縐嶆劅瑙夛細緋葷粺鐨勬瀯寤烘槸綾諱技鐨勬惌縐湪

Tamino 2006-06-05 14:55 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 阳东县| 嘉鱼县| 池州市| 洛扎县| 兴仁县| 方正县| 临沧市| 肥城市| 当阳市| 古交市| 嘉义县| 元谋县| 客服| 龙江县| 南昌县| 封丘县| 株洲县| 衡阳县| 宁乡县| 霞浦县| 集安市| 建德市| 吴江市| 平遥县| 麟游县| 齐河县| 芜湖市| 拉萨市| 西充县| 固镇县| 和政县| 永城市| 天津市| 吴川市| 原平市| 太湖县| 莲花县| 驻马店市| 定西市| 卢氏县| 孟连|