Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable ONLY_FULL_GROUP_BY in hibernate

I need to disable ONLY_FULL_GROUP_BY in hibernate. This is my current session factory. I am not sure how to specify the sql_mode='' in this.

<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>
like image 591
Napstablook Avatar asked Jan 27 '17 08:01

Napstablook


1 Answers

I think you can set sql_mode in your JDBC connection string, e.g.

jdbc:mysql://localhost:3306/dbName?sessionVariables=sql_mode=''
like image 176
Tim Biegeleisen Avatar answered Sep 22 '22 10:09

Tim Biegeleisen