public interface Database
Modifier and Type | Method and Description |
---|---|
default play.api.db.Database |
asScala()
Converts the given database to a Scala database
|
Connection |
getConnection()
Get a JDBC connection from the underlying data source.
|
Connection |
getConnection(boolean autocommit)
Get a JDBC connection from the underlying data source.
|
DataSource |
getDataSource() |
String |
getName() |
String |
getUrl() |
void |
shutdown()
Shutdown this database, closing the underlying data source.
|
<A> A |
withConnection(boolean autocommit,
ConnectionCallable<A> block)
Execute a block of code, providing a JDBC connection.
|
void |
withConnection(boolean autocommit,
ConnectionRunnable block)
Execute a block of code, providing a JDBC connection.
|
<A> A |
withConnection(ConnectionCallable<A> block)
Execute a block of code, providing a JDBC connection.
|
void |
withConnection(ConnectionRunnable block)
Execute a block of code, providing a JDBC connection.
|
<A> A |
withTransaction(ConnectionCallable<A> block)
Execute a block of code in the scope of a JDBC transaction.
|
void |
withTransaction(ConnectionRunnable block)
Execute a block of code in the scope of a JDBC transaction.
|
<A> A |
withTransaction(TransactionIsolationLevel isolationLevel,
ConnectionCallable<A> block)
Execute a block of code in the scope of a JDBC transaction.
|
void |
withTransaction(TransactionIsolationLevel isolationLevel,
ConnectionRunnable block)
Execute a block of code in the scope of a JDBC transaction.
|
String getName()
DataSource getDataSource()
String getUrl()
Connection getConnection()
Don't forget to release the connection at some point by calling close().
Connection getConnection(boolean autocommit)
Don't forget to release the connection at some point by calling close().
autocommit
- determines whether to autocommit the connectionvoid withConnection(ConnectionRunnable block)
block
- code to execute<A> A withConnection(ConnectionCallable<A> block)
A
- the return value's typeblock
- code to executevoid withConnection(boolean autocommit, ConnectionRunnable block)
autocommit
- determines whether to autocommit the connectionblock
- code to execute<A> A withConnection(boolean autocommit, ConnectionCallable<A> block)
A
- the return value's typeautocommit
- determines whether to autocommit the connectionblock
- code to executevoid withTransaction(ConnectionRunnable block)
block
- code to executevoid withTransaction(TransactionIsolationLevel isolationLevel, ConnectionRunnable block)
isolationLevel
- determines transaction isolation levelblock
- code to execute<A> A withTransaction(ConnectionCallable<A> block)
A
- the return value's typeblock
- code to execute<A> A withTransaction(TransactionIsolationLevel isolationLevel, ConnectionCallable<A> block)
A
- the return value's typeisolationLevel
- determines transaction isolation levelblock
- code to executevoid shutdown()
default play.api.db.Database asScala()