-
Notifications
You must be signed in to change notification settings - Fork 29
/
index.html
193 lines (176 loc) · 6.55 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<html>
<head>
<title>Mapping | Ebean</title>
<meta name="layout" content="_layout2/base-mapping.html"/>
</head>
<body>
<h5>Types</h5>
<p style="font-size: 0.83rem;font-weight: bold;">
<a href="/docs/mapping/type/">All types</a>,
<a href="/docs/mapping/type/enum">Enum</a>,
<a href="/docs/mapping/type/uuid">UUID</a>,
<a href="/docs/mapping/type/file">File</a>,
<a href="/docs/mapping/type/boolean">Boolean</a>,
<a href="/docs/mapping/type/time">Date and Time</a>,
<a href="/docs/mapping/type/numeric">Numeric</a>,
<a href="/docs/mapping/type/">Other</a>
</p>
<h5>JPA mapping</h5>
<div class="grid g3">
<div>
<h5><a href="/docs/mapping/jpa/id">@Id</a></h5>
<h5><a href="/docs/mapping/jpa/version">@Version</a></h5>
<h5><a href="/docs/mapping/jpa/mapped-superclass">@MappedSuperclass</a></h5>
</div>
<div>
<h5><a href="/docs/mapping/jpa/one-to-many">@OneToMany</a></h5>
<h5><a href="/docs/mapping/jpa/many-to-one">@ManyToOne</a></h5>
<h5><a href="/docs/mapping/jpa/one-to-one">@OneToOne</a></h5>
<h5><a href="/docs/mapping/jpa/many-to-many">@ManyToMany</a></h5>
</div>
<div>
<h5><a href="/docs/mapping/jpa/lob">@Lob</a></h5>
</div>
</div>
<h5>Ebean mapping extenions</h5>
<div class="grid g3">
<div>
<h5><a href="/docs/mapping/extensions/dbindex">@Index</a></h5>
<h5><a href="/docs/mapping/extensions/dbjson">@DbJson</a></h5>
<h5><a href="/docs/mapping/extensions/dbarray">@DbArray</a></h5>
<h5><a href="/docs/mapping/extensions/dbmap">@DbMap</a></h5>
<h5><a href="/docs/mapping/extensions/dbforeignkey">@DbForeignKey</a></h5>
<h5><a href="/docs/mapping/extensions/dbcomment">@DbComment</a></h5>
<h5><a href="/docs/mapping/extensions/dbpartition">@DbPartition</a></h5>
</div>
<div>
<h5><a href="/docs/mapping/extensions/when-created">@WhenCreated</a></h5>
<h5><a href="/docs/mapping/extensions/when-modified">@WhenModified</a></h5>
<h5><a href="/docs/mapping/extensions/who-created">@WhoCreated</a></h5>
<h5><a href="/docs/mapping/extensions/who-modified">@WhoModified</a></h5>
</div>
<div>
<h5><a href="/docs/mapping/extensions/view">@View</a></h5>
<h5><a href="/docs/mapping/extensions/soft-delete">@SoftDelete</a></h5>
<h5><a href="/docs/mapping/extensions/encrypted">@Encrypted</a></h5>
<h5><a href="/docs/mapping/extensions/read-audit">@ReadAudit</a></h5>
<h5><a href="/docs/mapping/extensions/history">@History</a></h5>
<h5><a href="/docs/mapping/extensions/formula">@Formula</a></h5>
<h5><a href="/docs/mapping/extensions/change-log">@ChangeLog</a></h5>
</div>
</div>
<h2 id="constructors"><a href="constructors">Constructors</a></h2>
<p>
Unlike JPA Ebean does <b>NOT</b> require a default constructor. You are free to create
entity beans that have a constructor with arguments.
</p>
<h2 id="naming-convention"><a href="naming-convention">Naming convention</a></h2>
<p>
Ebean uses a Naming convention API. This is relatively important as it typically
means we only need to specify a <code>@Column name</code> when the naming convention
is not followed.
</p>
<p>
Similarly we tend to not require explicit use of <code>@JoinColumn</code> or
<code>@JoinTable</code> as long as the naming convention
is followed (which defaults to "underscore naming convention").
</p>
<h2 id="collections"><a href="collections">Collections</a></h2>
<p>
Unlike Hibernate the recommendation with Ebean is to use <code>List</code> rather than <code>Set</code>
for mapping collections.
</p>
<h2 id="jpa-notes">JPA Notes</h2>
<p>
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.
</p>
<p>
There are some aspects where JPA is generally insufficient.
</p>
<table class="table">
<tr>
<th width="25%">Enum</th>
<td>
Enum mapping in JPA is poor. Ebean provides 2 better alternatives in the form of <code>@DbEnumValue</code>
and <code>@EnumValue</code>. We are monitoring the progress of this issue in the JPA JIRA issue tracker.
</td>
</tr>
<tr>
<th>FetchType EAGER / LAZY</th>
<td>
<p>
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).
</p>
<p>
The use of EAGER LAZY mapping annotations is generally not useful when using Ebean.
</p>
</td>
</tr>
</table>
<h2 id="validation-annotations">@Size and @NotNull</h2>
<p>
Ebean supports the use of <code>javax validation</code> annotations <code>@Size</code> and <code>@NotNull</code>.
</p>
<table class="table">
<tr>
<th width="25%">@Size</th>
<td>
Defines the mapped column width. For example, @Size(50) is equivalent to @Column(length=50)
</td>
</tr>
<tr>
<th>@NotNull</th>
<td>
Define the mapped column as non null. Equivalent to @Column(nullable = false) or @ManyToOne(optional=false).
</td>
</tr>
</table>
<h2 id="limitations">Current limitations</h2>
<p>
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.
</p>
<table class="table">
<tr>
<td><a href="https://github.com/ebean-orm/ebean/issues/116">116</a></td>
<td>
<p>
Only single table inheritance is supported.
</p>
<p>
There is no planned support
for JOINED or TABLE PER CLASS inheritance strategies.
</p>
</td>
</tr>
<tr>
<td><a href="https://github.com/ebean-orm/ebean/issues/1777">1777</a></td>
<td>
<p>
Only a single type converter per type is supported.
</p>
<p>
JPA @Converter autoApply false is not honoured. This means that we expect
a type to be mapped consistently for all properties that it is used.
For example, we can't have two Converters mapping Boolean two different ways
in the same Ebean database instance.
</p>
</td>
</tr>
</table>
<p>
You can review the entire list of outstanding issue and enhancements in the
<a href="https://github.com/ebean-orm/ebean/issues">Github Issues</a>
</p>
<p>
Refer to github issues marked with the
<a href="https://github.com/ebean-orm/ebean/issues?q=is%3Aissue+is%3Aclosed+label%3ALimitation">Limitation</a>
tag.
</p>
<@next_edit "Naming convention" "naming-convention" "/docs/mapping/index.html"/>
</body>
</html>