Package play.db

Class DefaultDatabase

  • All Implemented Interfaces:
    play.db.Database

    public class DefaultDatabase
    extends java.lang.Object
    implements play.db.Database
    Default 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.Connection getConnection()  
      java.sql.Connection getConnection​(boolean autocommit)  
      javax.sql.DataSource getDataSource()  
      java.lang.String getName()  
      java.lang.String getUrl()  
      void shutdown()  
      <A> A withConnection​(boolean autocommit, play.db.ConnectionCallable<A> block)  
      void withConnection​(boolean autocommit, play.db.ConnectionRunnable block)  
      <A> A withConnection​(play.db.ConnectionCallable<A> block)  
      void withConnection​(play.db.ConnectionRunnable block)  
      <A> A withTransaction​(play.db.ConnectionCallable<A> block)  
      void withTransaction​(play.db.ConnectionRunnable block)  
      <A> A withTransaction​(play.db.TransactionIsolationLevel isolationLevel, play.db.ConnectionCallable<A> block)  
      void withTransaction​(play.db.TransactionIsolationLevel isolationLevel, play.db.ConnectionRunnable block)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface play.db.Database

        asScala
    • 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 datasource
        configuration - 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 datasource
        config - the db's configuration
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface play.db.Database
      • getDataSource

        public javax.sql.DataSource getDataSource()
        Specified by:
        getDataSource in interface play.db.Database
      • getUrl

        public java.lang.String getUrl()
        Specified by:
        getUrl in interface play.db.Database
      • getConnection

        public java.sql.Connection getConnection()
        Specified by:
        getConnection in interface play.db.Database
      • getConnection

        public java.sql.Connection getConnection​(boolean autocommit)
        Specified by:
        getConnection in interface play.db.Database
      • withConnection

        public void withConnection​(play.db.ConnectionRunnable block)
        Specified by:
        withConnection in interface play.db.Database
      • withConnection

        public <A> A withConnection​(play.db.ConnectionCallable<A> block)
        Specified by:
        withConnection in interface play.db.Database
      • withConnection

        public void withConnection​(boolean autocommit,
                                   play.db.ConnectionRunnable block)
        Specified by:
        withConnection in interface play.db.Database
      • withConnection

        public <A> A withConnection​(boolean autocommit,
                                    play.db.ConnectionCallable<A> block)
        Specified by:
        withConnection in interface play.db.Database
      • withTransaction

        public void withTransaction​(play.db.ConnectionRunnable block)
        Specified by:
        withTransaction in interface play.db.Database
      • withTransaction

        public void withTransaction​(play.db.TransactionIsolationLevel isolationLevel,
                                    play.db.ConnectionRunnable block)
        Specified by:
        withTransaction in interface play.db.Database
      • withTransaction

        public <A> A withTransaction​(play.db.ConnectionCallable<A> block)
        Specified by:
        withTransaction in interface play.db.Database
      • withTransaction

        public <A> A withTransaction​(play.db.TransactionIsolationLevel isolationLevel,
                                     play.db.ConnectionCallable<A> block)
        Specified by:
        withTransaction in interface play.db.Database
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface play.db.Database