08-07
23

添加数据库缓冲区

<bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName">
            <value>com.mysql.jdbc.Driver</value>
        </property>
        <property name="url">
            <value>
                jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8
            </value>
        </property>
        <property name="username">
            <value>root</value>
        </property>
        <property name="password">
            <value>root</value>
        </property>
    </bean>
    <bean id="localSessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="mappingResources">
            <list>
                <value>com/xiang/model/Dept.hbm.xml</value>
                <value>com/xiang/model/User.hbm.xml</value>
                <value>com/xiang/model/Role.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    org.hibernate.dialect.MySQLDialect
                </prop>
                <prop key="hibernate.use_outer_join">true</prop>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.max_fetch_depth">1</prop>
                <!--<prop key="hibernate.hbm2ddl.auto">update</prop>-->
                <prop key="hibernate.cache.provider_class">
                    org.hibernate.cache.HashtableCacheProvider
                </prop>
            </props>
        </property>
        <property name="eventListeners">
            <map>
                <entry key="merge">
                    <bean
                        class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
                </entry>
            </map>
        </property>
    </bean>
    <bean id="hibernateAccessor"
        class="org.springframework.orm.hibernate3.HibernateTemplate">
        <property name="sessionFactory" ref="localSessionFactory" />
    </bean>
    <bean id="sessionFactory" factory-bean="hibernateAccessor"
        factory-method="getSessionFactory" />

[本日志由 blurxx 于 2008-07-23 08:52 AM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: 缓冲
相关日志:
评论: 0 | 引用: 0 | 查看次数: 636
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 关闭