zoukankan      html  css  js  c++  java
  • 格式化Hibernate的SQL输出语句

    在 applicationContent.xml 文件中加入以下程序代码,及可以Console中看到 hibernate 执行sql 语句

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
            <property name="driverClassName" value="com.mysql.jdbc.Driver">
            </property>
            <property name="url" value="jdbc:mysql://127.0.0.1:3306/pecope">
            </property>
            <property name="username" value="root"></property>
            <property name="password" value="root"></property>
        </bean>
        <bean id="sessionFactory"
            class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
            <property name="dataSource">
                <ref bean="dataSource" />
            </property>
            <property name="hibernateProperties">
                
                <props>
                    <prop key="hibernate.dialect">
                        org.hibernate.dialect.MySQLDialect
                    </prop>
                    <prop key="hibernate.show_sql">true</prop>
                    <prop key="hibernate.format_sql">true</prop>
                    <prop key="hibernate.use_sql_comments">false</prop>
                </props>
            </property>
            <property name="annotatedClasses">
                <list>
                    <value>com.zbb.entity.Salesman</value>
                    <value>com.zbb.entity.Plan</value>
                    <value>com.zbb.entity.Schedule</value>
                    <value>com.zbb.entity.Room</value>
                    <value>com.zbb.entity.Customer</value>
                    <value>com.zbb.entity.Message</value>
                    <value>com.zbb.entity.Material</value>
                    <value>com.zbb.entity.Project</value>
                    <value>com.zbb.entity.Bargain</value>
                    <value>com.zbb.entity.Plan2</value>
                </list>
            </property>
        </bean>
  • 相关阅读:
    Python-24-多线程
    RT-Thread动态内存堆的使用
    Linux编程概念
    Linux_C语言基础
    文件IO_open(),read(),write(),lseek(),close()
    SourceTree跳转注册的方法
    Linux——软件安装
    初学DOM树解析xml文件
    简单json语句转化为map保存
    最大独立集求解
  • 原文地址:https://www.cnblogs.com/super-admin/p/5515882.html
Copyright © 2011-2022 走看看