Class AbstractHibernateBatchProcessor<T extends org.hibernate.SharedSessionContract>

java.lang.Object
com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor<T>
com.atlassian.crowd.util.persistence.hibernate.batch.hibernate5.AbstractHibernateBatchProcessor<T>
All Implemented Interfaces:
BatchProcessor<T>
Direct Known Subclasses:
Hibernate5BatchProcessor, Hibernate5StatelessSessionBatchProcessor

public abstract class AbstractHibernateBatchProcessor<T extends org.hibernate.SharedSessionContract> extends AbstractBatchProcessor<T>
  • Field Details

    • sessionFactory

      protected final org.hibernate.SessionFactory sessionFactory
  • Constructor Details

    • AbstractHibernateBatchProcessor

      public AbstractHibernateBatchProcessor(org.hibernate.SessionFactory sessionFactory)
  • Method Details

    • afterProcessBatch

      protected void afterProcessBatch()
      Description copied from class: AbstractBatchProcessor
      Called after successfully processing each batch.
      Specified by:
      afterProcessBatch in class AbstractBatchProcessor<T extends org.hibernate.SharedSessionContract>
    • afterProcessCollection

      protected void afterProcessCollection()
      Description copied from class: AbstractBatchProcessor
      Called when processing the collection has completed successfully.
      Specified by:
      afterProcessCollection in class AbstractBatchProcessor<T extends org.hibernate.SharedSessionContract>
    • afterProcessIndividual

      protected void afterProcessIndividual()
      Description copied from class: AbstractBatchProcessor
      Called after successully processing an item individually.
      Specified by:
      afterProcessIndividual in class AbstractBatchProcessor<T extends org.hibernate.SharedSessionContract>
    • beforeProcessBatch

      protected void beforeProcessBatch()
      Description copied from class: AbstractBatchProcessor
      Called before processing each batch. Can be used to start session or transaction that will cover this particular batch.
      Specified by:
      beforeProcessBatch in class AbstractBatchProcessor<T extends org.hibernate.SharedSessionContract>
    • beforeProcessCollection

      protected void beforeProcessCollection()
      Description copied from class: AbstractBatchProcessor
      Called before the collection is processed into a batch. Can be used to start session or transaction that will cover the execution of the entire collection which could involve multiple batches.
      Specified by:
      beforeProcessCollection in class AbstractBatchProcessor<T extends org.hibernate.SharedSessionContract>
    • beforeProcessIndividual

      protected void beforeProcessIndividual()
      Description copied from class: AbstractBatchProcessor
      Called before processing an individual item. This method will be called if the batch failed and the processor falls back to processing each item seperately.
      Specified by:
      beforeProcessIndividual in class AbstractBatchProcessor<T extends org.hibernate.SharedSessionContract>
    • rollbackProcessBatch

      protected void rollbackProcessBatch()
      Description copied from class: AbstractBatchProcessor
      Called after processing each batch where an exception was encountered.
      Specified by:
      rollbackProcessBatch in class AbstractBatchProcessor<T extends org.hibernate.SharedSessionContract>
    • rollbackProcessIndividual

      protected void rollbackProcessIndividual()
      Description copied from class: AbstractBatchProcessor
      Called after processing an individual item where an exception was encountered.
      Specified by:
      rollbackProcessIndividual in class AbstractBatchProcessor<T extends org.hibernate.SharedSessionContract>
    • commitTransaction

      protected void commitTransaction()
      Method is protected to allow subclasses to override the transaction management if they need to (e.g. use a transaction manager instead of manipulating the Hibernate session directly)
    • rollbackTransaction

      protected void rollbackTransaction()
      Method is protected to allow subclasses to override the transaction management if they need to (e.g. use a transaction manager instead of manipulating the Hibernate session directly)
    • clearSession

      protected abstract void clearSession()
    • closeSession

      protected abstract void closeSession()
    • flushSession

      protected abstract void flushSession()
    • openSession

      protected abstract T openSession()
    • startTransaction

      protected void startTransaction()
      Method is protected to allow subclasses to override the transaction management if they need to (e.g. use a transaction manager instead of manipulating the Hibernate session directly)