- すべてのスーパーインタフェース:
Orm
- 作成者:
- nkjm
-
メソッドの概要
修飾子とタイプメソッド説明voidacceptHandler(int isolationLevel, ConsumerHandler<OrmTransaction> transactionHandler) Accepts aOrmTransactionhandler for a task with object-relation mapping.voidacceptHandler(ConsumerHandler<OrmConnection> handler) Accepts aOrmConnectionhandler for a task with object-relation mapping.<R> RapplyHandler(int isolationLevel, FunctionHandler<OrmTransaction, R> transactionHandler) Applies aOrmTransactionhandler for a task with object-relation mapping and gets the result.<R> RapplyHandler(FunctionHandler<OrmConnection, R> connectionHandler) Applies aOrmConnectionhandler for a task with object-relation mapping and gets the result.static SormCreates aSorminstance which uses the givenDriverManagerDataSource.static Sormcreate(DataSource dataSource) Create aSormobject which usesDataSource.static Sormcreate(DataSource dataSource, SormContext context) static DriverManagerDataSourcecreateDataSource(String jdbcUrl, String username, String password) Creates an instance ofDriverManagerDataSourceGetsDataSource.static SormContextGets the defaultSormContextinstance.<T> Table<T>Gets a newTableinstance.<T> Table<T>Gets a newTableinstance.open()OpenOrmConnection.open(int isolationLevel) OpenOrmTransaction.Opens JDBCConnection.インタフェースから継承されたメソッド org.nkjmlab.sorm4j.Orm
delete, delete, delete, deleteAll, deleteAllIn, deleteByPrimaryKey, deleteByPrimaryKeyIn, deleteIn, deleteIn, deleteIn, execute, execute, executeQuery, executeQuery, executeQuery, executeQuery, executeUpdate, executeUpdate, exists, existsByPrimaryKey, existsByPrimaryKeyIn, existsIn, getContext, getJdbcDatabaseMetaData, getJdbcTableMetaData, getResultSetTraverser, getRowMapper, getTableMetaData, getTableName, getTableSql, getTableSql, insert, insert, insert, insertAndGet, insertAndGet, insertAndGet, insertAndGetIn, insertAndGetIn, insertAndGetIn, insertInto, insertInto, insertInto, insertMapInto, insertMapInto, insertMapInto, join, join, joinOn, joinOn, joinUsing, leftJoinOn, leftJoinOn, merge, merge, merge, mergeIn, mergeIn, mergeIn, readFirst, readFirst, readList, readList, readOne, readOne, readTupleList, readTupleList, readTupleList, readTupleList, selectAll, selectByPrimaryKey, stream, stream, streamAll, update, update, update, updateByPrimaryKey, updateByPrimaryKeyIn, updateWith, updateWith, updateWith
-
メソッドの詳細
-
create
Create aSormobject which usesDataSource.For example,
DataSource dataSource = org.h2.jdbcx.JdbcConnectionPool.create("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;","sa",""); Sorm.create(dataSource);- パラメータ:
dataSource-- 戻り値:
-
create
- パラメータ:
dataSource-context-- 戻り値:
-
create
Creates aSorminstance which uses the givenDriverManagerDataSource.If you want specified more precise configuration of database access, create
DataSourceyourself and usecreate(DataSource)method.For example,
Sorm.create("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;");- パラメータ:
jdbcUrl-- 戻り値:
-
createDataSource
Creates an instance ofDriverManagerDataSourceExample:
Sorm.createDataSource("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;", null, null);- パラメータ:
jdbcUrl-username-password-- 戻り値:
-
getDefaultContext
Gets the defaultSormContextinstance.- 戻り値:
-
acceptHandler
Accepts aOrmConnectionhandler for a task with object-relation mapping. The connection will be closed after the process of handler.- パラメータ:
handler-
-
acceptHandler
Accepts aOrmTransactionhandler 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
Applies aOrmConnectionhandler for a task with object-relation mapping and gets the result. The connection will be closed after the process of handler.- 型パラメータ:
R-- パラメータ:
connectionHandler-- 戻り値:
-
applyHandler
Applies aOrmTransactionhandler 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-- 戻り値:
-
getDataSource
DataSource getDataSource()GetsDataSource.- 戻り値:
-
openJdbcConnection
Connection openJdbcConnection()Opens JDBCConnection.- 戻り値:
-
open
OrmConnection open()OpenOrmConnection. You should always usetry-with-resourcesblock to ensure the database connection is released.You cold also use
acceptHandler(ConsumerHandler)orapplyHandler(FunctionHandler).- 戻り値:
-
open
OpenOrmTransaction. You should always use try-with-resources block to ensure the database connection is released.You could also use
acceptHandler(int, ConsumerHandler)orapplyHandler(int, FunctionHandler).Note: If you do not explicitly commit in a opened transaction, it will be rolled back.
- パラメータ:
isolationLevel-Connection.TRANSACTION_READ_COMMITTED,Connection.TRANSACTION_READ_UNCOMMITTED, ...,and so on.- 戻り値:
-
getTable
Gets a newTableinstance.- 型パラメータ:
T-- パラメータ:
objectClass-- 戻り値:
-
getTable
Gets a newTableinstance.- 型パラメータ:
T-- パラメータ:
type-tableName-- 戻り値:
-