隨筆-42  評論-42  文章-0  trackbacks-0

          beans.xml


          <?xml version="1.0" encoding="UTF-8"?>
          <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:tx
          ="http://www.springframework.org/schema/tx"
              xsi:schemaLocation
          ="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
          >
              
          <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
                  
          <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
                  
          <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl" />
                  
          <property name="username" value="yiqi" />
                  
          <property name="password" value="yiqi" />
              
          </bean>
              
          <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
                  
          <property name="dataSource" ref="dataSource" />
                  
          <property name="hibernateProperties">
                      
          <props>
                          
          <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                          
          <prop key="hibernate.show_sql">true</prop>
                          
          <prop key="hibernate.jdbc.batch_size">1</prop>
                          
          <prop key="hibernate.hbm2ddl.auto">create</prop>
                      
          </props>
                  
          </property>
                  
          <property name="annotatedClasses">
                      
          <list>
                          
          <value>com.exercise.hibernate.EnglishUser</value>
                      
          </list>
                  
          </property>
              
          </bean>
              
          <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                  
          <property name="dataSource" ref="dataSource" />
                  
          <property name="sessionFactory" ref="sessionFactory" />
              
          </bean>
              
          <tx:annotation-driven />
              
          <bean id="EnglishUserDAO" class="com.exercise.hibernate.EnglishUserDAOImpl">
                  
          <property name="sessionFactory" ref="sessionFactory" />
              
          </bean>
          </beans>




          posted on 2008-03-16 23:30 BlueSunshine 閱讀(5369) 評論(1)  編輯  收藏 所屬分類: 學習心得

          評論:
          # re: 學習 Spring -- beans.xml 文件的創建[未登錄] 2015-04-17 19:31 | 哈哈
          煩煩煩  回復  更多評論
            
          主站蜘蛛池模板: 重庆市| 同仁县| 济阳县| 瓮安县| 贵阳市| 玉龙| 合江县| 乃东县| 华池县| 和林格尔县| 商都县| 衡阳县| 北碚区| 班戈县| 凯里市| 蕉岭县| 乌什县| 张家川| 澄江县| 高淳县| 手机| 江永县| 新沂市| 和田县| 天长市| 北辰区| 西峡县| 金平| 福建省| 揭东县| 栾城县| 柘荣县| 定结县| 紫云| 汤原县| 衢州市| 保靖县| 营山县| 大荔县| 息烽县| 三穗县|