====== Hibernate Interceptor with JPA ====== * http://docs.jboss.org/hibernate/orm/4.2/manual/en-US/html/ch14.html * http://docs.jboss.org/hibernate/core/4.2/javadocs/org/hibernate/Interceptor.html : EmptyInterceptor를 상속해서 필요한 것만 구현할 것 * [[https://www.boraji.com/hibernate-5-interceptor-example|Hibernate 5 - Interceptor example | BORAJI.COM]] (아마도 Hibernate 3.3부터 추가된) onPrepareStatement 를 통해 쿼리를 변경하는것이 가능하다. http://www.mkyong.com/hibernate/hibernate-interceptor-example-audit-log/ with JPA * http://nsinfra.blogspot.kr/2013/10/audit-logging-using-hibernate.html * http://blog.krecan.net/2009/01/24/spring-managed-hibernate-interceptor-in-jpa/comment-page-1/ : persistenceProvider 자체를 변경하는 기법 * http://stackoverflow.com/questions/19217872/injecting-jpas-entity-manager-in-hibernates-emptyinterceptor * http://kurtstam.blogspot.kr/2008/10/hibernate-interceptors-events-and-jpa.html JPA에서는 ''hibernate.ejb.interceptor'' ''hibernate.session_factory.interceptor'', ''hibernate.session_factory.session_scoped_interceptor''프라퍼티에 Interceptor의 FQCN을 지정해주면된다. * [[http://www.baeldung.com/hibernate-interceptor|Hibernate Interceptors | Baeldung]] * [[http://egloos.zum.com/kwon37xi/v/4860051|JDBC SQL 구문에 클라이언트 정보 남기기]] ===== hibernate.session_factory.interceptor ===== * ''hibernate.session_factory.interceptor'' 는 모든 세션에 대해 하나의 interceptor 객체로 적용된다. * 따라서 각 세션에 특화된 공유 정보를 가지면 안된다. ===== hibernate.session_factory.session_scoped_interceptor ===== * ''hibernate.session_factory.session_scoped_interceptor'' : 세션별로 새로운 interceptor 객체를 생성한다.