Class ModelAwareTransactionCallback<M extends ItemModel>

java.lang.Object
de.hybris.platform.servicelayer.tx.ModelAwareTransactionCallback<M>
All Implemented Interfaces:
org.springframework.transaction.support.TransactionCallback
Direct Known Subclasses:
ModelAwareTransactionCallbackWithoutResult

public abstract class ModelAwareTransactionCallback<M extends ItemModel> extends Object implements org.springframework.transaction.support.TransactionCallback
Model-aware transaction wrapper which internally consist of preparation , performing the logic from doInModelAwareTransaction(TransactionStatus) and storing phase.

Preparation consist of:

  • creating/getting transaction for current thread;
  • setting provided enableDelayed store flag;
  • *

Store phase consist of:

  • saving all unsaved models via provided model service;
  • Constructor Details

    • ModelAwareTransactionCallback

      public ModelAwareTransactionCallback()
  • Method Details

    • getModelService

      protected abstract ModelService getModelService()
      Returns:
      the modelService
    • isEnableDelayedStore

      protected boolean isEnableDelayedStore()
      Returns:
      enableDelayedStore flag, by default delayed store is disabled.
    • doInTransaction

      public final M doInTransaction(org.springframework.transaction.TransactionStatus status)
      Specified by:
      doInTransaction in interface org.springframework.transaction.support.TransactionCallback<M extends ItemModel>
    • prepareTransaction

      protected Transaction prepareTransaction()
      Method providing prepare logic before doInModelAwareTransaction(TransactionStatus). Default this method gets current transaction Transaction.current().
    • doInModelAwareTransaction

      protected abstract M doInModelAwareTransaction(org.springframework.transaction.TransactionStatus status)
      Method used for providing model-aware execution inside transaction.