Class DefaultSessionUtils

  • All Implemented Interfaces:
    SessionUtils

    public class DefaultSessionUtils
    extends java.lang.Object
    implements SessionUtils
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <V> V withManualFlush​(java.util.function.Supplier<V> supplier)
      Converts the flush mode for the current session factory to MANUAL for the duration of the call to the given supplier.
      <V> V withReadOnlyTransaction​(java.util.function.Supplier<V> supplier)
      Invokes the given supplier within the context of a read-only transaction.
      <V> V withTransaction​(java.util.function.Supplier<V> supplier)
      Invoked the given supplier within the context of a transaction.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultSessionUtils

        public DefaultSessionUtils()
    • Method Detail

      • withTransaction

        public <V> V withTransaction​(java.util.function.Supplier<V> supplier)
        Description copied from interface: SessionUtils
        Invoked the given supplier within the context of a transaction.
        Specified by:
        withTransaction in interface SessionUtils
        Type Parameters:
        V - type returned by the supplier
        Parameters:
        supplier - supplier to invoke
        Returns:
        value returned by the supplier
      • withReadOnlyTransaction

        public <V> V withReadOnlyTransaction​(java.util.function.Supplier<V> supplier)
        Description copied from interface: SessionUtils
        Invokes the given supplier within the context of a read-only transaction.
        Specified by:
        withReadOnlyTransaction in interface SessionUtils
        Type Parameters:
        V - type returned by the supplier
        Parameters:
        supplier - supplier to invoke
        Returns:
        value returned by the supplier
      • withManualFlush

        public <V> V withManualFlush​(java.util.function.Supplier<V> supplier)
        Description copied from interface: SessionUtils
        Converts the flush mode for the current session factory to MANUAL for the duration of the call to the given supplier. The flush mode is reverted to it's previous value after the call.
        Specified by:
        withManualFlush in interface SessionUtils
        Type Parameters:
        V - type returned by the supplier
        Parameters:
        supplier - supplier to invoke
        Returns:
        value returned by the supplier