随笔-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 阅读(5348) 评论(1)  编辑  收藏 所属分类: 学习心得

评论:
# re: 学习 Spring -- beans.xml 文件的创建[未登录] 2015-04-17 19:31 | 哈哈
烦烦烦  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: