Documentation / Mapping
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.
Ebean uses a Naming convention API. This is relatively important as it typically it
means we only need to specify a
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").
Ebean assumes database Id generation is preferred and automatically maps to either
Enum mapping in JPA is poor. Ebean provides 2 better alternatives in the form of
|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||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).|