Ebean ORM for Java/Kotlin

Fast and simple data access on the JVM - $Donate


Ebean has an taken a different architectural when compared with JPA and JDO and this has important implications. Specifically Ebean does not use a 'Persistence Context' or 'Session' when it persists objects back to the database. This means you don't need to attach/detach your beans or manage a JPA EntityManager or JDO PersistenceManager.

Persisting a bean means you just call save(). Cascade persistence is supported by traversing the relationships on the bean.


Videos to show you various features of Ebean and options for testing.

Partial Objects and N + 1

A high performance ORM needs good support for partial objects (only fetching the properties needed) and optimising object graph construction to mitigate N + 1.

Ebean's query design provides a clean separation between what properties and paths to fetch and the rest of the query (predicates, orderBy, paging) and this makes it easy for developers to optimise object graph construction and also allows Ebean to automatically tune queries using profiling.

Interesting Features

  • Raw SQL: Using raw sql is easy and the bean returned are fully featured with the expected lazy loading and persisting support because sometimes you need full control
  • Paging results: Use findCount() or findPagedList() to make handling paged results easy.
  • Large Query Support: Use findIterate() to process lots of objects without having them all in memory. Typically for batch processing requirements.
  • Batch inserting: Ability to tune batch inserting with per-transaction control over JDBC batch size and the ability to turn off getGeneratedKeys and Cascade persist.
  • DB Encryption: Use DB encryption transparently with @Encrypt.
  • JSON support: Built in JSON support. Marshalling/unmarshalling is fully aware of circular relationships, inheritance, partial objects and all data types.
  • Automatic Query Tuning: Has 'Autofetch' automatic query tuning support. Queries can be automatically optimised based on profiling the object graph use.
  • Stateless Updates: Populate a bean object graph and then update() it without querying it from the DB. This is useful to support REST.
  • Bulk Updates/Deletes: Use bulk update statements as you desire because sometimes a more 'relational' approach is vastly more efficient - Ebean is happy with that and the L2 cache will invalidate the appropriate cache regions where necessary.