Package play.db

Interface DBComponents

  • All Superinterfaces:
    play.components.ConfigurationComponents, ConnectionPoolComponents

    public interface DBComponents
    extends play.components.ConfigurationComponents, ConnectionPoolComponents
    Java DB components. You can mix in HikariCPComponents to have a default implementation for accessing a connection pool.

    For example:

     public class MyComponents extends BuiltInComponentsFromContext implements DBComponents, HikariCPComponents {
    
          public MyComponents(ApplicationLoader.Context context) {
              super(context);
          }
    
          // required methods implementations
     }
     
    See Also:
    ConnectionPoolComponents
    • Method Detail

      • environment

        play.Environment environment()
      • applicationLifecycle

        play.inject.ApplicationLifecycle applicationLifecycle()
      • databases

        default java.util.List<play.db.Database> databases()
        Returns:
        all databases associated with the dbApi().
        See Also:
        DBApi.getDatabases()
      • database

        default play.db.Database database​(java.lang.String name)
        Parameters:
        name - the database name
        Returns:
        the database with the given name, associated with the dbApi().
        See Also:
        DBApi.getDatabase(String)
      • dbApi

        default play.db.DBApi dbApi()