小编典典

在休眠状态下禁用ONLY_FULL_GROUP_BY

hibernate

我需要在hibernate状态下禁用ONLY_FULL_GROUP_BY。这是我当前的会话工厂。我不确定如何在其中指定sql_mode =’‘。

<bean id="eAgilitySessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="eAgilitysDataSource"/>
    <property name="configLocation">
        <value>classpath:hibernate.cfg.xml</value>
    </property>
    <property name="configurationClass">
        <value>org.hibernate.cfg.AnnotationConfiguration</value>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${mysql.dialect}</prop>
            <prop key="hibernate.show_sql">false</prop>
            <prop key="hibernate.connection.useUnicode">true</prop>
            <prop key="hibernate.connection.characterEncoding">UTF-8</prop>
            <prop key="hibernate.connection.charSet">UTF-8</prop>
            <prop key="hibernate.connection.url">${dwh.db.url}</prop>
            <prop key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop>
         </props>
    </property>
</bean>

阅读 261

收藏
2020-06-20

共1个答案

小编典典

我认为您可以sql_mode在JDBC连接字符串中进行设置,例如

jdbc:mysql://localhost:3306/dbName?sessionVariables=sql_mode=''
2020-06-20