Ebean ORM

Persistence for Java & Kotlin


Databases supported

H2, Postgres, PostGIS, MySql, MariaDB, SQL Server, Oracle, Hana, CockroachDB, Clickhouse, Sqlite.

Multiple abstraction levels

Ebean provides multiple levels of abstraction from ORM, mixing ORM and SQL, to using SQL and right down to raw JDBC.

Work at the highest level of abstraction and drop down levels as needed.

Benefits of ORM

  • Automatically avoid N+1
  • L2 caching to reduce database load
  • Queries mixing database and L2 cache
  • Automatically tune ORM queries
  • Elasticsearch for search or L3 cache.

Docker test containers

ebean-test provides docker test container management for all the supported databases. We love H2 but testing against the real thing takes us to the next level (well, testing against a docker container version of the real thing).

Get 100% test coverage on all the features of the database we use.

Awesome SQL

Ebean produces SQL that you would hand craft yourself.

Use great SQL, be nice to your database and it will be nice to you.

No matter how complex the ORM query Ebean produces great SQL. Ebean will never generate SQL cartesian product (it will automatically split an ORM query into multiple sql queries) and will always honor relational limit/offset (because the database loves optimising the query plan for that).

Performance isn't optional

Optimise queries to only fetch what we need (partial objects).

Automatically avoid N+1 via a smart load context. Developers don't need to worry about this.

Use bulk update and delete queries when appropriate. Persisting with JDBC batch is easy with all the control we need over batch size, getGeneratedKeys, cascade and flush behaviour.

Automated query tuning

For ORM queries Ebean can profile the object graph being used and either automatically tune the query (autotune) or provide code change suggestions.

Developers can focus on the query predicates and then use this to tune the queries in a fully automatic or semi-automatic fashion.

Database migrations

Get Ebean to generate our database migrations. This will "diff" the model and generate the appropriate migration DDL for the database platform (or multiple platforms).

Built in migration runner to run our database migrations.

Support for "rebase" migrations as well as repeatable, init and 'normal' migrations.

Type safe queries

We can build queries using type safe query beans. We do this because we can be more productive via IDE auto-complete when writing queries, we get compile time checking of queries and because it's FUN !!

silver sponsors

Maximilian Holtzberg
Szabolcs Hubai

Search documentation



About Ebean

JPA Mapping

Ebean uses JPA mapping annotations.

public class Customer extends BaseModel {

  String name;

  Address billingAddress;

  List<Contact> contacts;

Simple to use

Ebean provides a simple programming model that developers can understand and master quickly.

// insert ...
Customer customer = new Customer("Joe");


// find and update ...
Customer customer = Customer.find.byId(42);

Type safe queries

We can use Query beans to build queries in a type safe manner.

List<Customer> customers =

  new QCustomer()

more details on queries


After struggling with what I'd call surprising behavior of a JPA implementation, I discovered Ebean. Time and time again I found that Ebean simply works the way I expect it to. Love it!

Daryl Stultz
OpenTempo, Inc.