public class Config extends Object
| 构造器和说明 |
|---|
Config(String name,
DataSource dataSource)
Constructor with DataSource
|
Config(String name,
DataSource dataSource,
Dialect dialect)
Constructor with DataSource and Dialect
|
Config(String name,
DataSource dataSource,
Dialect dialect,
Boolean showSql,
Boolean devMode,
Integer transactionLevel,
IContainerFactory containerFactory,
ICache cache)
Constructor with full parameters
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close(Connection conn) |
void |
close(ResultSet rs,
Statement st,
Connection conn)
Close ResultSet、Statement、Connection ThreadLocal support declare transaction.
|
void |
close(Statement st,
Connection conn) |
ICache |
getCache() |
Connection |
getConnection()
Get Connection.
|
IContainerFactory |
getContainerFactory() |
DataSource |
getDataSource() |
Dialect |
getDialect() |
String |
getName() |
Connection |
getThreadLocalConnection()
Helps to implement nested transaction.
|
int |
getTransactionLevel() |
boolean |
isDevMode() |
boolean |
isInTransaction()
Return true if current thread in transaction.
|
boolean |
isShowSql() |
void |
removeThreadLocalConnection() |
void |
setThreadLocalConnection(Connection connection)
Support transaction with Transaction interceptor
|
public Config(String name, DataSource dataSource)
dataSource - the dataSource, can not be nullpublic Config(String name, DataSource dataSource, Dialect dialect)
dataSource - the dataSource, can not be nulldialect - the dialect, can not be nullpublic Config(String name, DataSource dataSource, Dialect dialect, Boolean showSql, Boolean devMode, Integer transactionLevel, IContainerFactory containerFactory, ICache cache)
dataSource - the dataSource, can not be nulldialect - the dialect, set null with default value: new MysqlDialect()showSql - the showSql,set null with default value: falsedevMode - the devMode, set null with default value: falsetransactionLevel - the transaction level, set null with default value:
Connection.TRANSACTION_READ_COMMITTEDcontainerFactory - the containerFactory, set null with default value: new IContainerFactory(){......}cache - the cache, set null with default value: new EhCache()public String getName()
public Dialect getDialect()
public ICache getCache()
public int getTransactionLevel()
public DataSource getDataSource()
public IContainerFactory getContainerFactory()
public boolean isShowSql()
public boolean isDevMode()
public final void setThreadLocalConnection(Connection connection)
public final void removeThreadLocalConnection()
public final Connection getConnection() throws SQLException
SQLExceptionpublic final Connection getThreadLocalConnection()
public final boolean isInTransaction()
public final void close(ResultSet rs, Statement st, Connection conn)
public final void close(Statement st, Connection conn)
public final void close(Connection conn)
Copyright © 2015. All rights reserved.