Ebean ORM

Persistence for Java & Kotlin

sponsors

Databases supported

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

Multiple abstraction levels

Ebean provides multiple levels of query abstraction.

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

Docker test containers for all the supported databases.

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

Database migrations

Built in DB migration generation and running.

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

Type safe queries

We can build queries using type safe query beans.

IDE auto-complete when writing queries, compile time checking and it's FUN.

Automated query tuning

For ORM queries Ebean can profile the object graph being used and either automatically tune the query.

Awesome SQL

Ebean produces SQL that you would hand craft yourself.

Use great SQL, never generate SQL cartesian product, always honor relational limit/offset.

Performance isn't optional

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

Automatically avoid N+1 via a smart load context.

silver sponsors

MH
Maximilian Holtzberg
SH
Szabolcs Hubai

Search documentation

 

 

About Ebean

JPA Mapping

Ebean uses JPA mapping annotations.

@Entity
@Table(name="customer")
public class Customer extends BaseModel {

  @Column(length=100)
  String name;

  @ManyToOne(cascade=CascadeType.ALL)
  Address billingAddress;

  @OneToMany(mappedBy="customer")
  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");
customer.save();

...

// find and update ...
Customer customer = Customer.find.byId(42);
customer.setName("Montana");
customer.save();

Type safe queries

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

List<Customer> customers =

  new QCustomer()
    .name.istartsWith("rob")
    .billingAddress.city.equalTo("Auckland")
    .setMaxRows(10)
    .orderBy()
      .name.asc()
    .findList();

more details on queries

Testimonials:

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.