public interface Database
Modifier and Type | Method and Description |
---|---|
default play.api.db.Database |
asScala()
Converts the given database to a Scala database
|
java.sql.Connection |
getConnection()
Get a JDBC connection from the underlying data source.
|
java.sql.Connection |
getConnection(boolean autocommit)
Get a JDBC connection from the underlying data source.
|
javax.sql.DataSource |
getDataSource() |
java.lang.String |
getName() |
java.lang.String |
getUrl() |
void |
shutdown()
Shutdown this database, closing the underlying data source.
|
default play.api.db.Database |
toScala()
Deprecated.
As of release 2.6.0. Use
asScala() |
<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.
|
java.lang.String getName()
javax.sql.DataSource getDataSource()
java.lang.String getUrl()
java.sql.Connection getConnection()
Don't forget to release the connection at some point by calling close().
java.sql.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()
@Deprecated default play.api.db.Database toScala()
asScala()
default play.api.db.Database asScala()