パッケージ org.nkjmlab.sorm4j
インタフェース Sorm
-
- すべてのスーパーインタフェース:
Orm,OrmMapReader,OrmReader,OrmUpdater,SqlExecutor,TableMetaDataFunction
public interface Sorm extends Orm
An interface of executing object-relation mapping.- 作成者:
- nkjm
-
-
ネストされたクラスの概要
ネストされたクラス 修飾子とタイプ インタフェース 説明 static classSorm.Builder
-
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 static SormContextDEFAULT_CONTEXT
-
メソッドの概要
すべてのメソッド staticメソッド インスタンス・メソッド abstractメソッド 修飾子とタイプ メソッド 説明 voidaccept(ConsumerHandler<OrmConnection> handler)Accepts aOrmConnectionhandler for a task with object-relation mapping.voidacceptJdbcConnectionHandler(ConsumerHandler<Connection> handler)Accepts aConnectionhandler for a task with object-relation mapping.voidacceptTransactionHandler(ConsumerHandler<OrmTransaction> handler)Accepts aOrmTransactionhandler for a task with object-relation mapping.voidacceptWithLogging(ConsumerHandler<OrmConnection> handler)<R> Rapply(FunctionHandler<OrmConnection,R> handler)Applies aOrmConnectionhandler for a task with object-relation mapping and gets the result.<R> RapplyJdbcConnectionHandler(FunctionHandler<Connection,R> handler)Applies aConnectionhandler for a task with object-relation mapping and gets the result.<R> RapplyTransactionHandler(FunctionHandler<OrmTransaction,R> handler)Applies aOrmTransactionhandler for a task with object-relation mapping and gets the result.<R> RapplyWithLogging(FunctionHandler<OrmConnection,R> handler)static Sormcreate(String jdbcUrl, String user, String password)Create aSormobject which usesDriverManager.static Sormcreate(String jdbcUrl, String user, String password, SormContext context)static Sormcreate(DataSource dataSource)Create aSormobject which usesDataSource.static Sormcreate(DataSource dataSource, SormContext context)static DataSourcecreateDriverManagerDataSource(String jdbcUrl, String username, String password)Creates aDataSourcewhich simply wrapsDriverManagerSormContextgetContext()Gets the config of this object.DataSourcegetDataSource()GetsDataSource.ConnectiongetJdbcConnection()Gets JDBCConnection.Map<String,String>getTableMappingStatusMap()Gets map of the table mapping status.static Sorm.BuildernewBuilder()static Sorm.BuildernewBuilder(String jdbcUrl, String user, String password)static Sorm.BuildernewBuilder(DataSource dataSource)OrmConnectionopenConnection()OpenOrmConnection.OrmTransactionopenTransaction()OpenOrmTransaction.static OrmConnectiontoOrmConnection(Connection connection)Create aOrmConnectionwrapping the given JDBC Connectionstatic OrmConnectiontoOrmConnection(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
-
-
-
-
フィールドの詳細
-
DEFAULT_CONTEXT
static final SormContext DEFAULT_CONTEXT
-
-
メソッドの詳細
-
create
static Sorm create(DataSource dataSource)
Create aSormobject which usesDataSource.- パラメータ:
dataSource-- 戻り値:
-
create
static Sorm create(DataSource dataSource, SormContext context)
-
create
static Sorm create(String jdbcUrl, String user, String password)
Create aSormobject which usesDriverManager.- パラメータ:
jdbcUrl-user-password-- 戻り値:
-
create
static Sorm create(String jdbcUrl, String user, String password, SormContext context)
-
createDriverManagerDataSource
static DataSource createDriverManagerDataSource(String jdbcUrl, String username, String password)
Creates aDataSourcewhich simply wrapsDriverManager- パラメータ:
jdbcUrl-username-password-- 戻り値:
-
toOrmConnection
static OrmConnection toOrmConnection(Connection connection)
Create aOrmConnectionwrapping the given JDBC Connection- パラメータ:
connection-- 戻り値:
-
toOrmConnection
static OrmConnection toOrmConnection(Connection connection, SormContext sormContext)
-
accept
void accept(ConsumerHandler<OrmConnection> handler)
Accepts aOrmConnectionhandler for a task with object-relation mapping. The connection will be closed after the process of handler.- パラメータ:
handler-
-
acceptWithLogging
void acceptWithLogging(ConsumerHandler<OrmConnection> handler)
-
applyWithLogging
<R> R applyWithLogging(FunctionHandler<OrmConnection,R> handler)
-
acceptJdbcConnectionHandler
void acceptJdbcConnectionHandler(ConsumerHandler<Connection> handler)
Accepts aConnectionhandler 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 aOrmTransactionhandler 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 aOrmConnectionhandler 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 aConnectionhandler 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 aOrmTransactionhandler 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-- 戻り値:
-
getContext
SormContext getContext()
Gets the config of this object.- 戻り値:
-
getDataSource
DataSource getDataSource()
GetsDataSource.- 戻り値:
-
getJdbcConnection
Connection getJdbcConnection()
Gets JDBCConnection.- 戻り値:
-
getTableMappingStatusMap
Map<String,String> getTableMappingStatusMap()
Gets map of the table mapping status. The keys are table names in lower case.- 戻り値:
-
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.- 戻り値:
-
newBuilder
static Sorm.Builder newBuilder()
-
newBuilder
static Sorm.Builder newBuilder(DataSource dataSource)
-
newBuilder
static Sorm.Builder newBuilder(String jdbcUrl, String user, String password)
-
-