play.api.db.slick

DBAction

object DBAction extends CurrentDBAction

Use the DBAction when you want to use the default settings in your controller.

def index = DBAction{ implicit rs =>
Ok(MyStuff.list())
}

By default it uses the database named by default in the configuration in all modes (Prod, Dev) except in test, where it uses test.

It is possible to define a maximum amount queries per request that can be handled at a given point to avoid overloading the application (user gets the error page instead of seeing a slow app).

The maximum amount of per requests is read from: db.<db-name>.maxQueriesPerRequest

If you need to override the default behavior, create a new object with the DefaultDBAction trait.

class AnotherDBAction(myApp: Application, myErrorPage: Result) extends DefaultDBAction {
override lazy val app = myApp
override val errorPage = myErrorPage
}
Source
DBAction.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. DBAction
  2. CurrentDBAction
  3. PredicatedDBAction
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. def app: Application

    Override to use a different app

    Override to use a different app

    Attributes
    protected
    Definition Classes
    CurrentDBAction
  5. def apply[A](dbName: String, bodyParser: BodyParser[A] = anyContent)(requestHandler: (DBSessionRequest[A]) ⇒ Result)(implicit maybeApp: MaybeApplication): Action[A]

    Definition Classes
    CurrentDBAction
  6. def apply[A](bodyParser: BodyParser[A])(requestHandler: (DBSessionRequest[A]) ⇒ Result)(implicit maybeApp: MaybeApplication): Action[A]

    Definition Classes
    PredicatedDBAction
  7. def apply(requestHandler: (DBSessionRequest[AnyContent]) ⇒ Result)(implicit maybeApp: MaybeApplication): Action[AnyContent]

    Definition Classes
    PredicatedDBAction
  8. def apply(resultFunction: ⇒ Result): Action[AnyContent]

    Definition Classes
    PredicatedDBAction
  9. def applyForDB[A](db: Database)(requestHandler: (DBSessionRequest[A]) ⇒ Result)(bodyParser: BodyParser[A])(f: ((Session) ⇒ Result) ⇒ Result)(errorPage: ⇒ Result)(implicit executionContext: ExecutionContext = ...): Action[A]

    Attributes
    protected
    Definition Classes
    PredicatedDBAction
  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. lazy val attributes: Map[String, DBAttributes]

    A Map containing all the information needed to created cached functions that check DB availability

    A Map containing all the information needed to created cached functions that check DB availability

    Definition Classes
    CurrentDBActionPredicatedDBAction
  12. lazy val available: Map[String, () ⇒ Boolean]

    Defines the functions used to check db availability for each db name

    Defines the functions used to check db availability for each db name

    Attributes
    protected
    Definition Classes
    PredicatedDBAction
  13. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def db(name: String, maybeApp: Option[Application]): Database

    Attributes
    protected
    Definition Classes
    CurrentDBActionPredicatedDBAction
  15. lazy val defaultName: String

    The default name used by the apply action that has a default name

    The default name used by the apply action that has a default name

    Definition Classes
    CurrentDBActionPredicatedDBAction
  16. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  18. val errorPage: mvc.Results.Status

    Override to change default error page

    Override to change default error page

    Attributes
    protected
    Definition Classes
    CurrentDBActionPredicatedDBAction
  19. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  21. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  22. def includeFilter(name: String): Boolean

    Used to determine which db name config sections are to be included

    Used to determine which db name config sections are to be included

    Attributes
    protected
    Definition Classes
    CurrentDBAction
  23. def isDBAvailable(name: String): Boolean

    Attributes
    protected
    Definition Classes
    PredicatedDBAction
  24. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  25. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  26. final def notify(): Unit

    Definition Classes
    AnyRef
  27. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  28. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  29. lazy val testName: String

    Used to includeFilter and to determine defaultName

    Used to includeFilter and to determine defaultName

    Attributes
    protected
    Definition Classes
    CurrentDBAction
  30. def toString(): String

    Definition Classes
    AnyRef → Any
  31. def transaction[A](dbName: String, bodyParser: BodyParser[A] = anyContent)(requestHandler: (DBSessionRequest[A]) ⇒ Result)(implicit maybeApp: MaybeApplication): Action[A]

    Definition Classes
    CurrentDBAction
  32. def transaction[A](bodyParser: BodyParser[A])(requestHandler: (DBSessionRequest[A]) ⇒ Result)(implicit maybeApp: MaybeApplication): Action[A]

    Definition Classes
    PredicatedDBAction
  33. def transaction(requestHandler: (DBSessionRequest[AnyContent]) ⇒ Result)(implicit maybeApp: MaybeApplication): Action[AnyContent]

    Definition Classes
    PredicatedDBAction
  34. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from CurrentDBAction

Inherited from PredicatedDBAction

Inherited from AnyRef

Inherited from Any

Ungrouped