AnnotationSessionFactoryBean 继承LocalSessionFactoryBean

今天用到,查了一下refrence,顺便把它贴出来:

xml version="1.0" encoding="UTF-8" ?>
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
        "http://www.springframework.org/dtd/spring-beans.dtd"
>
< beans >
    
< bean  id ="propertyConfigurer"  class ="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
        
< property  name ="location" >
            
< value > classpath:jdbc.properties value >
        
property >
    
bean >

    
< bean  id ="c3p0DataSource"  class ="com.mchange.v2.c3p0.ComboPooledDataSource"
          destroy-method
="close" >
        
< property  name ="driverClass" >
            
< value > ${db.driverClass} value >
        
property >
        
< property  name ="jdbcUrl" >
            
< value > ${db.url} value >
        
property >
        
< property  name ="properties" >
            
< props >
                
< prop  key ="c3p0.acquire_increment" > 5 prop >
                
< prop  key ="c3p0.idle_test_period" > 100 prop >
                
< prop  key ="c3p0.max_size" > 100 prop >
                
< prop  key ="c3p0.max_statements" > 0 prop >
                
< prop  key ="c3p0.min_size" > 10 prop >
                
< prop  key ="user" > ${db.user} prop >
                
< prop  key ="password" > ${db.pass} prop >
            
props >
        
property >
    
bean >

    
< bean  id ="sessionFactory"  class ="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" >
        
< property  name ="hibernateProperties" >
            
< props >
                
< prop  key ="hibernate.dialect" > ${hibernate.dialect} prop >
                
< prop  key ="hibernate.show_sql" > ${hibernate.show_sql} prop >
            
props >
        
property >
        
< property  name ="dataSource"  ref ="c3p0DataSource" />
        
< property  name ="annotatedClasses"  value ="martin.dwr.demo.model.User" />
    
bean >

    
< bean  id ="userDao"  class ="martin.dwr.demo.dao.hibernate.HibernateUserDAO" >
        
< property  name ="sessionFactory"  ref ="sessionFactory" />
    
bean >
beans >