Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't make hibernate stop showing SQL using Spring JPA Vendor Adapter

Hibernate is continuing to spew SQL traces to stdout, and I can't figure out how to change a Hibernate configuration property when it's hidden behind a JPA adapter. This is the Spring bean for the entityManagerFactory:

<bean id="entityManagerFactory" 
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="ssapDataSource"/>
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" >
            <property name="showSql" value="false"/>
        </bean>
    </property>
</bean>

Even with the showSql property set to false, Hibernate keeps printing SQL.

I've tried making a hibernate.properties file in my classpath with "hibernate.show_sql=false", but it didn't pick that up either.

like image 457
Mojo Avatar asked Mar 24 '09 22:03

Mojo


2 Answers

Try setting it in persistance.xml

<persistence>
  <persistence-unit name="PU">
    <properties>
      <property name="hibernate.show_sql" value="false"/>
    </properties>
  </persistence-unit>
</persistence>
like image 75
NA. Avatar answered Sep 29 '22 19:09

NA.


<property name="jpaProperties">
    <props>
        <prop key="hibernate.show_sql">false</prop>
    </props>
</property>

this will also work

like image 23
navee Avatar answered Sep 29 '22 20:09

navee