spring+Hibernate中委托方案怎么配置?

springHibernate浏览:449收藏:0
答案:

代理模式(也叫委托模式)

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="oracleDataSource"/>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${hibernate.dialect}</prop>
            <prop key="hibernate.connection.release_mode">after_transaction</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
            <prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop>
        </props>
    </property>
    <!-- Must references all OR mapping files. -->
    <property name="defineMappingResources">
        <list>
            <value>classpath:*-*ql.xml</value>
        </list>
    </property>
</bean>