Package play.db
Class DefaultDatabase
- java.lang.Object
-
- play.db.DefaultDatabase
-
- All Implemented Interfaces:
play.db.Database
public class DefaultDatabase extends java.lang.Object implements play.db.DatabaseDefault delegating implementation of the database API.
-
-
Constructor Summary
Constructors Constructor Description DefaultDatabase(java.lang.String name, com.typesafe.config.Config configuration)Create a default HikariCP-backed database.DefaultDatabase(java.lang.String name, java.util.Map<java.lang.String,? extends java.lang.Object> config)Create a default HikariCP-backed database.DefaultDatabase(play.api.db.Database database)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.ConnectiongetConnection()java.sql.ConnectiongetConnection(boolean autocommit)javax.sql.DataSourcegetDataSource()java.lang.StringgetName()java.lang.StringgetUrl()voidshutdown()<A> AwithConnection(boolean autocommit, play.db.ConnectionCallable<A> block)voidwithConnection(boolean autocommit, play.db.ConnectionRunnable block)<A> AwithConnection(play.db.ConnectionCallable<A> block)voidwithConnection(play.db.ConnectionRunnable block)<A> AwithTransaction(play.db.ConnectionCallable<A> block)voidwithTransaction(play.db.ConnectionRunnable block)<A> AwithTransaction(play.db.TransactionIsolationLevel isolationLevel, play.db.ConnectionCallable<A> block)voidwithTransaction(play.db.TransactionIsolationLevel isolationLevel, play.db.ConnectionRunnable block)
-
-
-
Constructor Detail
-
DefaultDatabase
public DefaultDatabase(play.api.db.Database database)
-
DefaultDatabase
public DefaultDatabase(java.lang.String name, com.typesafe.config.Config configuration)Create a default HikariCP-backed database.- Parameters:
name- name for the db's underlying datasourceconfiguration- the database's configuration
-
DefaultDatabase
public DefaultDatabase(java.lang.String name, java.util.Map<java.lang.String,? extends java.lang.Object> config)Create a default HikariCP-backed database.- Parameters:
name- name for the db's underlying datasourceconfig- the db's configuration
-
-
Method Detail
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceplay.db.Database
-
getDataSource
public javax.sql.DataSource getDataSource()
- Specified by:
getDataSourcein interfaceplay.db.Database
-
getUrl
public java.lang.String getUrl()
- Specified by:
getUrlin interfaceplay.db.Database
-
getConnection
public java.sql.Connection getConnection()
- Specified by:
getConnectionin interfaceplay.db.Database
-
getConnection
public java.sql.Connection getConnection(boolean autocommit)
- Specified by:
getConnectionin interfaceplay.db.Database
-
withConnection
public void withConnection(play.db.ConnectionRunnable block)
- Specified by:
withConnectionin interfaceplay.db.Database
-
withConnection
public <A> A withConnection(play.db.ConnectionCallable<A> block)
- Specified by:
withConnectionin interfaceplay.db.Database
-
withConnection
public void withConnection(boolean autocommit, play.db.ConnectionRunnable block)- Specified by:
withConnectionin interfaceplay.db.Database
-
withConnection
public <A> A withConnection(boolean autocommit, play.db.ConnectionCallable<A> block)- Specified by:
withConnectionin interfaceplay.db.Database
-
withTransaction
public void withTransaction(play.db.ConnectionRunnable block)
- Specified by:
withTransactionin interfaceplay.db.Database
-
withTransaction
public void withTransaction(play.db.TransactionIsolationLevel isolationLevel, play.db.ConnectionRunnable block)- Specified by:
withTransactionin interfaceplay.db.Database
-
withTransaction
public <A> A withTransaction(play.db.ConnectionCallable<A> block)
- Specified by:
withTransactionin interfaceplay.db.Database
-
withTransaction
public <A> A withTransaction(play.db.TransactionIsolationLevel isolationLevel, play.db.ConnectionCallable<A> block)- Specified by:
withTransactionin interfaceplay.db.Database
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceplay.db.Database
-
-