JPA mapping
Ebean mapping


Unlike JPA Ebean does NOT require a default constructor. You are free to create entity beans that have a constructor with arguments.


Unlike Hibernate the recommendation with Ebean is to use List rather than Set for mapping collections.

Naming convention

Ebean uses a Naming convention API. This is relatively important as it typically it means we only need to specify a @Column name when the naming convention is not followed.

Similarly we tend to not require explicit use of @JoinColumn or @JoinTable as long as the naming convention is followed (which defaults to "underscore naming convention").

JPA Notes

Ebean uses the same mapping as per the JPA specification. You can learn and use the same mapping annotations. This is generally a good part of the specification and I'd expect this part of the specification to mostly stand the test of time.

There are some aspects where JPA is generally insufficient.

Enum Enum mapping in JPA is poor. Ebean provides 2 better alternatives in the form of @DbEnumValue and @EnumValue. We are monitoring the progress of this issue in the JPA JIRA issue tracker.
FetchType EAGER / LAZY

JPA mapping encourages the use of FetchType.EAGER and LAZY which is contrary to Ebean's query approach which instead looks to optimise the queries per use case (and provides automatic query tuning by profiling the application).

The use of EAGER LAZY mapping annotations is generally not useful when using Ebean.

@Size and @NotNull

Ebean supports the use of javax validation annotations @Size and @NotNull.

@Size Defines the mapped column width. For example, @Size(50) is equivalent to @Column(length=50)
@NotNull Define the mapped column as non null. Equivalent to @Column(nullable = false) or @ManyToOne(optional=false).

Current limitations

There are a number of JPA mappings that Ebean does not currently support but would like to in time. These are logged as enhancement requests.

116 Only single table inheritance is supported. This enhancement request is to add support for JOINED or TABLE PER CLASS inheritance strategies.
52 No support for @ManyToOne in @Embeddable beans.

You can review the entire list of outstanding issue and enhancements in the Github Issues