パッケージ org.nkjmlab.sorm4j

インタフェース Sorm

    • メソッドの詳細

      • 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,
                           String user,
                           String password)
        Create a Sorm object which uses DriverManager.

        For example,

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

        static Sorm create​(String jdbcUrl)
        Create a Sorm object which uses DriverManager.

        For example,

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

        static OrmConnection toOrmConnection​(Connection connection)
        Create a OrmConnection wrapping the given JDBC Connection
        パラメータ:
        connection -
        戻り値:
      • accept

        void accept​(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 -
      • acceptJdbcConnectionHandler

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

        void acceptTransactionHandler​(ConsumerHandler<OrmTransaction> handler)
        Accepts a OrmTransaction handler for a task with object-relation mapping. The transaction will be committed and the connection will be closed after the process of handler. When the transaction throws a exception, the transaction will be rollback.
        パラメータ:
        handler -
      • apply

        <R> R apply​(FunctionHandler<OrmConnection,​R> handler)
        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 -
        パラメータ:
        handler -
        戻り値:
      • applyJdbcConnectionHandler

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

        <R> R applyTransactionHandler​(FunctionHandler<OrmTransaction,​R> handler)
        Applies a OrmTransaction handler for a task with object-relation mapping and gets the result. The transaction will be committed and the connection will be closed after the process of handler. When the transaction throws a exception, the transaction will be rollback.
        型パラメータ:
        R -
        パラメータ:
        handler -
        戻り値:
      • getContextString

        String getContextString()
        Gets the context string of this object.
        戻り値: