パッケージ org.nkjmlab.sorm4j
インタフェース Sorm
- すべてのスーパーインタフェース:
Orm
,OrmMapReader
,OrmReader
,OrmUpdater
,SqlExecutor
,TableMetaDataFunction
An interface of executing object-relation mapping.
- 作成者:
- nkjm
-
ネストされたクラスの概要
-
メソッドの概要
修飾子とタイプメソッド説明void
accept
(ConsumerHandler<OrmConnection> handler) Accepts aOrmConnection
handler for a task with object-relation mapping.void
Accepts aConnection
handler for a task with object-relation mapping.void
Accepts aOrmTransaction
handler for a task with object-relation mapping.void
acceptWithLogging
(ConsumerHandler<OrmConnection> handler) <R> R
apply
(FunctionHandler<OrmConnection, R> handler) Applies aOrmConnection
handler for a task with object-relation mapping and gets the result.<R> R
applyJdbcConnectionHandler
(FunctionHandler<Connection, R> handler) Applies aConnection
handler for a task with object-relation mapping and gets the result.<R> R
applyTransactionHandler
(FunctionHandler<OrmTransaction, R> handler) Applies aOrmTransaction
handler for a task with object-relation mapping and gets the result.<R> R
applyWithLogging
(FunctionHandler<OrmConnection, R> handler) static Sorm.Builder
builder()
static Sorm.Builder
static Sorm.Builder
builder
(DataSource dataSource) static Sorm
Create aSorm
object which usesDriverManager
.static Sorm
Create aSorm
object which usesDriverManager
.static Sorm
create
(DataSource dataSource) Create aSorm
object which usesDataSource
.static DataSource
createDataSource
(String jdbcUrl, String username, String password) Creates aDataSource
which simply wrapsDriverManager
Gets the context string of this object.GetsDataSource
.Gets JDBCConnection
.OpenOrmConnection
.OpenOrmTransaction
.static void
setDefaultContext
(Function<SormContext.Builder, SormContext> contextGenerator) static OrmConnection
toOrmConnection
(Connection connection) Create aOrmConnection
wrapping the given JDBC Connectionstatic OrmConnection
toOrmConnection
(Connection connection, SormContext sormContext) インタフェースから継承されたメソッド org.nkjmlab.sorm4j.OrmMapReader
getResultSetToMapTraverser, getRowToMapMapper, readMapFirst, readMapFirst, readMapList, readMapList, readMapOne, readMapOne
インタフェースから継承されたメソッド org.nkjmlab.sorm4j.OrmReader
exists, getResultSetTraverser, getRowMapper, readAll, readByPrimaryKey, readFirst, readFirst, readList, readList, readOne, readOne, readTupleList, readTupleList, readTupleList, readTupleList
インタフェースから継承されたメソッド org.nkjmlab.sorm4j.OrmUpdater
delete, delete, delete, deleteAll, deleteAllOn, deleteOn, deleteOn, deleteOn, insert, insert, insert, insertAndGet, insertAndGet, insertAndGet, insertAndGetOn, insertAndGetOn, insertAndGetOn, insertOn, insertOn, insertOn, merge, merge, merge, mergeOn, mergeOn, mergeOn, update, update, update, updateOn, updateOn, updateOn
インタフェースから継承されたメソッド org.nkjmlab.sorm4j.SqlExecutor
acceptPreparedStatementHandler, applyPreparedStatementHandler, executeQuery, executeQuery, executeUpdate, executeUpdate
インタフェースから継承されたメソッド org.nkjmlab.sorm4j.TableMetaDataFunction
getTableMetaData, getTableMetaData, getTableName
-
メソッドの詳細
-
create
Create aSorm
object 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
Create aSorm
object which usesDriverManager
.For example,
Sorm.create("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;","sa","");
- パラメータ:
jdbcUrl
-user
-password
-- 戻り値:
-
create
Create aSorm
object which usesDriverManager
.For example,
Sorm.create("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;");
- パラメータ:
jdbcUrl
-- 戻り値:
-
setDefaultContext
-
createDataSource
Creates aDataSource
which simply wrapsDriverManager
- パラメータ:
jdbcUrl
-username
-password
-- 戻り値:
-
toOrmConnection
Create aOrmConnection
wrapping the given JDBC Connection- パラメータ:
connection
-- 戻り値:
-
toOrmConnection
-
accept
Accepts aOrmConnection
handler for a task with object-relation mapping. The connection will be closed after the process of handler.- パラメータ:
handler
-
-
acceptWithLogging
-
applyWithLogging
-
acceptJdbcConnectionHandler
Accepts aConnection
handler for a task with object-relation mapping. The connection will be closed after the process of handler.- パラメータ:
handler
-
-
acceptTransactionHandler
Accepts aOrmTransaction
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
Applies aOrmConnection
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
Applies aConnection
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
Applies aOrmTransaction
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.- 戻り値:
-
getDataSource
DataSource getDataSource()GetsDataSource
.- 戻り値:
-
getJdbcConnection
Connection getJdbcConnection()Gets JDBCConnection
.- 戻り値:
-
openConnection
OrmConnection openConnection()OpenOrmConnection
. You should always use try-with-resources to ensure the database connection is released. We recommend usingaccept(ConsumerHandler)
orapply(FunctionHandler)
.- 戻り値:
-
openTransaction
OrmTransaction openTransaction()OpenOrmTransaction
. You should always use try-with-resources to ensure the database connection is released. We recommend usingacceptTransactionHandler(ConsumerHandler)
orapplyTransactionHandler(FunctionHandler)
. Default transaction level isConnection.TRANSACTION_READ_COMMITTED
. Note: the transaction is automatically rollback if the transaction is not committed.- 戻り値:
-
builder
-
builder
-
builder
-