Search documentation

Ebean ORM

Persistence for Java & Kotlin

premium sponsors

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
AMAH
Al-Mothafar Al-Hasan
SL
Sando Leinzinger

 

About Ebean

@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;
  ...
// insert ...
Customer customer = new Customer("Joe");
customer.save();

...

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

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