Ebean provides multiple query options from ORM Queries to using a bit of SQL in our ORM query and all the way to using straight SQL queries with beans and direct use of JDBC.

As developers we want to stay at the highest level of abstraction that we can (ORM queries) but as needs occur we can drop down to using bits of SQL with our ORM query and then down further to using full SQL as needed.

ORM queries
  • Pure ORM queries, all SQL is generated
  • Some SQL in the select or where clause
  • Using SQL aka findNative
DTO queries
  • Using SQL that we provide with non-entity beans - "dto beans"
  • Using SQL with a row mapper or SqlRow's - not DTO or Entity beans
  • SqlQuery using SqlRow
  • SqlQuery using RowMappers
JDBC queries
  • Straight use of JDBC
  • Very rarely do we need to use raw JDBC