Class ChainedInterceptorSupport

    • Field Detail

      • log

        protected final org.apache.log4j.Logger log
    • Constructor Detail

      • ChainedInterceptorSupport

        public ChainedInterceptorSupport()
    • Method Detail

      • setNextInterceptor

        public void setNextInterceptor​(org.hibernate.Interceptor nextInterceptor)
        As Hibernate doesn't support chaining of interceptors natively, we add the ability for chaining via a delegate.
        Parameters:
        nextInterceptor -
      • getNextInterceptor

        public org.hibernate.Interceptor getNextInterceptor()
      • instantiate

        public Object instantiate​(String beanClass,
                                  org.hibernate.EntityMode entityMode,
                                  Serializable id)
                           throws org.hibernate.CallbackException
        Specified by:
        instantiate in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
        See Also:
        Interceptor.instantiate(java.lang.String, org.hibernate.EntityMode, java.io.Serializable)
      • onLoad

        public boolean onLoad​(Object entity,
                              Serializable id,
                              Object[] state,
                              String[] propertyNames,
                              org.hibernate.type.Type[] types)
                       throws org.hibernate.CallbackException
        Specified by:
        onLoad in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
        See Also:
        Interceptor.onLoad(java.lang.Object, java.io.Serializable, java.lang.Object[], java.lang.String[], org.hibernate.type.Type[])
      • onFlushDirty

        public boolean onFlushDirty​(Object entity,
                                    Serializable id,
                                    Object[] currentState,
                                    Object[] previousState,
                                    String[] propertyNames,
                                    org.hibernate.type.Type[] types)
                             throws org.hibernate.CallbackException
        Specified by:
        onFlushDirty in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
        See Also:
        Interceptor.onFlushDirty(java.lang.Object, java.io.Serializable, java.lang.Object[], java.lang.Object[], java.lang.String[], org.hibernate.type.Type[])
      • onSave

        public boolean onSave​(Object entity,
                              Serializable id,
                              Object[] state,
                              String[] propertyNames,
                              org.hibernate.type.Type[] types)
                       throws org.hibernate.CallbackException
        Specified by:
        onSave in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
        See Also:
        Interceptor.onSave(java.lang.Object, java.io.Serializable, java.lang.Object[], java.lang.String[], org.hibernate.type.Type[])
      • onDelete

        public void onDelete​(Object entity,
                             Serializable id,
                             Object[] state,
                             String[] propertyNames,
                             org.hibernate.type.Type[] types)
                      throws org.hibernate.CallbackException
        Specified by:
        onDelete in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
        See Also:
        Interceptor.onDelete(java.lang.Object, java.io.Serializable, java.lang.Object[], java.lang.String[], org.hibernate.type.Type[])
      • preFlush

        public void preFlush​(Iterator entities)
                      throws org.hibernate.CallbackException
        Specified by:
        preFlush in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
        See Also:
        Interceptor.preFlush(java.util.Iterator)
      • postFlush

        public void postFlush​(Iterator entities)
                       throws org.hibernate.CallbackException
        Specified by:
        postFlush in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
        See Also:
        Interceptor.postFlush(java.util.Iterator)
      • isTransient

        public Boolean isTransient​(Object entity)
        Specified by:
        isTransient in interface org.hibernate.Interceptor
        See Also:
        Interceptor.isTransient(Object)
      • findDirty

        public int[] findDirty​(Object entity,
                               Serializable id,
                               Object[] currentState,
                               Object[] previousState,
                               String[] propertyNames,
                               org.hibernate.type.Type[] types)
        Specified by:
        findDirty in interface org.hibernate.Interceptor
        See Also:
        Interceptor.findDirty(java.lang.Object, java.io.Serializable, java.lang.Object[], java.lang.Object[], java.lang.String[], org.hibernate.type.Type[])
      • afterTransactionCompletion

        public void afterTransactionCompletion​(org.hibernate.Transaction transaction)
        Specified by:
        afterTransactionCompletion in interface org.hibernate.Interceptor
      • getEntityName

        public String getEntityName​(Object object)
                             throws org.hibernate.CallbackException
        Specified by:
        getEntityName in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
      • getEntity

        public Object getEntity​(String entityName,
                                Serializable serializable)
                         throws org.hibernate.CallbackException
        Specified by:
        getEntity in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
      • afterTransactionBegin

        public void afterTransactionBegin​(org.hibernate.Transaction transaction)
        Specified by:
        afterTransactionBegin in interface org.hibernate.Interceptor
      • beforeTransactionCompletion

        public void beforeTransactionCompletion​(org.hibernate.Transaction transaction)
        Specified by:
        beforeTransactionCompletion in interface org.hibernate.Interceptor
      • onCollectionRecreate

        public void onCollectionRecreate​(Object collection,
                                         Serializable key)
                                  throws org.hibernate.CallbackException
        Specified by:
        onCollectionRecreate in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
      • onCollectionRemove

        public void onCollectionRemove​(Object collection,
                                       Serializable key)
                                throws org.hibernate.CallbackException
        Specified by:
        onCollectionRemove in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
      • onCollectionUpdate

        public void onCollectionUpdate​(Object collection,
                                       Serializable key)
                                throws org.hibernate.CallbackException
        Specified by:
        onCollectionUpdate in interface org.hibernate.Interceptor
        Throws:
        org.hibernate.CallbackException
      • onPrepareStatement

        public String onPrepareStatement​(String sql)
        Specified by:
        onPrepareStatement in interface org.hibernate.Interceptor
      • setIdOnNewEntity

        protected static void setIdOnNewEntity​(org.hibernate.SessionFactory sessionFactory,
                                               Class<?> persistentClass,
                                               Serializable id,
                                               Object newEntity)
                                        throws org.hibernate.CallbackException
        Convenience methods subclasses can use to apply the id to a new entity if they override the instantiate method.
        Parameters:
        persistentClass -
        id -
        newEntity -
        Throws:
        org.hibernate.CallbackException