2017-01-27 45 views
2

我需要在休眠时禁用ONLY_FULL_GROUP_BY。 这是我当前的会话工厂。 我不知道如何在这里指定sql_mode =''。在休眠时禁用ONLY_FULL_GROUP_BY

<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> 

回答

3

我想你可以把你的JDBC连接字符串,例如在设置sql_mode

jdbc:mysql://localhost:3306/dbName?sessionVariables=sql_mode='' 
+1

你是救世主。 谢谢 – Napstablook