モジュール org.nkjmlab.sorm4j
パッケージ org.nkjmlab.sorm4j

インタフェース Sorm

  • すべてのスーパーインタフェース:
    Orm

    public interface Sorm
    extends Orm
    An interface of executing object-relation mapping. Object-relation mapping functions with an instant connection. When executing these functions, this object gets a connection and executes the function, after that closes the connection immediately.
    作成者:
    nkjm
    • メソッドの詳細

      • create

        static Sorm create​(DataSource dataSource)
        Create a Sorm object which uses DataSource.

        For example,

         
         DataSource dataSource = org.h2.jdbcx.JdbcConnectionPool.create("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;","sa","");
         Sorm.create(dataSource);
        
        パラメータ:
        dataSource -
        戻り値:
      • create

        static Sorm create​(String jdbcUrl)
        Creates a Sorm instance which uses the given DriverManagerDataSource. If you want specified more precise configuration of database access, create DataSource yourself and use create(DataSource) method.

        For example,

         
         Sorm.create("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;");
        
        パラメータ:
        jdbcUrl -
        戻り値:
      • getDefaultContext

        static SormContext getDefaultContext()
        Gets the default SormContext instance.
        戻り値:
      • acceptHandler

        void acceptHandler​(ConsumerHandler<OrmConnection> handler)
        Accepts a OrmConnection handler for a task with object-relation mapping. The connection will be closed after the process of handler.
        パラメータ:
        handler -
      • acceptHandler

        void acceptHandler​(int isolationLevel,
                           ConsumerHandler<OrmTransaction> transactionHandler)
        Accepts a OrmTransaction handler for a task with object-relation mapping.

        Note: The transaction will be closed after the process of handler. The transaction will be rolled back if the transaction closes before commit. When an exception throws in the transaction, the transaction will be rollback.

        パラメータ:
        isolationLevel -
        transactionHandler -
      • applyHandler

        <R> R applyHandler​(FunctionHandler<OrmConnection,​R> connectionHandler)
        Applies a OrmConnection handler for a task with object-relation mapping and gets the result. The connection will be closed after the process of handler.
        型パラメータ:
        R -
        パラメータ:
        connectionHandler -
        戻り値:
      • applyHandler

        <R> R applyHandler​(int isolationLevel,
                           FunctionHandler<OrmTransaction,​R> transactionHandler)
        Applies a OrmTransaction handler for a task with object-relation mapping and gets the result.

        Note: The transaction will be closed after the process of handler. The transaction will be rolled back if the transaction closes before commit. When an exception throws in the transaction, the transaction will be rolled back.

        型パラメータ:
        R -
        パラメータ:
        isolationLevel -
        transactionHandler -
        戻り値:
      • getTable

        <T> Table<T> getTable​(Class<T> objectClass)
        Gets a new Table instance.
        型パラメータ:
        T -
        パラメータ:
        objectClass -
        戻り値:
      • getTable

        <T> Table<T> getTable​(Class<T> type,
                              String tableName)
        Gets a new Table instance.
        型パラメータ:
        T -
        パラメータ:
        type -
        tableName -
        戻り値: