This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Data JPA 3.4.0!spring-doc.cn

Frequently Asked Questions

Common

  1. I’d like to get more detailed logging information on what methods are called inside JpaRepository for example. How can I gain them? spring-doc.cn

    You can make use of CustomizableTraceInterceptor provided by Spring, as shown in the following example:spring-doc.cn

    <bean id="customizableTraceInterceptor" class="
      org.springframework.aop.interceptor.CustomizableTraceInterceptor">
      <property name="enterMessage" value="Entering $[methodName]($[arguments])"/>
      <property name="exitMessage" value="Leaving $[methodName](): $[returnValue]"/>
    </bean>
    
    <aop:config>
      <aop:advisor advice-ref="customizableTraceInterceptor"
        pointcut="execution(public * org.springframework.data.jpa.repository.JpaRepository+.*(..))"/>
    </aop:config>

Auditing

  1. I want to use Spring Data JPA auditing capabilities but have my database already configured to set modification and creation date on entities. How can I prevent Spring Data from setting the date programmatically? spring-doc.cn

    Set the set-dates attribute of the auditing namespace element to false.spring-doc.cn