mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Compare commits
480
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca6e3963db | ||
|
|
a966557b68 | ||
|
|
1a6a426683 | ||
|
|
dd43fe4db3 | ||
|
|
b4ebeb0070 | ||
|
|
0dbf982293 | ||
|
|
12d7184f02 | ||
|
|
c3295f1145 | ||
|
|
9bdcd6c55e | ||
|
|
b627794f8f | ||
|
|
b9f3ff24e9 | ||
|
|
9752eced1f | ||
|
|
e7aa1fdac5 | ||
|
|
9d26ab2103 | ||
|
|
103f965182 | ||
|
|
d28d9a6176 | ||
|
|
173b81a64b | ||
|
|
135b1e3b57 | ||
|
|
888109d706 | ||
|
|
8cd6d50def | ||
|
|
272b316ecc | ||
|
|
e95edad04b | ||
|
|
d934d44164 | ||
|
|
a2ad1aaf6e | ||
|
|
a0b6a13e6c | ||
|
|
a65340b939 | ||
|
|
0279f8b1ad | ||
|
|
bd2faed6a0 | ||
|
|
a0e2155ec2 | ||
|
|
5ff9171aaf | ||
|
|
4d7936c1a6 | ||
|
|
552145db37 | ||
|
|
0504cdc2d8 | ||
|
|
a380b609cd | ||
|
|
65ac083872 | ||
|
|
a82dca24da | ||
|
|
466a616f3e | ||
|
|
a0552387f8 | ||
|
|
25bc0e947d | ||
|
|
f8253a1252 | ||
|
|
2581d82cff | ||
|
|
331ea90e14 | ||
|
|
dfb1d6ab54 | ||
|
|
067f4bfdea | ||
|
|
0a71ad624e | ||
|
|
09115a824d | ||
|
|
28d4d07966 | ||
|
|
c3e91fed65 | ||
|
|
2cad98ad26 | ||
|
|
8a25a7b6ec | ||
|
|
83fbfd1b2a | ||
|
|
a9c6cd15a1 | ||
|
|
63b9b42dc8 | ||
|
|
268146df85 | ||
|
|
d05a77e755 | ||
|
|
69c768b3be | ||
|
|
07f9bf98c3 | ||
|
|
9af64f61f7 | ||
|
|
c1a78d3c8b | ||
|
|
08fc7399ec | ||
|
|
86d805c9fa | ||
|
|
34135360ed | ||
|
|
53b4d6fd73 | ||
|
|
1114ccfb3a | ||
|
|
b4403c58d1 | ||
|
|
951903db76 | ||
|
|
093d111524 | ||
|
|
08e166a9b7 | ||
|
|
d5fe7a9ebe | ||
|
|
9f52856343 | ||
|
|
0b529603c4 | ||
|
|
60d0a3da39 | ||
|
|
1c224444c0 | ||
|
|
d3e07defa0 | ||
|
|
1b5d379ed3 | ||
|
|
b90393a691 | ||
|
|
2d26740286 | ||
|
|
5807874c9e | ||
|
|
ea7b4e8162 | ||
|
|
43742fdc0b | ||
|
|
8ef71bd451 | ||
|
|
0f60e2240c | ||
|
|
2cbb161ed5 | ||
|
|
a47caec85b | ||
|
|
fd1b5f58bc | ||
|
|
39a4035f3b | ||
|
|
0bb7d79015 | ||
|
|
9907cffe6e | ||
|
|
704a138ff0 | ||
|
|
f3cab4ee10 | ||
|
|
d507452d63 | ||
|
|
893aa6cb1a | ||
|
|
e92fd2ef06 | ||
|
|
bdad8b258a | ||
|
|
a6cdf8d6dc | ||
|
|
e232c724c0 | ||
|
|
d55023dbc7 | ||
|
|
fa4e013692 | ||
|
|
08502d7315 | ||
|
|
6f4bc0ac2c | ||
|
|
5585866e82 | ||
|
|
f21f6d9592 | ||
|
|
03e0519951 | ||
|
|
bc23d5829c | ||
|
|
64108aac40 | ||
|
|
fcda419abb | ||
|
|
4d34c9e868 | ||
|
|
5178b76431 | ||
|
|
8fb02662e6 | ||
|
|
1aac63771d | ||
|
|
3a138c3462 | ||
|
|
30088f4de7 | ||
|
|
cc272bb950 | ||
|
|
b3ee982b64 | ||
|
|
92a13ad265 | ||
|
|
a445557ec3 | ||
|
|
c7bb027c7d | ||
|
|
709eb369c9 | ||
|
|
5a4924b6cb | ||
|
|
a61c73c62a | ||
|
|
7862648b83 | ||
|
|
fa252a1fe4 | ||
|
|
add7a8c4ba | ||
|
|
834c04bd33 | ||
|
|
9bda4ab5c7 | ||
|
|
d1ca7a30dc | ||
|
|
cb67dd0f29 | ||
|
|
e173f6e9a9 | ||
|
|
349cd01921 | ||
|
|
8fa7fa6af3 | ||
|
|
caf18565a0 | ||
|
|
c89d39ec2d | ||
|
|
556557276c | ||
|
|
2f277938e5 | ||
|
|
5322ab3e7e | ||
|
|
100832ddd9 | ||
|
|
3f5009aa91 | ||
|
|
8dbd290119 | ||
|
|
ea3fb833a4 | ||
|
|
0273e1c2c8 | ||
|
|
8440a13b0f | ||
|
|
c5e940733c | ||
|
|
ac73031bec | ||
|
|
a65ff8a650 | ||
|
|
f904fea104 | ||
|
|
2549eace09 | ||
|
|
a592717c77 | ||
|
|
db6f93e383 | ||
|
|
0a0d67585c | ||
|
|
db2f8cd811 | ||
|
|
b6e524f879 | ||
|
|
40492f487c | ||
|
|
2cee03bc4b | ||
|
|
e2c6125501 | ||
|
|
b53221fc0e | ||
|
|
b23551ce43 | ||
|
|
3971ccea1a | ||
|
|
35b1f835c5 | ||
|
|
ef5e3a796d | ||
|
|
d3dbde4e79 | ||
|
|
033c579984 | ||
|
|
1a34a56351 | ||
|
|
edfdbd56b1 | ||
|
|
8f94072afd | ||
|
|
d028b200fa | ||
|
|
9af006b15b | ||
|
|
35a6ff7f02 | ||
|
|
cebac8040f | ||
|
|
e8524c5b1a | ||
|
|
3244314424 | ||
|
|
0a4c26965c | ||
|
|
6238243c91 | ||
|
|
c1d7e77d85 | ||
|
|
5b07309f51 | ||
|
|
8ee67410f9 | ||
|
|
dec114028f | ||
|
|
477e7eeeda | ||
|
|
c9c61d9f97 | ||
|
|
d0909ad140 | ||
|
|
13c94ac78d | ||
|
|
f467ca2e10 | ||
|
|
d5c24d327e | ||
|
|
23cd45b5d1 | ||
|
|
a14f7a1766 | ||
|
|
c86a8c2d32 | ||
|
|
e85a471fcf | ||
|
|
57689db291 | ||
|
|
fec87b5281 | ||
|
|
21bd83b417 | ||
|
|
fde5350c43 | ||
|
|
769f6b72ae | ||
|
|
97e9b3c473 | ||
|
|
3550bf61c4 | ||
|
|
0bf8c9eb64 | ||
|
|
01e7ddcffd | ||
|
|
b450227b13 | ||
|
|
d7554cefc7 | ||
|
|
a7a056f041 | ||
|
|
ad0befe90a | ||
|
|
59763777f3 | ||
|
|
1bf9cfde50 | ||
|
|
f51f2269fb | ||
|
|
b38a21f8c4 | ||
|
|
bf62efd220 | ||
|
|
fc54ade8f6 | ||
|
|
aa5ba76707 | ||
|
|
3865fc8ffd | ||
|
|
b262c2e19d | ||
|
|
cf95372f32 | ||
|
|
41bbfb0c9c | ||
|
|
8129376b2a | ||
|
|
d016f479e2 | ||
|
|
aea50b4805 | ||
|
|
864ae2ad9b | ||
|
|
861fc813a7 | ||
|
|
f3b66c555a | ||
|
|
04ab161421 | ||
|
|
7226bb0ea3 | ||
|
|
55bfd56574 | ||
|
|
853a6a5c1d | ||
|
|
0206921eae | ||
|
|
f3dbf216d2 | ||
|
|
38139850de | ||
|
|
37b3ea9e5a | ||
|
|
4064be731f | ||
|
|
beec6b4b13 | ||
|
|
6db44a05fe | ||
|
|
45e235cb64 | ||
|
|
512ba24041 | ||
|
|
1fbfcd393f | ||
|
|
5805c3e995 | ||
|
|
c89255ec72 | ||
|
|
a582db9101 | ||
|
|
12fe54da24 | ||
|
|
a4eeda6449 | ||
|
|
1fecbbb618 | ||
|
|
c363023c80 | ||
|
|
0cfae9a13b | ||
|
|
88f75bc62f | ||
|
|
fece3bb0df | ||
|
|
268a39ae15 | ||
|
|
9324d1cebe | ||
|
|
2733608a72 | ||
|
|
e29e032693 | ||
|
|
9fc2ec044d | ||
|
|
b739326fca | ||
|
|
88fd4f5569 | ||
|
|
4cca3bfa98 | ||
|
|
8f8d031d91 | ||
|
|
7a327cb644 | ||
|
|
1696caadd4 | ||
|
|
e5dceda4b9 | ||
|
|
eab56d323b | ||
|
|
0b00a14fd3 | ||
|
|
c1d57c6b10 | ||
|
|
1049435f86 | ||
|
|
cee879d2f3 | ||
|
|
93ff2ef2e4 | ||
|
|
d389ac680f | ||
|
|
d582e63c25 | ||
|
|
cb9295658c | ||
|
|
dbc1ab7a57 | ||
|
|
bb9532f42e | ||
|
|
632f04c76b | ||
|
|
bc02eeac57 | ||
|
|
d6dc147497 | ||
|
|
a15e1ae0a7 | ||
|
|
8b98335e2e | ||
|
|
01e07dd2be | ||
|
|
3ac8d6e1d3 | ||
|
|
66143280fa | ||
|
|
e95442d8ec | ||
|
|
aafde53b81 | ||
|
|
0887480865 | ||
|
|
4ff8df9538 | ||
|
|
ddb63c1488 | ||
|
|
aab2dff49c | ||
|
|
d017b2ef39 | ||
|
|
70a967a3a7 | ||
|
|
796edae614 | ||
|
|
50bb7086ac | ||
|
|
af8cf9c6c7 | ||
|
|
6227b081cf | ||
|
|
42645f7236 | ||
|
|
eae8bbac82 | ||
|
|
43451c5342 | ||
|
|
a6f27ca19f | ||
|
|
a7462e86c8 | ||
|
|
0ddcfec70d | ||
|
|
bf70470b9a | ||
|
|
23c5bd65cf | ||
|
|
30aa05a243 | ||
|
|
4ce70e401d | ||
|
|
a2f49a544c | ||
|
|
4d4065c54b | ||
|
|
d072dd52cf | ||
|
|
25b9b37ac0 | ||
|
|
5ea5b55882 | ||
|
|
b69c00b01e | ||
|
|
aa53742a07 | ||
|
|
7c2a77081b | ||
|
|
57c0bceb63 | ||
|
|
8cb43788dc | ||
|
|
921ee9f8a1 | ||
|
|
058e16d1a8 | ||
|
|
a5f9beabdf | ||
|
|
0ed6ccf499 | ||
|
|
fe67abce83 | ||
|
|
7fba9adc43 | ||
|
|
4557bdfa6f | ||
|
|
7a7dbae313 | ||
|
|
12c5e9ea5d | ||
|
|
239a444d4c | ||
|
|
f770b66f42 | ||
|
|
6311d0bf4e | ||
|
|
491d6a5461 | ||
|
|
b142319da0 | ||
|
|
ac21fcb5cf | ||
|
|
455914fb52 | ||
|
|
2419c6ab34 | ||
|
|
8a0403ef6b | ||
|
|
e0afeea6c4 | ||
|
|
dd8b4f6416 | ||
|
|
97482c3372 | ||
|
|
d2e36fc1d2 | ||
|
|
99acd6d64f | ||
|
|
6fe6b8ba64 | ||
|
|
c2b947d2e6 | ||
|
|
7d6b25ff59 | ||
|
|
d9cef737e3 | ||
|
|
2f18e97a44 | ||
|
|
bf3c1629f7 | ||
|
|
1062adede4 | ||
|
|
47c9a434bb | ||
|
|
b2bfca7ec6 | ||
|
|
5d84f10110 | ||
|
|
847ce5db88 | ||
|
|
afdfbd6173 | ||
|
|
c0007d3c1a | ||
|
|
aa27aedca9 | ||
|
|
172c1d10a1 | ||
|
|
da6f7d671b | ||
|
|
7a13670594 | ||
|
|
6e10d641b2 | ||
|
|
c5dca69482 | ||
|
|
371a50176e | ||
|
|
35bff7c3e7 | ||
|
|
83f8435000 | ||
|
|
a1b4b1d8ca | ||
|
|
fad3e634d5 | ||
|
|
62712c976f | ||
|
|
56fed3ad87 | ||
|
|
9a65731be9 | ||
|
|
34b011f683 | ||
|
|
69c721b66e | ||
|
|
f2a578cd76 | ||
|
|
1e34d65675 | ||
|
|
60db0b0999 | ||
|
|
3bfb6dbc20 | ||
|
|
d4d9bb204d | ||
|
|
bedb841fa9 | ||
|
|
c4c4663144 | ||
|
|
b392db866c | ||
|
|
3556f9a42b | ||
|
|
0345ca9f18 | ||
|
|
eacc4b907d | ||
|
|
09cb5da3d3 | ||
|
|
b22791c15b | ||
|
|
df3eda411a | ||
|
|
5b10c053de | ||
|
|
bf2d75e55e | ||
|
|
6f7efe6922 | ||
|
|
90e321ddbd | ||
|
|
9649d71082 | ||
|
|
932337d83d | ||
|
|
7e4bde8d34 | ||
|
|
01e8b5f471 | ||
|
|
68a6da22be | ||
|
|
986f3b5bca | ||
|
|
4b1bb9d1ee | ||
|
|
ec340c0abe | ||
|
|
b062ec050c | ||
|
|
965f4c6227 | ||
|
|
bdc4022211 | ||
|
|
7edfe3607d | ||
|
|
e1731b87ec | ||
|
|
ebadc92f63 | ||
|
|
ea56ec7435 | ||
|
|
3b990fb6e1 | ||
|
|
96b4fbea4b | ||
|
|
9161e17476 | ||
|
|
190a2c47e9 | ||
|
|
d096706685 | ||
|
|
7521cb530e | ||
|
|
dde9b507ce | ||
|
|
183416a640 | ||
|
|
826e8518ea | ||
|
|
55587b12aa | ||
|
|
285a94e5fe | ||
|
|
16a05528b7 | ||
|
|
b4f4ef3c1b | ||
|
|
cd407ee467 | ||
|
|
9ee63144e5 | ||
|
|
0413d89a9e | ||
|
|
f33e54d8ba | ||
|
|
a2b19d46e1 | ||
|
|
4163b4dc25 | ||
|
|
12220d4322 | ||
|
|
14262d4c25 | ||
|
|
f3ec4a78c9 | ||
|
|
f7a0ae8b4a | ||
|
|
3c6d17c9a5 | ||
|
|
885ba0fdd2 | ||
|
|
f3b0e34b67 | ||
|
|
4109fab0d8 | ||
|
|
0688061f5c | ||
|
|
82c12b1565 | ||
|
|
ebc0fabbdb | ||
|
|
587b2e3075 | ||
|
|
ec82dd3da9 | ||
|
|
3e190b34f5 | ||
|
|
e059ad9172 | ||
|
|
1297324fa9 | ||
|
|
e2b7434d98 | ||
|
|
ada8df5755 | ||
|
|
843b90cbba | ||
|
|
6b263919d5 | ||
|
|
965c1e803f | ||
|
|
9aa2fc824a | ||
|
|
a13bc481b8 | ||
|
|
fc7379aabc | ||
|
|
531024b8b4 | ||
|
|
a17683c549 | ||
|
|
eeacad0fb9 | ||
|
|
c51140b59a | ||
|
|
f1817a0dbb | ||
|
|
5b05510bb9 | ||
|
|
b676476cd2 | ||
|
|
709f8ed05f | ||
|
|
31282416d8 | ||
|
|
385c84ae6f | ||
|
|
2d24020202 | ||
|
|
1a2aba3f56 | ||
|
|
f50f0192d1 | ||
|
|
12b8b4b955 | ||
|
|
c267366578 | ||
|
|
18e49cc1ce | ||
|
|
1ce4b1a994 | ||
|
|
f3c87e488a | ||
|
|
f24c698cd5 | ||
|
|
144a3b54bb | ||
|
|
ec7c7048db | ||
|
|
fd2e542c0b | ||
|
|
11e8e3696f | ||
|
|
d08f7af1e0 | ||
|
|
60dfaab22c | ||
|
|
75fa7cb7fd | ||
|
|
e47b1737a8 | ||
|
|
e1ad210bb0 | ||
|
|
ac3edbedf4 | ||
|
|
2dc48cf08d | ||
|
|
ede1ad0a4c | ||
|
|
3e8f76cd6d | ||
|
|
cd6df2be39 | ||
|
|
7091e972fc | ||
|
|
c8ae3c5ef6 | ||
|
|
54e8c4df8a | ||
|
|
e18c190905 | ||
|
|
181dc73d39 | ||
|
|
7ed2de9178 | ||
|
|
8c101fd0a4 | ||
|
|
43213ead05 | ||
|
|
0ef5c65c94 | ||
|
|
c610f95b2d | ||
|
|
c4484c758e | ||
|
|
4cebb367de | ||
|
|
60ef87b269 | ||
|
|
7e265f7bde | ||
|
|
bd7499a505 | ||
|
|
40a4546ac6 |
@@ -1,9 +1,3 @@
|
||||
|
||||
GITHUB ISSUES ARE STRICTLY CONTROLLED FOR THIS PROJECT.
|
||||
|
||||
Refer to http://ebean-orm.github.io/support for the policies controlling the use of github issues.
|
||||
Please post issues to the Ebean group https://groups.google.com/forum/#!forum/ebean first.
|
||||
|
||||
## Expected behavior
|
||||
|
||||
## Actual behavior
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
name: Build
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [8]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'zulu'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: Build with Maven
|
||||
run: mvn package
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
name: JDK 18-ea
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# schedule:
|
||||
# - cron: '30 6 * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [18-ea]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'zulu'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: Build with Maven
|
||||
run: mvn package
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
name: MariaDB 10.6
|
||||
|
||||
on: [workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [11]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: mariadb 10.6
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-mariadb.properties
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
name: Multi-JDK Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '30 6 * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [8.0.192, 8, 11.0.3, 11, 17]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'zulu'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: Build with Maven
|
||||
run: mvn package
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
name: Multi-database platform test
|
||||
|
||||
on: [workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [11]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: h2
|
||||
run: mvn clean test
|
||||
- name: postgres
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-postgres.properties
|
||||
- name: mysql
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-mysql.properties
|
||||
- name: sqlserver 2019
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver19.properties
|
||||
- name: sqlserver 2017
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver17.properties
|
||||
- name: mariadb
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-mariadb.properties
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
name: MySql
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '20 6 * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [11]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: mysql
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-mysql.properties
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
name: Postgres
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '10 6 * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [11]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: postgres
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-postgres.properties
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
name: SqlServer 2017 latest
|
||||
|
||||
on: [workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [11]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
# - name: sqlserver 2019 latest
|
||||
# run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver.properties
|
||||
- name: sqlserver 2017 latest
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver17.properties
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
name: SqlServer 2019 latest
|
||||
|
||||
on: [workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [11]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: sqlserver 2019 latest
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver19.properties
|
||||
+1
-1
@@ -34,7 +34,7 @@ env:
|
||||
install: true
|
||||
|
||||
script:
|
||||
- mvn clean test
|
||||
- mvn -T 1C clean test
|
||||
|
||||
after_failure:
|
||||
- ./.travis/print_surefire_reports
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
[](https://travis-ci.org/ebean-orm/ebean)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/build.yml)
|
||||
[](https://maven-badges.herokuapp.com/maven-central/io.ebean/ebean)
|
||||
[](https://github.com/ebean-orm/ebean/blob/master/LICENSE)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/multi-jdk-build.yml)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/jdk-18-ea.yml)
|
||||
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/postgres.yml)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/mysql.yml)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/mariadb-10.6.yml)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/sqlserver-2017-latest.yml)
|
||||
|
||||
# Sponsors
|
||||
<table>
|
||||
@@ -36,7 +44,7 @@ Post questions or issues to the Ebean google group - https://groups.google.com/f
|
||||
Goto [https://ebean.io/docs/](https://ebean.io/docs/)
|
||||
|
||||
|
||||
## Maven cental links:
|
||||
## Maven central links:
|
||||
[Maven central - ebean](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.ebean%22%20AND%20a%3A%22ebean%22 "maven central ebean")
|
||||
|
||||
[Maven central - all related projects](http://search.maven.org/#search%7Cga%7C1%7Cebean "maven central all related projects")
|
||||
|
||||
+20
-14
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.0</version>
|
||||
<version>12.13.2</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
@@ -27,7 +27,7 @@
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-config</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
@@ -36,27 +36,26 @@
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-jsr305</artifactId>
|
||||
<artifactId>avaje-lang</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>persistence-api</artifactId>
|
||||
<version>2.2.4</version>
|
||||
<version>2.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-annotation</artifactId>
|
||||
<version>7.2</version>
|
||||
<version>7.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-types</artifactId>
|
||||
<version>2.1</version>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -104,21 +103,28 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
<tiles>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.13.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
<description>ebean api</description>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--
|
||||
Projects are expected to explicit depend on version
|
||||
of slf4j that they want to use
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-config</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
Class retention Nonnull and Nullable annotations
|
||||
to assist with IDE auto-completion with Ebean API
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-lang</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>persistence-api</artifactId>
|
||||
<version>2.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-annotation</artifactId>
|
||||
<version>7.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-types</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource-api</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackson core used internally by Ebean -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- provided scope for JsonNode support -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Provided scope so that the H2HistoryTrigger can live in Ebean core
|
||||
and not require a separate module for it -->
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.199</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>jta</artifactId>
|
||||
<version>1.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.avaje.lang.NonNullApi;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -18,6 +20,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* This also propagates MDC context from the current thread to the
|
||||
* background task if defined.
|
||||
*/
|
||||
@NonNullApi
|
||||
public interface BackgroundExecutor {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -27,10 +27,10 @@ import java.util.Optional;
|
||||
* @param <I> The ID type
|
||||
* @param <T> The Bean type
|
||||
*/
|
||||
@NonNullApi
|
||||
public abstract class BeanFinder<I,T> {
|
||||
|
||||
protected final Database server;
|
||||
|
||||
protected final Class<T> type;
|
||||
|
||||
/**
|
||||
@@ -79,11 +79,10 @@ public abstract class BeanFinder<I,T> {
|
||||
/**
|
||||
* Creates an entity reference for this ID.
|
||||
* <p>
|
||||
* Equivalent to {@link Database#getReference(Class, Object)}
|
||||
* Equivalent to {@link Database#reference(Class, Object)}
|
||||
*/
|
||||
@Nonnull
|
||||
public T ref(I id) {
|
||||
return db().getReference(type, id);
|
||||
return db().reference(type, id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +96,6 @@ public abstract class BeanFinder<I,T> {
|
||||
/**
|
||||
* Find an entity by ID returning an Optional.
|
||||
*/
|
||||
@Nullable
|
||||
public Optional<T> findByIdOrEmpty(I id) {
|
||||
return db().find(type).setId(id).findOneOrEmpty();
|
||||
}
|
||||
@@ -112,7 +110,6 @@ public abstract class BeanFinder<I,T> {
|
||||
/**
|
||||
* Retrieves all entities of the given type.
|
||||
*/
|
||||
@Nonnull
|
||||
public List<T> findAll() {
|
||||
return query().findList();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.ebean.bean.EntityBean;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -31,6 +32,7 @@ import java.util.Collection;
|
||||
* @param <I> The ID type
|
||||
* @param <T> The Bean type
|
||||
*/
|
||||
@NonNullApi
|
||||
public abstract class BeanRepository<I, T> extends BeanFinder<I, T> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.ebean;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -57,7 +56,7 @@ public interface BeanState {
|
||||
*
|
||||
* // set loaded state on the email property to false so that
|
||||
* // the email property is not included in a stateless update
|
||||
* DB.getBeanState(user).setPropertyLoaded("email", false);
|
||||
* DB.beanState(user).setPropertyLoaded("email", false);
|
||||
*
|
||||
* user.update();
|
||||
*
|
||||
@@ -72,25 +71,47 @@ public interface BeanState {
|
||||
* bean.
|
||||
* <p>
|
||||
* Accessing another property will cause lazy loading to occur.
|
||||
* </p>
|
||||
*/
|
||||
Set<String> getLoadedProps();
|
||||
Set<String> loadedProps();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to loadedProps().
|
||||
*/
|
||||
@Deprecated
|
||||
default Set<String> getLoadedProps() {
|
||||
return loadedProps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the set of changed properties.
|
||||
*/
|
||||
Set<String> getChangedProps();
|
||||
Set<String> changedProps();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to changedProps().
|
||||
*/
|
||||
@Deprecated
|
||||
default Set<String> getChangedProps() {
|
||||
return changedProps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of the updated properties and their new and old values.
|
||||
*/
|
||||
Map<String, ValuePair> getDirtyValues();
|
||||
Map<String, ValuePair> dirtyValues();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to dirtyValues().
|
||||
*/
|
||||
@Deprecated
|
||||
default Map<String, ValuePair> getDirtyValues() {
|
||||
return dirtyValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the bean is readOnly.
|
||||
* <p>
|
||||
* If a setter is called on a readOnly bean it will throw an exception.
|
||||
* </p>
|
||||
*/
|
||||
boolean isReadOnly();
|
||||
|
||||
@@ -114,8 +135,28 @@ public interface BeanState {
|
||||
void resetForInsert();
|
||||
|
||||
/**
|
||||
* Returns a map with load erros.
|
||||
* Returns a map with load errors.
|
||||
*/
|
||||
@Nullable
|
||||
Map<String, Exception> getLoadErrors();
|
||||
Map<String, Exception> loadErrors();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to loadErrors().
|
||||
*/
|
||||
@Deprecated
|
||||
default Map<String, Exception> getLoadErrors() {
|
||||
return loadErrors();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the sort order value for an order column.
|
||||
*/
|
||||
int sortOrder();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to sortOrder().
|
||||
*/
|
||||
@Deprecated
|
||||
default int getSortOrder() {
|
||||
return sortOrder();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.annotation.TxIsolation;
|
||||
import io.ebean.cache.ServerCacheManager;
|
||||
import io.ebean.plugin.Property;
|
||||
import io.ebean.text.csv.CsvReader;
|
||||
import io.ebean.text.json.JsonContext;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.util.Collection;
|
||||
@@ -60,6 +60,7 @@ import java.util.concurrent.Callable;
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@NonNullApi
|
||||
public final class DB {
|
||||
|
||||
private static final DbContext context = DbContext.getInstance();
|
||||
@@ -126,8 +127,16 @@ public final class DB {
|
||||
* an expression that uses OR like Expression e = Expr.or(..., ...);
|
||||
* </p>
|
||||
*/
|
||||
public static ExpressionFactory expressionFactory() {
|
||||
return getDefault().expressionFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to expressionFactory().
|
||||
*/
|
||||
@Deprecated
|
||||
public static ExpressionFactory getExpressionFactory() {
|
||||
return getDefault().getExpressionFactory();
|
||||
return expressionFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -515,15 +524,13 @@ public final class DB {
|
||||
* @param bean The entity bean to check uniqueness on
|
||||
* @return a set of Properties if constraint validation was detected or empty list.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Set<Property> checkUniqueness(Object bean) {
|
||||
return getDefault().checkUniqueness(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as {@link #checkUniqueness(Object)}. but with given transaction.
|
||||
* Same as {@link #checkUniqueness(Object)} but with given transaction.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Set<Property> checkUniqueness(Object bean, Transaction transaction) {
|
||||
return getDefault().checkUniqueness(bean, transaction);
|
||||
}
|
||||
@@ -650,8 +657,16 @@ public final class DB {
|
||||
* @param beanType the type of entity bean
|
||||
* @param id the id value
|
||||
*/
|
||||
public static <T> T reference(Class<T> beanType, Object id) {
|
||||
return getDefault().reference(beanType, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanId().
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> T getReference(Class<T> beanType, Object id) {
|
||||
return getDefault().getReference(beanType, id);
|
||||
return reference(beanType, id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -660,14 +675,12 @@ public final class DB {
|
||||
* <ul>
|
||||
* <li>asc - ascending order (which is the default)</li>
|
||||
* <li>desc - Descending order</li>
|
||||
* <li>nullsHigh - Treat null values as high/large values (which is the
|
||||
* default)</li>
|
||||
* <li>nullsHigh - Treat null values as high/large values (which is the default)</li>
|
||||
* <li>nullsLow- Treat null values as low/very small values</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* If you leave off any keywords the defaults are ascending order and treating
|
||||
* nulls as high values.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note that the sorting uses a Comparator and Collections.sort(); and does
|
||||
* not invoke a DB query.
|
||||
@@ -837,7 +850,6 @@ public final class DB {
|
||||
* }</pre>
|
||||
*/
|
||||
public static <T> Update<T> createUpdate(Class<T> beanType, String ormUpdate) {
|
||||
|
||||
return getDefault().createUpdate(beanType, ormUpdate);
|
||||
}
|
||||
|
||||
@@ -845,7 +857,6 @@ public final class DB {
|
||||
* Create a CsvReader for a given beanType.
|
||||
*/
|
||||
public static <T> CsvReader<T> createCsvReader(Class<T> beanType) {
|
||||
|
||||
return getDefault().createCsvReader(beanType);
|
||||
}
|
||||
|
||||
@@ -883,7 +894,6 @@ public final class DB {
|
||||
* @return A ORM Query for this beanType
|
||||
*/
|
||||
public static <T> Query<T> createQuery(Class<T> beanType) {
|
||||
|
||||
return getDefault().createQuery(beanType);
|
||||
}
|
||||
|
||||
@@ -921,7 +931,6 @@ public final class DB {
|
||||
* @return The query with expressions defined as per the parsed query statement
|
||||
*/
|
||||
public static <T> Query<T> createQuery(Class<T> beanType, String eql) {
|
||||
|
||||
return getDefault().createQuery(beanType, eql);
|
||||
}
|
||||
|
||||
@@ -937,7 +946,6 @@ public final class DB {
|
||||
* @return A ORM Query object for this beanType
|
||||
*/
|
||||
public static <T> Query<T> find(Class<T> beanType) {
|
||||
|
||||
return getDefault().find(beanType);
|
||||
}
|
||||
|
||||
@@ -1016,77 +1024,6 @@ public final class DB {
|
||||
return getDefault().filter(beanType);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Execute a Sql Update Delete or Insert statement. This returns the number of
|
||||
// * rows that where updated, deleted or inserted. If is executed in batch then
|
||||
// * this returns -1. You can get the actual rowCount after commit() from
|
||||
// * updateSql.getRowCount().
|
||||
// * <p>
|
||||
// * If you wish to execute a Sql Select natively then you should use the
|
||||
// * FindByNativeSql object.
|
||||
// * </p>
|
||||
// * <p>
|
||||
// * Note that the table modification information is automatically deduced and
|
||||
// * you do not need to call the DB.externalModification() method when you
|
||||
// * use this method.
|
||||
// * </p>
|
||||
// * <p>
|
||||
// * Example:
|
||||
// * </p>
|
||||
// * <pre>{@code
|
||||
// *
|
||||
// * // example that uses 'named' parameters
|
||||
// * String s = "UPDATE f_topic set post_count = :count where id = :id"
|
||||
// *
|
||||
// * SqlUpdate update = DB.createSqlUpdate(s);
|
||||
// *
|
||||
// * update.setParameter("id", 1);
|
||||
// * update.setParameter("count", 50);
|
||||
// *
|
||||
// * int modifiedCount = DB.execute(update);
|
||||
// *
|
||||
// * String msg = "There where " + modifiedCount + "rows updated";
|
||||
// *
|
||||
// * }</pre>
|
||||
// *
|
||||
// * @param sqlUpdate the update sql potentially with bind values
|
||||
// * @return the number of rows updated or deleted. -1 if executed in batch.
|
||||
// * @see SqlUpdate
|
||||
// * @see CallableSql
|
||||
// * @see DB#execute(CallableSql)
|
||||
// */
|
||||
// public static int execute(SqlUpdate sqlUpdate) {
|
||||
// return defaultDatabase().execute(sqlUpdate);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * For making calls to stored procedures.
|
||||
// * <p>
|
||||
// * Example:
|
||||
// * </p>
|
||||
// * <pre>{@code
|
||||
// *
|
||||
// * String sql = "{call sp_order_modify(?,?,?)}";
|
||||
// *
|
||||
// * CallableSql cs = DB.createCallableSql(sql);
|
||||
// * cs.setParameter(1, 27);
|
||||
// * cs.setParameter(2, "SHIPPED");
|
||||
// * cs.registerOut(3, Types.INTEGER);
|
||||
// *
|
||||
// * DB.execute(cs);
|
||||
// *
|
||||
// * // read the out parameter
|
||||
// * Integer returnValue = (Integer) cs.getObject(3);
|
||||
// *
|
||||
// * }</pre>
|
||||
// *
|
||||
// * @see CallableSql
|
||||
// * @see Ebean#execute(SqlUpdate)
|
||||
// */
|
||||
// public static int execute(CallableSql callableSql) {
|
||||
// return defaultDatabase().execute(callableSql);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Execute a TxRunnable in a Transaction with an explicit scope.
|
||||
* <p>
|
||||
@@ -1231,30 +1168,77 @@ public final class DB {
|
||||
* This will return null if the bean is not an enhanced entity bean.
|
||||
* </p>
|
||||
*/
|
||||
public static BeanState beanState(Object bean) {
|
||||
return getDefault().beanState(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanState().
|
||||
*/
|
||||
@Deprecated
|
||||
public static BeanState getBeanState(Object bean) {
|
||||
return getDefault().getBeanState(bean);
|
||||
return beanState(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the Id property for a given bean.
|
||||
*/
|
||||
public static Object beanId(Object bean) {
|
||||
return getDefault().beanId(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanId().
|
||||
*/
|
||||
@Deprecated
|
||||
public static Object getBeanId(Object bean) {
|
||||
return getDefault().getBeanId(bean);
|
||||
return beanId(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and lock the bean using {@code select for update}.
|
||||
* <p>
|
||||
* This should be executed inside a transaction.
|
||||
* <p>
|
||||
* The bean needs to have an ID property set and can be a reference bean (only has ID)
|
||||
* or partially or fully populated bean. This will load all the properties of the bean
|
||||
* from the database using {@code select for update}.
|
||||
*
|
||||
* @param bean The entity bean that we wish to obtain a database lock on.
|
||||
*/
|
||||
public static void lock(Object bean) {
|
||||
getDefault().lock(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to cacheManager().
|
||||
*/
|
||||
@Deprecated
|
||||
public static ServerCacheManager getServerCacheManager() {
|
||||
return getDefault().cacheManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the manager of the level 2 cache ("L2" cache).
|
||||
*/
|
||||
public static ServerCacheManager getServerCacheManager() {
|
||||
return getDefault().getServerCacheManager();
|
||||
public static ServerCacheManager cacheManager() {
|
||||
return getDefault().cacheManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BackgroundExecutor service for asynchronous processing of
|
||||
* queries.
|
||||
*/
|
||||
public static BackgroundExecutor backgroundExecutor() {
|
||||
return getDefault().backgroundExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to backgroundExecutor().
|
||||
*/
|
||||
@Deprecated
|
||||
public static BackgroundExecutor getBackgroundExecutor() {
|
||||
return getDefault().getBackgroundExecutor();
|
||||
return backgroundExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.annotation.TxIsolation;
|
||||
import io.ebean.cache.ServerCacheManager;
|
||||
@@ -10,8 +12,6 @@ import io.ebean.plugin.SpiServer;
|
||||
import io.ebean.text.csv.CsvReader;
|
||||
import io.ebean.text.json.JsonContext;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
@@ -92,6 +92,7 @@ import java.util.concurrent.Callable;
|
||||
* @see DatabaseFactory
|
||||
* @see DatabaseConfig
|
||||
*/
|
||||
@NonNullApi
|
||||
public interface Database {
|
||||
|
||||
/**
|
||||
@@ -120,34 +121,82 @@ public interface Database {
|
||||
/**
|
||||
* Return AutoTune which is used to control the AutoTune service at runtime.
|
||||
*/
|
||||
AutoTune getAutoTune();
|
||||
AutoTune autoTune();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to autoTune().
|
||||
*/
|
||||
@Deprecated
|
||||
default AutoTune getAutoTune() {
|
||||
return autoTune();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the associated DataSource for this Database instance.
|
||||
*/
|
||||
DataSource getDataSource();
|
||||
DataSource dataSource();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to dataSource().
|
||||
*/
|
||||
@Deprecated
|
||||
default DataSource getDataSource() {
|
||||
return dataSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the associated read only DataSource for this Database instance (can be null).
|
||||
*/
|
||||
DataSource getReadOnlyDataSource();
|
||||
DataSource readOnlyDataSource();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to readOnlyDataSource().
|
||||
*/
|
||||
@Deprecated
|
||||
default DataSource getReadOnlyDataSource() {
|
||||
return readOnlyDataSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name. This is used with {@link DB#byName(String)} to get a
|
||||
* Database that was registered with the DB singleton.
|
||||
*/
|
||||
String getName();
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to name().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ExpressionFactory for this database.
|
||||
*/
|
||||
ExpressionFactory getExpressionFactory();
|
||||
ExpressionFactory expressionFactory();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to expressionFactory().
|
||||
*/
|
||||
@Deprecated
|
||||
default ExpressionFactory getExpressionFactory() {
|
||||
return expressionFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the MetaInfoManager which is used to get meta data from the Database
|
||||
* such as query execution statistics.
|
||||
*/
|
||||
MetaInfoManager getMetaInfoManager();
|
||||
MetaInfoManager metaInfo();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to metaInfo().
|
||||
*/
|
||||
@Deprecated
|
||||
default MetaInfoManager getMetaInfoManager() {
|
||||
return metaInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the platform used for this database instance.
|
||||
@@ -166,12 +215,28 @@ public interface Database {
|
||||
*
|
||||
* @return platform for this database instance
|
||||
*/
|
||||
Platform getPlatform();
|
||||
Platform platform();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to platform().
|
||||
*/
|
||||
@Deprecated
|
||||
default Platform getPlatform() {
|
||||
return platform();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the extended API intended for use by plugins.
|
||||
*/
|
||||
SpiServer getPluginApi();
|
||||
SpiServer pluginApi();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to pluginApi().
|
||||
*/
|
||||
@Deprecated
|
||||
default SpiServer getPluginApi() {
|
||||
return pluginApi();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BeanState for a given entity bean.
|
||||
@@ -179,12 +244,28 @@ public interface Database {
|
||||
* This will return null if the bean is not an enhanced entity bean.
|
||||
* </p>
|
||||
*/
|
||||
BeanState getBeanState(Object bean);
|
||||
BeanState beanState(Object bean);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanState().
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanState getBeanState(Object bean) {
|
||||
return beanState(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the Id property for a given bean.
|
||||
*/
|
||||
Object getBeanId(Object bean);
|
||||
Object beanId(Object bean);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanId().
|
||||
*/
|
||||
@Deprecated
|
||||
default Object getBeanId(Object bean) {
|
||||
return beanId(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Id value onto the bean converting the type of the id value if necessary.
|
||||
@@ -196,7 +277,15 @@ public interface Database {
|
||||
* @param bean The entity bean to set the id value on.
|
||||
* @param id The id value to set.
|
||||
*/
|
||||
Object setBeanId(Object bean, Object id);
|
||||
Object beanId(Object bean, Object id);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanId().
|
||||
*/
|
||||
@Deprecated
|
||||
default Object setBeanId(Object bean, Object id) {
|
||||
return beanId(bean, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of the differences between two objects of the same type.
|
||||
@@ -487,8 +576,8 @@ public interface Database {
|
||||
<T> DtoQuery<T> createNamedDtoQuery(Class<T> dtoType, String namedQuery);
|
||||
|
||||
/**
|
||||
* Look to execute a native sql query that does not returns beans but instead
|
||||
* returns SqlRow or direct access to ResultSet (see {@link SqlQuery#findList(RowMapper)}.
|
||||
* Look to execute a native sql query that does not return beans but instead
|
||||
* returns SqlRow or direct access to ResultSet.
|
||||
*
|
||||
* <p>
|
||||
* Refer to {@link DtoQuery} for native sql queries returning DTO beans.
|
||||
@@ -861,8 +950,15 @@ public interface Database {
|
||||
* @param beanType the type of entity bean
|
||||
* @param id the id value
|
||||
*/
|
||||
@Nonnull
|
||||
<T> T getReference(Class<T> beanType, Object id);
|
||||
<T> T reference(Class<T> beanType, Object id);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to reference().
|
||||
*/
|
||||
@Deprecated
|
||||
default <T> T getReference(Class<T> beanType, Object id) {
|
||||
return reference(beanType, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the extended API for Database.
|
||||
@@ -1140,6 +1236,7 @@ public interface Database {
|
||||
* @param id the bean id value
|
||||
* @param transaction the transaction to use (can be null)
|
||||
*/
|
||||
@Nullable
|
||||
<T> T find(Class<T> beanType, Object id, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -1198,13 +1295,11 @@ public interface Database {
|
||||
* @param bean The entity bean to check uniqueness on
|
||||
* @return a set of Properties if constraint validation was detected or empty list.
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Property> checkUniqueness(Object bean);
|
||||
|
||||
/**
|
||||
* Same as {@link #checkUniqueness(Object)}. but with given transaction.
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Property> checkUniqueness(Object bean, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -1431,13 +1526,29 @@ public interface Database {
|
||||
/**
|
||||
* Return the manager of the server cache ("L2" cache).
|
||||
*/
|
||||
ServerCacheManager getServerCacheManager();
|
||||
ServerCacheManager cacheManager();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to cacheManager().
|
||||
*/
|
||||
@Deprecated
|
||||
default ServerCacheManager getServerCacheManager() {
|
||||
return cacheManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BackgroundExecutor service for asynchronous processing of
|
||||
* queries.
|
||||
*/
|
||||
BackgroundExecutor getBackgroundExecutor();
|
||||
BackgroundExecutor backgroundExecutor();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to backgroundExecutor().
|
||||
*/
|
||||
@Deprecated
|
||||
default BackgroundExecutor getBackgroundExecutor() {
|
||||
return backgroundExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the JsonContext for reading/writing JSON.
|
||||
@@ -1502,6 +1613,7 @@ public interface Database {
|
||||
* @param id the id of the entity bean
|
||||
* @param transaction the transaction the publish process should use (can be null)
|
||||
*/
|
||||
@Nullable
|
||||
<T> T publish(Class<T> beanType, Object id, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -1515,6 +1627,7 @@ public interface Database {
|
||||
* @param beanType the type of the entity bean
|
||||
* @param id the id of the entity bean
|
||||
*/
|
||||
@Nullable
|
||||
<T> T publish(Class<T> beanType, Object id);
|
||||
|
||||
/**
|
||||
@@ -1553,6 +1666,7 @@ public interface Database {
|
||||
* @param id the id of the entity bean to restore
|
||||
* @param transaction the transaction the restore process should use (can be null)
|
||||
*/
|
||||
@Nullable
|
||||
<T> T draftRestore(Class<T> beanType, Object id, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -1566,6 +1680,7 @@ public interface Database {
|
||||
* @param beanType the type of the entity bean
|
||||
* @param id the id of the entity bean to restore
|
||||
*/
|
||||
@Nullable
|
||||
<T> T draftRestore(Class<T> beanType, Object id);
|
||||
|
||||
/**
|
||||
@@ -1602,6 +1717,20 @@ public interface Database {
|
||||
*/
|
||||
<T> Set<String> validateQuery(Query<T> query);
|
||||
|
||||
/**
|
||||
* Load and lock the bean using {@code select for update}.
|
||||
* <p>
|
||||
* This should be executed inside a transaction and results in the bean being loaded or
|
||||
* refreshed from the database and a database row lock held via {@code select for update}.
|
||||
* <p>
|
||||
* The bean needs to have an ID property set and can be a reference bean (only has ID)
|
||||
* or partially or fully populated bean. This will load all the properties of the bean
|
||||
* from the database using {@code select for update} obtaining a database row lock (using WAIT).
|
||||
*
|
||||
* @param bean The entity bean that we wish to obtain a database lock on.
|
||||
*/
|
||||
void lock(Object bean);
|
||||
|
||||
/**
|
||||
* Truncate all the given tables.
|
||||
*/
|
||||
|
||||
@@ -16,18 +16,15 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
* <p>
|
||||
* This uses either DatabaseConfig or properties in the application.properties file to
|
||||
* configure and create a Database instance.
|
||||
* </p>
|
||||
* <p>
|
||||
* The Database instance can either be registered with the DB singleton or
|
||||
* not. The DB singleton effectively holds a map of Database by a name.
|
||||
* If the Database is registered with the DB singleton you can retrieve it
|
||||
* later via {@link DB#byName(String)}.
|
||||
* </p>
|
||||
* <p>
|
||||
* One Database can be nominated as the 'default/primary' Database. Many
|
||||
* methods on the DB singleton such as {@link DB#find(Class)} are just a
|
||||
* convenient way of using the 'default/primary' Database.
|
||||
* </p>
|
||||
*/
|
||||
public class DatabaseFactory {
|
||||
|
||||
@@ -48,7 +45,7 @@ public class DatabaseFactory {
|
||||
public static void initialiseContainer(ContainerConfig containerConfig) {
|
||||
lock.lock();
|
||||
try {
|
||||
getContainer(containerConfig);
|
||||
container(containerConfig);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@@ -60,7 +57,7 @@ public class DatabaseFactory {
|
||||
public static Database create(String name) {
|
||||
lock.lock();
|
||||
try {
|
||||
return getContainer(null).createServer(name);
|
||||
return container(null).createServer(name);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
@@ -68,6 +65,16 @@ public class DatabaseFactory {
|
||||
|
||||
/**
|
||||
* Create using the DatabaseConfig object to configure the database.
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* DatabaseConfig config = new DatabaseConfig();
|
||||
* config.setName("db");
|
||||
* config.loadProperties();
|
||||
*
|
||||
* Database database = DatabaseFactory.create(config);
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
public static Database create(DatabaseConfig config) {
|
||||
lock.lock();
|
||||
@@ -115,7 +122,6 @@ public class DatabaseFactory {
|
||||
* Shutdown gracefully all Database instances cleaning up any resources as required.
|
||||
* <p>
|
||||
* This is typically invoked via JVM shutdown hook and not explicitly called.
|
||||
* </p>
|
||||
*/
|
||||
public static void shutdown() {
|
||||
lock.lock();
|
||||
@@ -127,15 +133,15 @@ public class DatabaseFactory {
|
||||
}
|
||||
|
||||
private static Database createInternal(DatabaseConfig config) {
|
||||
return getContainer(config.getContainerConfig()).createServer(config);
|
||||
return container(config.getContainerConfig()).createServer(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the EbeanContainer initialising it if necessary.
|
||||
* Return the SpiContainer initialising it if necessary.
|
||||
*
|
||||
* @param containerConfig the configuration controlling clustering communication
|
||||
*/
|
||||
private static SpiContainer getContainer(ContainerConfig containerConfig) {
|
||||
private static SpiContainer container(ContainerConfig containerConfig) {
|
||||
// thread safe in that all calling methods hold lock
|
||||
if (container != null) {
|
||||
return container;
|
||||
|
||||
@@ -15,8 +15,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
final class DbContext {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DbContext.class);
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
static {
|
||||
EbeanVersion.getVersion();
|
||||
}
|
||||
@@ -39,7 +38,6 @@ final class DbContext {
|
||||
if (!DbPrimary.isSkip()) {
|
||||
// look to see if there is a default server defined
|
||||
String defaultName = DbPrimary.getDefaultServerName();
|
||||
logger.debug("defaultName:{}", defaultName);
|
||||
if (defaultName != null && !defaultName.trim().isEmpty()) {
|
||||
defaultDatabase = getWithCreate(defaultName.trim());
|
||||
}
|
||||
@@ -54,7 +52,7 @@ final class DbContext {
|
||||
throw new DataSourceConfigurationException(msg, e);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error trying to create the default Database", e);
|
||||
log.error("Error trying to create the default Database", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
@@ -115,7 +113,7 @@ final class DbContext {
|
||||
* Register a server so we can get it by its name.
|
||||
*/
|
||||
void register(Database server, boolean isDefault) {
|
||||
registerWithName(server.getName(), server, isDefault);
|
||||
registerWithName(server.name(), server, isDefault);
|
||||
}
|
||||
|
||||
private void registerWithName(String name, Database server, boolean isDefault) {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.docstore.DocQueryContext;
|
||||
import io.ebean.docstore.RawDoc;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -13,6 +14,7 @@ import java.util.function.Predicate;
|
||||
/**
|
||||
* Document storage operations.
|
||||
*/
|
||||
@NonNullApi
|
||||
public interface DocumentStore {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package io.ebean;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
@@ -38,12 +40,12 @@ import java.util.stream.Stream;
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@NonNullApi
|
||||
public interface DtoQuery<T> extends CancelableQuery {
|
||||
|
||||
/**
|
||||
* Execute the query returning a list.
|
||||
*/
|
||||
@Nonnull
|
||||
List<T> findList();
|
||||
|
||||
/**
|
||||
@@ -53,7 +55,6 @@ public interface DtoQuery<T> extends CancelableQuery {
|
||||
* resultSet and potentially connection and MUST be closed. We should use
|
||||
* QueryIterator in a <em>try with resource block</em>.
|
||||
*/
|
||||
@Nonnull
|
||||
QueryIterator<T> findIterate();
|
||||
|
||||
/**
|
||||
@@ -63,7 +64,6 @@ public interface DtoQuery<T> extends CancelableQuery {
|
||||
* resultSet and potentially connection and MUST be closed. We should use
|
||||
* the Stream in a <em>try with resource block</em>.
|
||||
*/
|
||||
@Nonnull
|
||||
Stream<T> findStream();
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,6 @@ public interface DtoQuery<T> extends CancelableQuery {
|
||||
/**
|
||||
* Execute the query returning an optional bean.
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<T> findOneOrEmpty();
|
||||
|
||||
/**
|
||||
@@ -130,6 +129,13 @@ public interface DtoQuery<T> extends CancelableQuery {
|
||||
*/
|
||||
DtoQuery<T> setParameter(String name, Object value);
|
||||
|
||||
/**
|
||||
* Bind the named multi-value array parameter which we would use with Postgres ANY.
|
||||
* <p>
|
||||
* For Postgres this binds an ARRAY rather than expands into multiple bind values.
|
||||
*/
|
||||
DtoQuery<T> setArrayParameter(String name, Collection<?> values);
|
||||
|
||||
/**
|
||||
* Bind the parameter by its index position (1 based like JDBC).
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.annotation.TxIsolation;
|
||||
import io.ebean.cache.ServerCacheManager;
|
||||
import io.ebean.plugin.Property;
|
||||
import io.ebean.text.csv.CsvReader;
|
||||
import io.ebean.text.json.JsonContext;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.util.Collection;
|
||||
@@ -103,7 +102,7 @@ public final class Ebean {
|
||||
* </p>
|
||||
*/
|
||||
public static ExpressionFactory getExpressionFactory() {
|
||||
return getDefault().getExpressionFactory();
|
||||
return getDefault().expressionFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -506,7 +505,6 @@ public final class Ebean {
|
||||
* @param bean The entity bean to check uniqueness on
|
||||
* @return a set of Properties if constraint validation was detected or empty list.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Set<Property> checkUniqueness(Object bean) {
|
||||
return getDefault().checkUniqueness(bean);
|
||||
}
|
||||
@@ -514,7 +512,6 @@ public final class Ebean {
|
||||
/**
|
||||
* Same as {@link #checkUniqueness(Object)}. but with given transaction.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Set<Property> checkUniqueness(Object bean, Transaction transaction) {
|
||||
return getDefault().checkUniqueness(bean, transaction);
|
||||
}
|
||||
@@ -642,7 +639,7 @@ public final class Ebean {
|
||||
* @param id the id value
|
||||
*/
|
||||
public static <T> T getReference(Class<T> beanType, Object id) {
|
||||
return getDefault().getReference(beanType, id);
|
||||
return getDefault().reference(beanType, id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1201,14 +1198,14 @@ public final class Ebean {
|
||||
* </p>
|
||||
*/
|
||||
public static BeanState getBeanState(Object bean) {
|
||||
return getDefault().getBeanState(bean);
|
||||
return getDefault().beanState(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the manager of the server cache ("L2" cache).
|
||||
*/
|
||||
public static ServerCacheManager getServerCacheManager() {
|
||||
return getDefault().getServerCacheManager();
|
||||
return getDefault().cacheManager();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1216,7 +1213,7 @@ public final class Ebean {
|
||||
* queries.
|
||||
*/
|
||||
public static BackgroundExecutor getBackgroundExecutor() {
|
||||
return getDefault().getBackgroundExecutor();
|
||||
return getDefault().backgroundExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,26 +14,75 @@ import java.util.Properties;
|
||||
*/
|
||||
public class EbeanVersion {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EbeanVersion.class);
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
|
||||
/**
|
||||
* Maintain the minimum ebean-agent version manually based on required ebean-agent bug fixes.
|
||||
*/
|
||||
private static final int MIN_AGENT_MAJOR_VERSION = 12;
|
||||
private static final int MIN_AGENT_MINOR_VERSION = 12;
|
||||
private static String version = "unknown";
|
||||
|
||||
static {
|
||||
readVersion();
|
||||
checkAgentVersion();
|
||||
}
|
||||
|
||||
private static void readVersion() {
|
||||
try {
|
||||
Properties prop = new Properties();
|
||||
try (InputStream in = DB.class.getResourceAsStream("/META-INF/maven/io.ebean/ebean/pom.properties")) {
|
||||
try (InputStream in = ClassLoader.getSystemResourceAsStream("META-INF/maven/io.ebean/ebean-api/pom.properties")) {
|
||||
if (in != null) {
|
||||
prop.load(in);
|
||||
in.close();
|
||||
version = prop.getProperty("version");
|
||||
version = readVersion(in);
|
||||
}
|
||||
}
|
||||
logger.info("ebean version: {}", version);
|
||||
log.info("ebean version: {}", version);
|
||||
} catch (IOException e) {
|
||||
logger.warn("Could not determine ebean version: {}", e.getMessage());
|
||||
log.warn("Could not determine ebean version: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkAgentVersion() {
|
||||
try {
|
||||
try (InputStream in = ClassLoader.getSystemResourceAsStream("META-INF/maven/io.ebean/ebean-agent/pom.properties")) {
|
||||
// often we only have ebean-agent during development (with build time enhancement), null is expected
|
||||
if (in != null) {
|
||||
String agentVersion = readVersion(in);
|
||||
if (agentVersion != null) {
|
||||
if (checkMinAgentVersion(agentVersion)) {
|
||||
log.error("Expected minimum ebean-agent version {}.{}.0 but we have {}, please update the ebean-agent", MIN_AGENT_MAJOR_VERSION, MIN_AGENT_MINOR_VERSION, agentVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.warn("Could not check minimum ebean-agent version {}.{}.0 required due to - {}", MIN_AGENT_MAJOR_VERSION, MIN_AGENT_MINOR_VERSION, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if ebean-agent is NOT at our minimum version.
|
||||
*/
|
||||
static boolean checkMinAgentVersion(String agentVersion) {
|
||||
String[] versionSegments = agentVersion.split("\\.");
|
||||
if (versionSegments.length != 3) {
|
||||
return true;
|
||||
} else {
|
||||
int major = Integer.parseInt(versionSegments[0]);
|
||||
int minor = Integer.parseInt(versionSegments[1]);
|
||||
if (major < MIN_AGENT_MAJOR_VERSION) {
|
||||
return true;
|
||||
} else {
|
||||
return major == MIN_AGENT_MAJOR_VERSION && minor < MIN_AGENT_MINOR_VERSION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String readVersion(InputStream in) throws IOException {
|
||||
Properties prop = new Properties();
|
||||
prop.load(in);
|
||||
in.close();
|
||||
return prop.getProperty("version");
|
||||
}
|
||||
|
||||
private EbeanVersion() {
|
||||
// hide
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.ebean;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
@@ -25,13 +24,11 @@ public class EmptyPagedList<T> implements PagedList<T> {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Future<Integer> getFutureCount() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<T> getList() {
|
||||
return Collections.emptyList();
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Map;
|
||||
* This provides a convenient way to create expressions for the default
|
||||
* database.
|
||||
* <p>
|
||||
* See also {@link DB#getExpressionFactory()}
|
||||
* See also {@link DB#expressionFactory()}
|
||||
* </p>
|
||||
* <p>
|
||||
* Creates standard common expressions for using in a Query Where or Having
|
||||
@@ -34,14 +34,14 @@ public class Expr {
|
||||
* Equal To - property equal to the given value.
|
||||
*/
|
||||
public static Expression eq(String propertyName, Object value) {
|
||||
return DB.getExpressionFactory().eq(propertyName, value);
|
||||
return DB.expressionFactory().eq(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not Equal To - property not equal to the given value.
|
||||
*/
|
||||
public static Expression ne(String propertyName, Object value) {
|
||||
return DB.getExpressionFactory().ne(propertyName, value);
|
||||
return DB.expressionFactory().ne(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ public class Expr {
|
||||
* using a lower() function to make it case insensitive).
|
||||
*/
|
||||
public static Expression ieq(String propertyName, String value) {
|
||||
return DB.getExpressionFactory().ieq(propertyName, value);
|
||||
return DB.expressionFactory().ieq(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,28 +59,28 @@ public class Expr {
|
||||
* </p>
|
||||
*/
|
||||
public static Expression inRange(String propertyName, Object value1, Object value2) {
|
||||
return DB.getExpressionFactory().inRange(propertyName, value1, value2);
|
||||
return DB.expressionFactory().inRange(propertyName, value1, value2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Between - property between the two given values.
|
||||
*/
|
||||
public static Expression between(String propertyName, Object value1, Object value2) {
|
||||
return DB.getExpressionFactory().between(propertyName, value1, value2);
|
||||
return DB.expressionFactory().between(propertyName, value1, value2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Between - value between two given properties.
|
||||
*/
|
||||
public static Expression between(String lowProperty, String highProperty, Object value) {
|
||||
return DB.getExpressionFactory().betweenProperties(lowProperty, highProperty, value);
|
||||
return DB.expressionFactory().betweenProperties(lowProperty, highProperty, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Greater Than - property greater than the given value.
|
||||
*/
|
||||
public static Expression gt(String propertyName, Object value) {
|
||||
return DB.getExpressionFactory().gt(propertyName, value);
|
||||
return DB.expressionFactory().gt(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,42 +88,42 @@ public class Expr {
|
||||
* value.
|
||||
*/
|
||||
public static Expression ge(String propertyName, Object value) {
|
||||
return DB.getExpressionFactory().ge(propertyName, value);
|
||||
return DB.expressionFactory().ge(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Less Than - property less than the given value.
|
||||
*/
|
||||
public static Expression lt(String propertyName, Object value) {
|
||||
return DB.getExpressionFactory().lt(propertyName, value);
|
||||
return DB.expressionFactory().lt(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Less Than or Equal to - property less than or equal to the given value.
|
||||
*/
|
||||
public static Expression le(String propertyName, Object value) {
|
||||
return DB.getExpressionFactory().le(propertyName, value);
|
||||
return DB.expressionFactory().le(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is Null - property is null.
|
||||
*/
|
||||
public static Expression isNull(String propertyName) {
|
||||
return DB.getExpressionFactory().isNull(propertyName);
|
||||
return DB.expressionFactory().isNull(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is Not Null - property is not null.
|
||||
*/
|
||||
public static Expression isNotNull(String propertyName) {
|
||||
return DB.getExpressionFactory().isNotNull(propertyName);
|
||||
return DB.expressionFactory().isNotNull(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Case insensitive {@link #exampleLike(Object)}
|
||||
*/
|
||||
public static ExampleExpression iexampleLike(Object example) {
|
||||
return DB.getExpressionFactory().iexampleLike(example);
|
||||
return DB.expressionFactory().iexampleLike(example);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,14 +131,14 @@ public class Expr {
|
||||
* LikeType.RAW (you need to add you own wildcards % and _).
|
||||
*/
|
||||
public static ExampleExpression exampleLike(Object example) {
|
||||
return DB.getExpressionFactory().exampleLike(example);
|
||||
return DB.expressionFactory().exampleLike(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the query by Example expression specifying more options.
|
||||
*/
|
||||
public static ExampleExpression exampleLike(Object example, boolean caseInsensitive, LikeType likeType) {
|
||||
return DB.getExpressionFactory().exampleLike(example, caseInsensitive, likeType);
|
||||
return DB.expressionFactory().exampleLike(example, caseInsensitive, likeType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +146,7 @@ public class Expr {
|
||||
* characters % (percentage) and _ (underscore).
|
||||
*/
|
||||
public static Expression like(String propertyName, String value) {
|
||||
return DB.getExpressionFactory().like(propertyName, value);
|
||||
return DB.expressionFactory().like(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,14 +155,14 @@ public class Expr {
|
||||
* a lower() function to make the expression case insensitive.
|
||||
*/
|
||||
public static Expression ilike(String propertyName, String value) {
|
||||
return DB.getExpressionFactory().ilike(propertyName, value);
|
||||
return DB.expressionFactory().ilike(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts With - property like value%.
|
||||
*/
|
||||
public static Expression startsWith(String propertyName, String value) {
|
||||
return DB.getExpressionFactory().startsWith(propertyName, value);
|
||||
return DB.expressionFactory().startsWith(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,14 +170,14 @@ public class Expr {
|
||||
* lower() function to make the expression case insensitive.
|
||||
*/
|
||||
public static Expression istartsWith(String propertyName, String value) {
|
||||
return DB.getExpressionFactory().istartsWith(propertyName, value);
|
||||
return DB.expressionFactory().istartsWith(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends With - property like %value.
|
||||
*/
|
||||
public static Expression endsWith(String propertyName, String value) {
|
||||
return DB.getExpressionFactory().endsWith(propertyName, value);
|
||||
return DB.expressionFactory().endsWith(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,14 +185,14 @@ public class Expr {
|
||||
* function to make the expression case insensitive.
|
||||
*/
|
||||
public static Expression iendsWith(String propertyName, String value) {
|
||||
return DB.getExpressionFactory().iendsWith(propertyName, value);
|
||||
return DB.expressionFactory().iendsWith(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains - property like %value%.
|
||||
*/
|
||||
public static Expression contains(String propertyName, String value) {
|
||||
return DB.getExpressionFactory().contains(propertyName, value);
|
||||
return DB.expressionFactory().contains(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,42 +200,42 @@ public class Expr {
|
||||
* function to make the expression case insensitive.
|
||||
*/
|
||||
public static Expression icontains(String propertyName, String value) {
|
||||
return DB.getExpressionFactory().icontains(propertyName, value);
|
||||
return DB.expressionFactory().icontains(propertyName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* For collection properties that are empty (have not existing elements).
|
||||
*/
|
||||
public static Expression isEmpty(String propertyName) {
|
||||
return DB.getExpressionFactory().isEmpty(propertyName);
|
||||
return DB.expressionFactory().isEmpty(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* For collection properties that are not empty (have existing elements).
|
||||
*/
|
||||
public static Expression isNotEmpty(String propertyName) {
|
||||
return DB.getExpressionFactory().isNotEmpty(propertyName);
|
||||
return DB.expressionFactory().isNotEmpty(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* In - property has a value in the array of values.
|
||||
*/
|
||||
public static Expression in(String propertyName, Object[] values) {
|
||||
return DB.getExpressionFactory().in(propertyName, values);
|
||||
return DB.expressionFactory().in(propertyName, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* In - using a subQuery.
|
||||
*/
|
||||
public static Expression in(String propertyName, Query<?> subQuery) {
|
||||
return DB.getExpressionFactory().in(propertyName, subQuery);
|
||||
return DB.expressionFactory().in(propertyName, subQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* In - property has a value in the collection of values.
|
||||
*/
|
||||
public static Expression in(String propertyName, Collection<?> values) {
|
||||
return DB.getExpressionFactory().in(propertyName, values);
|
||||
return DB.expressionFactory().in(propertyName, values);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,14 +272,14 @@ public class Expr {
|
||||
* }</pre>
|
||||
*/
|
||||
public static Expression inOrEmpty(String propertyName, Collection<?> values) {
|
||||
return DB.getExpressionFactory().inOrEmpty(propertyName, values);
|
||||
return DB.expressionFactory().inOrEmpty(propertyName, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Id Equal to - ID property is equal to the value.
|
||||
*/
|
||||
public static Expression idEq(Object value) {
|
||||
return DB.getExpressionFactory().idEq(value);
|
||||
return DB.expressionFactory().idEq(value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +292,7 @@ public class Expr {
|
||||
* @param propertyMap a map keyed by property names.
|
||||
*/
|
||||
public static Expression allEq(Map<String, Object> propertyMap) {
|
||||
return DB.getExpressionFactory().allEq(propertyMap);
|
||||
return DB.expressionFactory().allEq(propertyMap);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,7 +303,7 @@ public class Expr {
|
||||
* </p>
|
||||
*/
|
||||
public static Expression raw(String raw, Object value) {
|
||||
return DB.getExpressionFactory().raw(raw, value);
|
||||
return DB.expressionFactory().raw(raw, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,53 +314,48 @@ public class Expr {
|
||||
* </p>
|
||||
*/
|
||||
public static Expression raw(String raw, Object[] values) {
|
||||
return DB.getExpressionFactory().raw(raw, values);
|
||||
return DB.expressionFactory().raw(raw, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add raw expression with no parameters.
|
||||
*/
|
||||
public static Expression raw(String raw) {
|
||||
return DB.getExpressionFactory().raw(raw);
|
||||
return DB.expressionFactory().raw(raw);
|
||||
}
|
||||
|
||||
/**
|
||||
* And - join two expressions with a logical and.
|
||||
*/
|
||||
public static Expression and(Expression expOne, Expression expTwo) {
|
||||
|
||||
return DB.getExpressionFactory().and(expOne, expTwo);
|
||||
return DB.expressionFactory().and(expOne, expTwo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Or - join two expressions with a logical or.
|
||||
*/
|
||||
public static Expression or(Expression expOne, Expression expTwo) {
|
||||
|
||||
return DB.getExpressionFactory().or(expOne, expTwo);
|
||||
return DB.expressionFactory().or(expOne, expTwo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Negate the expression (prefix it with NOT).
|
||||
*/
|
||||
public static Expression not(Expression exp) {
|
||||
|
||||
return DB.getExpressionFactory().not(exp);
|
||||
return DB.expressionFactory().not(exp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of expressions that will be joined by AND's.
|
||||
*/
|
||||
public static <T> Junction<T> conjunction(Query<T> query) {
|
||||
|
||||
return DB.getExpressionFactory().conjunction(query);
|
||||
return DB.expressionFactory().conjunction(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of expressions that will be joined by OR's.
|
||||
*/
|
||||
public static <T> Junction<T> disjunction(Query<T> query) {
|
||||
|
||||
return DB.getExpressionFactory().disjunction(query);
|
||||
return DB.expressionFactory().disjunction(query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.ebean.search.Match;
|
||||
import io.ebean.search.MultiMatch;
|
||||
import io.ebean.search.TextCommonTerms;
|
||||
import io.ebean.search.TextQueryString;
|
||||
import io.ebean.search.TextSimple;
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.search.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.NonUniqueResultException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -39,6 +31,7 @@ import java.util.function.Predicate;
|
||||
*
|
||||
* @see Query#where()
|
||||
*/
|
||||
@NonNullApi
|
||||
public interface ExpressionList<T> {
|
||||
|
||||
/**
|
||||
@@ -327,7 +320,6 @@ public interface ExpressionList<T> {
|
||||
*
|
||||
* @see Query#findList()
|
||||
*/
|
||||
@Nonnull
|
||||
List<T> findList();
|
||||
|
||||
/**
|
||||
@@ -335,7 +327,6 @@ public interface ExpressionList<T> {
|
||||
*
|
||||
* @see Query#findIds()
|
||||
*/
|
||||
@Nonnull
|
||||
<A> List<A> findIds();
|
||||
|
||||
/**
|
||||
@@ -351,7 +342,6 @@ public interface ExpressionList<T> {
|
||||
*
|
||||
* @see Query#findSet()
|
||||
*/
|
||||
@Nonnull
|
||||
Set<T> findSet();
|
||||
|
||||
/**
|
||||
@@ -359,7 +349,6 @@ public interface ExpressionList<T> {
|
||||
*
|
||||
* @see Query#findMap()
|
||||
*/
|
||||
@Nonnull
|
||||
<K> Map<K, T> findMap();
|
||||
|
||||
/**
|
||||
@@ -392,7 +381,6 @@ public interface ExpressionList<T> {
|
||||
*
|
||||
* @return the list of values for the selected property
|
||||
*/
|
||||
@Nonnull
|
||||
<A> List<A> findSingleAttributeList();
|
||||
|
||||
/**
|
||||
@@ -429,7 +417,6 @@ public interface ExpressionList<T> {
|
||||
/**
|
||||
* Execute the query returning an optional bean.
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<T> findOneOrEmpty();
|
||||
|
||||
/**
|
||||
@@ -442,7 +429,6 @@ public interface ExpressionList<T> {
|
||||
*
|
||||
* @return a Future object for the row count query
|
||||
*/
|
||||
@Nonnull
|
||||
FutureRowCount<T> findFutureCount();
|
||||
|
||||
/**
|
||||
@@ -455,7 +441,6 @@ public interface ExpressionList<T> {
|
||||
*
|
||||
* @return a Future object for the list of Id's
|
||||
*/
|
||||
@Nonnull
|
||||
FutureIds<T> findFutureIds();
|
||||
|
||||
/**
|
||||
@@ -468,7 +453,6 @@ public interface ExpressionList<T> {
|
||||
*
|
||||
* @return a Future object for the list result of the query
|
||||
*/
|
||||
@Nonnull
|
||||
FutureList<T> findFutureList();
|
||||
|
||||
/**
|
||||
@@ -499,7 +483,6 @@ public interface ExpressionList<T> {
|
||||
* @return The PagedList
|
||||
* @see Query#findPagedList()
|
||||
*/
|
||||
@Nonnull
|
||||
PagedList<T> findPagedList();
|
||||
|
||||
/**
|
||||
@@ -509,7 +492,6 @@ public interface ExpressionList<T> {
|
||||
* It will execute the query against the history returning the versions of the bean.
|
||||
* </p>
|
||||
*/
|
||||
@Nonnull
|
||||
List<Version<T>> findVersions();
|
||||
|
||||
/**
|
||||
@@ -519,13 +501,11 @@ public interface ExpressionList<T> {
|
||||
* It will execute the query against the history returning the versions of the bean.
|
||||
* </p>
|
||||
*/
|
||||
@Nonnull
|
||||
List<Version<T>> findVersionsBetween(Timestamp start, Timestamp end);
|
||||
|
||||
/**
|
||||
* Add some filter predicate expressions to the many property.
|
||||
*/
|
||||
@Nonnull
|
||||
ExpressionList<T> filterMany(String manyProperty);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import io.avaje.lang.Nullable;
|
||||
|
||||
import javax.persistence.NonUniqueResultException;
|
||||
import java.time.Clock;
|
||||
import java.util.List;
|
||||
@@ -82,7 +82,6 @@ public interface ExtendedServer {
|
||||
*
|
||||
* @see Query#findIds()
|
||||
*/
|
||||
@Nonnull
|
||||
<A, T> List<A> findIds(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -100,7 +99,6 @@ public interface ExtendedServer {
|
||||
* @see Query#findEach(Consumer)
|
||||
* @see Query#findEachWhile(Predicate)
|
||||
*/
|
||||
@Nonnull
|
||||
<T> QueryIterator<T> findIterate(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -112,7 +110,6 @@ public interface ExtendedServer {
|
||||
* Note that the stream needs to be closed so use with try with resources.
|
||||
* </p>
|
||||
*/
|
||||
@Nonnull
|
||||
<T> Stream<T> findStream(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -125,7 +122,6 @@ public interface ExtendedServer {
|
||||
* <p>
|
||||
* Note that the stream needs to be closed so use with try with resources.
|
||||
*/
|
||||
@Nonnull
|
||||
@Deprecated
|
||||
<T> Stream<T> findLargeStream(Query<T> query, Transaction transaction);
|
||||
|
||||
@@ -210,7 +206,6 @@ public interface ExtendedServer {
|
||||
* It will execute the query against the history returning the versions of the bean.
|
||||
* </p>
|
||||
*/
|
||||
@Nonnull
|
||||
<T> List<Version<T>> findVersions(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -235,7 +230,6 @@ public interface ExtendedServer {
|
||||
* @return the list of fetched beans.
|
||||
* @see Query#findList()
|
||||
*/
|
||||
@Nonnull
|
||||
<T> List<T> findList(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -251,7 +245,6 @@ public interface ExtendedServer {
|
||||
* @return a Future object for the row count query
|
||||
* @see Query#findFutureCount()
|
||||
*/
|
||||
@Nonnull
|
||||
<T> FutureRowCount<T> findFutureCount(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -267,7 +260,6 @@ public interface ExtendedServer {
|
||||
* @return a Future object for the list of Id's
|
||||
* @see Query#findFutureIds()
|
||||
*/
|
||||
@Nonnull
|
||||
<T> FutureIds<T> findFutureIds(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -284,7 +276,6 @@ public interface ExtendedServer {
|
||||
* @return a Future object for the list result of the query
|
||||
* @see Query#findFutureList()
|
||||
*/
|
||||
@Nonnull
|
||||
<T> FutureList<T> findFutureList(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -316,7 +307,6 @@ public interface ExtendedServer {
|
||||
* @return The PagedList
|
||||
* @see Query#findPagedList()
|
||||
*/
|
||||
@Nonnull
|
||||
<T> PagedList<T> findPagedList(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -341,7 +331,6 @@ public interface ExtendedServer {
|
||||
* @return the set of fetched beans.
|
||||
* @see Query#findSet()
|
||||
*/
|
||||
@Nonnull
|
||||
<T> Set<T> findSet(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -358,7 +347,6 @@ public interface ExtendedServer {
|
||||
* @return the map of fetched beans.
|
||||
* @see Query#findMap()
|
||||
*/
|
||||
@Nonnull
|
||||
<K, T> Map<K, T> findMap(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -391,7 +379,6 @@ public interface ExtendedServer {
|
||||
* @return the list of values for the selected property
|
||||
* @see Query#findSingleAttributeList()
|
||||
*/
|
||||
@Nonnull
|
||||
<A, T> List<A> findSingleAttributeList(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -419,7 +406,6 @@ public interface ExtendedServer {
|
||||
/**
|
||||
* Similar to findOne() but returns an Optional (rather than nullable).
|
||||
*/
|
||||
@Nonnull
|
||||
<T> Optional<T> findOneOrEmpty(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
@@ -463,7 +449,6 @@ public interface ExtendedServer {
|
||||
* @return the list of fetched MapBean.
|
||||
* @see SqlQuery#findList()
|
||||
*/
|
||||
@Nonnull
|
||||
List<SqlRow> findList(SqlQuery query, Transaction transaction);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.ebean.service.SpiFetchGroupQuery;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Defines what part of the object graph to load (select and fetch clauses).
|
||||
* <p>
|
||||
@@ -62,6 +61,7 @@ import javax.annotation.Nonnull;
|
||||
*
|
||||
* @param <T> The bean type the Fetch group can be applied to
|
||||
*/
|
||||
@NonNullApi
|
||||
public interface FetchGroup<T> {
|
||||
|
||||
/**
|
||||
@@ -83,7 +83,6 @@ public interface FetchGroup<T> {
|
||||
*
|
||||
* @return The FetchGroup with the given select clause
|
||||
*/
|
||||
@Nonnull
|
||||
static <T> FetchGroup<T> of(Class<T> cls, String select) {
|
||||
return XServiceProvider.fetchGroupOf(cls, select);
|
||||
}
|
||||
@@ -108,7 +107,6 @@ public interface FetchGroup<T> {
|
||||
*
|
||||
* @return The FetchGroupBuilder with the given select clause which we will add fetch clauses to
|
||||
*/
|
||||
@Nonnull
|
||||
static <T> FetchGroupBuilder<T> of(Class<T> cls) {
|
||||
return XServiceProvider.fetchGroupOf(cls);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebean;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import io.avaje.lang.NonNullApi;
|
||||
|
||||
/**
|
||||
* Builds a FetchGroup by adding fetch clauses.
|
||||
@@ -23,85 +23,73 @@ import javax.annotation.Nonnull;
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@NonNullApi
|
||||
public interface FetchGroupBuilder<T> {
|
||||
|
||||
/**
|
||||
* Specify specific properties to select (top level properties).
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> select(String select);
|
||||
|
||||
/**
|
||||
* Fetch all the properties at the given path.
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetch(String path);
|
||||
|
||||
/**
|
||||
* Fetch the path with the nested fetch group.
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetch(String path, FetchGroup<?> nestedGroup);
|
||||
|
||||
/**
|
||||
* Fetch the path using a query join with the nested fetch group.
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetchQuery(String path, FetchGroup<?> nestedGroup);
|
||||
|
||||
/**
|
||||
* Fetch the path lazily with the nested fetch group.
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetchLazy(String path, FetchGroup<?> nestedGroup);
|
||||
|
||||
/**
|
||||
* Fetch the path including specified properties.
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetch(String path, String properties);
|
||||
|
||||
/**
|
||||
* Fetch the path including all its properties using a query join.
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetchQuery(String path);
|
||||
|
||||
/**
|
||||
* Fetch the path including all its properties using L2 cache.
|
||||
* Cache misses fallback to fetchQuery().
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetchCache(String path);
|
||||
|
||||
/**
|
||||
* Fetch the path including specified properties using a query join.
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetchQuery(String path, String properties);
|
||||
|
||||
/**
|
||||
* Fetch the path including specified properties using L2 cache.
|
||||
* Cache misses fallback to fetchQuery().
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetchCache(String path, String properties);
|
||||
|
||||
/**
|
||||
* Fetch the path including all its properties lazily.
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetchLazy(String path);
|
||||
|
||||
/**
|
||||
* Fetch the path including specified properties lazily.
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroupBuilder<T> fetchLazy(String path, String properties);
|
||||
|
||||
/**
|
||||
* Build and return the FetchGroup.
|
||||
*/
|
||||
@Nonnull
|
||||
FetchGroup<T> build();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.avaje.lang.NonNullApi;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -77,6 +79,7 @@ import java.util.Set;
|
||||
*
|
||||
* @param <T> the entity bean type
|
||||
*/
|
||||
@NonNullApi
|
||||
public interface Filter<T> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -55,6 +55,7 @@ import java.util.List;
|
||||
* }</pre>
|
||||
*
|
||||
*/
|
||||
@NonNullApi
|
||||
public class Finder<I, T> {
|
||||
|
||||
/**
|
||||
@@ -137,11 +138,10 @@ public class Finder<I, T> {
|
||||
/**
|
||||
* Creates an entity reference for this ID.
|
||||
* <p>
|
||||
* Equivalent to {@link Database#getReference(Class, Object)}
|
||||
* Equivalent to {@link Database#reference(Class, Object)}
|
||||
*/
|
||||
@Nonnull
|
||||
public T ref(I id) {
|
||||
return db().getReference(type, id);
|
||||
return db().reference(type, id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +166,6 @@ public class Finder<I, T> {
|
||||
/**
|
||||
* Retrieves all entities of the given type.
|
||||
*/
|
||||
@Nonnull
|
||||
public List<T> all() {
|
||||
return query().findList();
|
||||
}
|
||||
|
||||
@@ -113,9 +113,9 @@ public interface Junction<T> extends Expression, ExpressionList<T> {
|
||||
*/
|
||||
SHOULD("should", "", true);
|
||||
|
||||
private String prefix;
|
||||
private String literal;
|
||||
private boolean text;
|
||||
private final String prefix;
|
||||
private final String literal;
|
||||
private final boolean text;
|
||||
|
||||
Type(String literal, String prefix, boolean text) {
|
||||
this.literal = literal;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.ebean;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
@@ -116,13 +115,11 @@ public interface PagedList<T> {
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@Nonnull
|
||||
Future<Integer> getFutureCount();
|
||||
|
||||
/**
|
||||
* Return the list of entities for this page.
|
||||
*/
|
||||
@Nonnull
|
||||
List<T> getList();
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.ebean;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Holds a list of value object pairs.
|
||||
@@ -62,15 +63,14 @@ import java.util.List;
|
||||
* </p>
|
||||
* <pre>{@code sql
|
||||
*
|
||||
* create index ix_name on table_name ((sku || '-' || code));
|
||||
* create index ix_name on table_name (sku || '-' || code);
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
public class Pairs {
|
||||
public final class Pairs {
|
||||
|
||||
private final String property0;
|
||||
private final String property1;
|
||||
|
||||
private final List<Entry> entries = new ArrayList<>();
|
||||
|
||||
/**
|
||||
@@ -111,54 +111,70 @@ public class Pairs {
|
||||
/**
|
||||
* Return the first property name.
|
||||
*/
|
||||
public String getProperty0() {
|
||||
public String property0() {
|
||||
return property0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the second property name.
|
||||
*/
|
||||
public String getProperty1() {
|
||||
public String property1() {
|
||||
return property1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the value pairs.
|
||||
*/
|
||||
public List<Entry> getEntries() {
|
||||
public List<Entry> entries() {
|
||||
return Collections.unmodifiableList(entries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the separator character used with DB varchar concatenation to combine the 2 values.
|
||||
*/
|
||||
public String getConcatSeparator() {
|
||||
public String concatSeparator() {
|
||||
return concatSeparator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the separator character used with DB varchar concatenation to combine the 2 values.
|
||||
*/
|
||||
public Pairs setConcatSeparator(String concatSeparator) {
|
||||
public Pairs concatSeparator(String concatSeparator) {
|
||||
this.concatSeparator = concatSeparator;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to concatSeparator()
|
||||
*/
|
||||
@Deprecated
|
||||
public Pairs setConcatSeparator(String concatSeparator) {
|
||||
return concatSeparator(concatSeparator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a suffix used with DB varchar concatenation to combine the 2 values.
|
||||
*/
|
||||
public String getConcatSuffix() {
|
||||
public String concatSuffix() {
|
||||
return concatSuffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a suffix used with DB varchar concatenation to combine the 2 values.
|
||||
*/
|
||||
public Pairs setConcatSuffix(String concatSuffix) {
|
||||
public Pairs concatSuffix(String concatSuffix) {
|
||||
this.concatSuffix = concatSuffix;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to concatSuffix()
|
||||
*/
|
||||
@Deprecated
|
||||
public Pairs setConcatSuffix(String concatSuffix) {
|
||||
return concatSuffix(concatSuffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "p0:" + property0 + " p1:" + property1 + " entries:" + entries;
|
||||
@@ -208,16 +224,13 @@ public class Pairs {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Entry that = (Entry) o;
|
||||
return a.equals(that.a) && b.equals(that.b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = a.hashCode();
|
||||
result = 92821 * result + b.hashCode();
|
||||
return result;
|
||||
return Objects.hash(a, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,14 +45,6 @@ public interface ProfileLocation {
|
||||
*/
|
||||
String label();
|
||||
|
||||
/**
|
||||
* Return a hash of the location that intentionally excludes the line number.
|
||||
* <p>
|
||||
* The hash is expected to be stable regardless of line number in the source file
|
||||
* so that is identifies the class and method location over a long time.
|
||||
*/
|
||||
long hash();
|
||||
|
||||
/**
|
||||
* Return the full location.
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
import javax.persistence.NonUniqueResultException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Timestamp;
|
||||
@@ -177,6 +177,7 @@ import java.util.stream.Stream;
|
||||
*
|
||||
* @param <T> the type of Entity bean this query will fetch.
|
||||
*/
|
||||
@NonNullApi
|
||||
public interface Query<T> extends CancelableQuery {
|
||||
|
||||
/**
|
||||
@@ -689,7 +690,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
* This query will execute against the Database that was used to create it.
|
||||
* </p>
|
||||
*/
|
||||
@Nonnull
|
||||
<A> List<A> findIds();
|
||||
|
||||
/**
|
||||
@@ -727,7 +727,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@Nonnull
|
||||
QueryIterator<T> findIterate();
|
||||
|
||||
/**
|
||||
@@ -749,7 +748,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@Nonnull
|
||||
Stream<T> findStream();
|
||||
|
||||
/**
|
||||
@@ -772,7 +770,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@Nonnull
|
||||
@Deprecated
|
||||
Stream<T> findLargeStream();
|
||||
|
||||
@@ -882,7 +879,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@Nonnull
|
||||
List<T> findList();
|
||||
|
||||
/**
|
||||
@@ -898,7 +894,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@Nonnull
|
||||
Set<T> findSet();
|
||||
|
||||
/**
|
||||
@@ -918,7 +913,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@Nonnull
|
||||
<K> Map<K, T> findMap();
|
||||
|
||||
/**
|
||||
@@ -951,7 +945,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* @return the list of values for the selected property
|
||||
*/
|
||||
@Nonnull
|
||||
<A> List<A> findSingleAttributeList();
|
||||
|
||||
/**
|
||||
@@ -1049,7 +1042,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
/**
|
||||
* Execute the query returning an optional bean.
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<T> findOneOrEmpty();
|
||||
|
||||
/**
|
||||
@@ -1064,7 +1056,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
* It will execute the query against the history returning the versions of the bean.
|
||||
* </p>
|
||||
*/
|
||||
@Nonnull
|
||||
List<Version<T>> findVersions();
|
||||
|
||||
/**
|
||||
@@ -1074,7 +1065,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
* It will execute the query against the history returning the versions of the bean.
|
||||
* </p>
|
||||
*/
|
||||
@Nonnull
|
||||
List<Version<T>> findVersionsBetween(Timestamp start, Timestamp end);
|
||||
|
||||
/**
|
||||
@@ -1132,7 +1122,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* @return a Future object for the row count query
|
||||
*/
|
||||
@Nonnull
|
||||
FutureRowCount<T> findFutureCount();
|
||||
|
||||
/**
|
||||
@@ -1145,7 +1134,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* @return a Future object for the list of Id's
|
||||
*/
|
||||
@Nonnull
|
||||
FutureIds<T> findFutureIds();
|
||||
|
||||
/**
|
||||
@@ -1157,7 +1145,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* @return a Future object for the list result of the query
|
||||
*/
|
||||
@Nonnull
|
||||
FutureList<T> findFutureList();
|
||||
|
||||
/**
|
||||
@@ -1187,7 +1174,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*
|
||||
* @return The PagedList
|
||||
*/
|
||||
@Nonnull
|
||||
PagedList<T> findPagedList();
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@@ -37,12 +37,12 @@ import java.util.function.Predicate;
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@NonNullApi
|
||||
public interface SqlQuery extends Serializable, CancelableQuery {
|
||||
|
||||
/**
|
||||
* Execute the query returning a list.
|
||||
*/
|
||||
@Nonnull
|
||||
List<SqlRow> findList();
|
||||
|
||||
/**
|
||||
@@ -119,7 +119,6 @@ public interface SqlQuery extends Serializable, CancelableQuery {
|
||||
/**
|
||||
* Execute the query returning an optional row.
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<SqlRow> findOneOrEmpty();
|
||||
|
||||
/**
|
||||
@@ -354,6 +353,7 @@ public interface SqlQuery extends Serializable, CancelableQuery {
|
||||
/**
|
||||
* Return the single value.
|
||||
*/
|
||||
@Nullable
|
||||
T findOne();
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.ebean;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* A SqlUpdate for executing insert update or delete statements.
|
||||
* <p>
|
||||
@@ -324,6 +326,13 @@ public interface SqlUpdate {
|
||||
*/
|
||||
SqlUpdate setParameter(String name, Object param);
|
||||
|
||||
/**
|
||||
* Bind the named multi-value array parameter which we would use with Postgres ANY.
|
||||
* <p>
|
||||
* For Postgres this binds an ARRAY rather than expands into multiple bind values.
|
||||
*/
|
||||
SqlUpdate setArrayParameter(String name, Collection<?> values);
|
||||
|
||||
/**
|
||||
* Set a named parameter that has a null value. Exactly the same as
|
||||
* {@link #setNullParameter(String, int)}.
|
||||
|
||||
@@ -538,7 +538,15 @@ public interface Transaction extends AutoCloseable {
|
||||
* Examples of when a developer may wish to use the connection directly are:
|
||||
* Savepoints, advanced CLOB BLOB use and advanced stored procedure calls.
|
||||
*/
|
||||
Connection getConnection();
|
||||
Connection connection();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to connection().
|
||||
*/
|
||||
@Deprecated
|
||||
default Connection getConnection() {
|
||||
return connection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add table modification information to the TransactionEvent.
|
||||
|
||||
@@ -11,7 +11,7 @@ public interface BeanCollectionLoader {
|
||||
/**
|
||||
* Return the name of the associated Database.
|
||||
*/
|
||||
String getName();
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Invoke the lazy loading for this bean collection.
|
||||
|
||||
@@ -9,11 +9,7 @@ import javax.persistence.PersistenceException;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@@ -395,6 +391,15 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
this.owner._ebean_setEmbeddedLoaded();
|
||||
this.lazyLoadProperty = -1;
|
||||
this.origValues = null;
|
||||
// after save, transfer the mutable next values back to mutable info
|
||||
if (mutableNext != null) {
|
||||
for (int i = 0; i < mutableNext.length; i++) {
|
||||
MutableValueNext next = mutableNext[i];
|
||||
if (next != null) {
|
||||
mutableInfo(i, next.info());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mutableNext = null;
|
||||
for (int i = 0; i < flags.length; i++) {
|
||||
flags[i] &= ~(FLAG_CHANGED_PROP | FLAG_ORIG_VALUE_SET);
|
||||
@@ -834,7 +839,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
}
|
||||
// For stand alone reference bean or after deserialisation lazy load
|
||||
// using the ebeanServer. Synchronise only on the bean.
|
||||
loadBeanInternal(loadProperty, database.getPluginApi().beanLoader());
|
||||
loadBeanInternal(loadProperty, database.pluginApi().beanLoader());
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
@@ -1155,7 +1160,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
*/
|
||||
public Map<String, Exception> getLoadErrors() {
|
||||
if (loadErrors == null) {
|
||||
return null;
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<String, Exception> ret = null;
|
||||
int len = getPropertyLength();
|
||||
@@ -1224,8 +1229,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
return null;
|
||||
}
|
||||
final MutableValueNext next = mutableNext[propertyIndex];
|
||||
mutableInfo(propertyIndex, next.info());
|
||||
return next.content();
|
||||
return next != null ? next.content() : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,21 +60,15 @@ public interface PersistenceContext {
|
||||
int size(Class<?> rootType);
|
||||
|
||||
/**
|
||||
* Return a copy of the Persistence context to use for large query iteration.
|
||||
* Signalizes the PersistenceContext, the begin for large query iteration.
|
||||
*/
|
||||
PersistenceContext forIterate();
|
||||
void beginIterate();
|
||||
|
||||
/**
|
||||
* Return a new Persistence context during iteration of large query result.
|
||||
* Signalizes the PersistenceContext, the end for large query iteration.
|
||||
*/
|
||||
PersistenceContext forIterateReset();
|
||||
|
||||
/**
|
||||
* Return true if the persistence context has grown and hit the 'reset limit'
|
||||
* during large query iteration.
|
||||
*/
|
||||
boolean resetLimit();
|
||||
|
||||
void endIterate();
|
||||
|
||||
/**
|
||||
* Wrapper on a bean to also indicate if a bean has been deleted.
|
||||
* <p>
|
||||
|
||||
@@ -20,7 +20,7 @@ public abstract class SingleBeanLoader implements BeanLoader {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return database.getName();
|
||||
return database.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,7 +39,7 @@ public abstract class SingleBeanLoader implements BeanLoader {
|
||||
|
||||
@Override
|
||||
public void loadBean(EntityBeanIntercept ebi) {
|
||||
database.getPluginApi().loadBeanL2(ebi);
|
||||
database.pluginApi().loadBeanL2(ebi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public abstract class SingleBeanLoader implements BeanLoader {
|
||||
|
||||
@Override
|
||||
public void loadBean(EntityBeanIntercept ebi) {
|
||||
database.getPluginApi().loadBeanRef(ebi);
|
||||
database.pluginApi().loadBeanRef(ebi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public abstract class SingleBeanLoader implements BeanLoader {
|
||||
|
||||
@Override
|
||||
public void loadBean(EntityBeanIntercept ebi) {
|
||||
database.getPluginApi().loadBean(ebi);
|
||||
database.pluginApi().loadBean(ebi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ import java.util.Set;
|
||||
public class QueryCacheEntry {
|
||||
|
||||
private final Object value;
|
||||
|
||||
private final Set<String> dependentTables;
|
||||
|
||||
private final long timestamp;
|
||||
|
||||
/**
|
||||
|
||||
+19
-3
@@ -10,17 +10,17 @@ import java.util.Set;
|
||||
* Represents part of the "L2" server side cache.
|
||||
* <p>
|
||||
* This is used to cache beans or query results (bean collections).
|
||||
* </p>
|
||||
* <p>
|
||||
* There are 2 ServerCache's for each bean type. One is used as the 'bean cache'
|
||||
* which holds beans of a given type. The other is the 'query cache' holding
|
||||
* query results for a given type.
|
||||
* </p>
|
||||
*/
|
||||
public interface ServerCache {
|
||||
|
||||
/**
|
||||
* Get values for many keys.
|
||||
*/
|
||||
default Map<Object, Object> getAll(Set<Object> keys) {
|
||||
|
||||
Map<Object, Object> map = new LinkedHashMap<>();
|
||||
for (Object key : keys) {
|
||||
Object value = get(key);
|
||||
@@ -73,6 +73,14 @@ public interface ServerCache {
|
||||
/**
|
||||
* Return the hit ratio the cache is currently getting.
|
||||
*/
|
||||
default int hitRatio() {
|
||||
return getHitRatio();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to hitRatio().
|
||||
*/
|
||||
@Deprecated
|
||||
int getHitRatio();
|
||||
|
||||
/**
|
||||
@@ -80,6 +88,14 @@ public interface ServerCache {
|
||||
*
|
||||
* @param reset if true the statistics are reset.
|
||||
*/
|
||||
default ServerCacheStatistics statistics(boolean reset) {
|
||||
return getStatistics(reset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to statistics().
|
||||
*/
|
||||
@Deprecated
|
||||
ServerCacheStatistics getStatistics(boolean reset);
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,15 @@ public interface ServerCacheManager {
|
||||
* rather than background processing.
|
||||
* </p>
|
||||
*/
|
||||
boolean isLocalL2Caching();
|
||||
boolean localL2Caching();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to localL2Caching().
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean isLocalL2Caching() {
|
||||
return localL2Caching();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the cache regions.
|
||||
@@ -36,37 +44,78 @@ public interface ServerCacheManager {
|
||||
*
|
||||
* @param regions A region name or comma delimited list of region names.
|
||||
*/
|
||||
void setEnabledRegions(String regions);
|
||||
void enabledRegions(String regions);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to enabledRegions().
|
||||
*/
|
||||
@Deprecated
|
||||
default void setEnabledRegions(String regions) {
|
||||
enabledRegions(regions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable all the cache regions.
|
||||
*/
|
||||
void setAllRegionsEnabled(boolean enabled);
|
||||
void allRegionsEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Return the cache region by name. Typically to enable or disable the region.
|
||||
* Deprecated migrate to allRegionsEnabled().
|
||||
*/
|
||||
ServerCacheRegion getRegion(String name);
|
||||
@Deprecated
|
||||
default void setAllRegionsEnabled(boolean enabled) {
|
||||
allRegionsEnabled(enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache region by name. Typically, to enable or disable the region.
|
||||
*/
|
||||
ServerCacheRegion region(String name);
|
||||
|
||||
@Deprecated
|
||||
default ServerCacheRegion getRegion(String name) {
|
||||
return region(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache for mapping natural keys to id values.
|
||||
*/
|
||||
ServerCache getNaturalKeyCache(Class<?> beanType);
|
||||
ServerCache naturalKeyCache(Class<?> beanType);
|
||||
|
||||
@Deprecated
|
||||
default ServerCache getNaturalKeyCache(Class<?> beanType) {
|
||||
return naturalKeyCache(beanType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache for beans of a particular type.
|
||||
*/
|
||||
ServerCache getBeanCache(Class<?> beanType);
|
||||
ServerCache beanCache(Class<?> beanType);
|
||||
|
||||
@Deprecated
|
||||
default ServerCache getBeanCache(Class<?> beanType) {
|
||||
return beanCache(beanType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache for associated many properties of a bean type.
|
||||
*/
|
||||
ServerCache getCollectionIdsCache(Class<?> beanType, String propertyName);
|
||||
ServerCache collectionIdsCache(Class<?> beanType, String propertyName);
|
||||
|
||||
@Deprecated
|
||||
default ServerCache getCollectionIdsCache(Class<?> beanType, String propertyName) {
|
||||
return collectionIdsCache(beanType, propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache for query results of a particular type of bean.
|
||||
*/
|
||||
ServerCache getQueryCache(Class<?> beanType);
|
||||
ServerCache queryCache(Class<?> beanType);
|
||||
|
||||
@Deprecated
|
||||
default ServerCache getQueryCache(Class<?> beanType) {
|
||||
return queryCache(beanType);
|
||||
}
|
||||
|
||||
/**
|
||||
* This clears both the bean and query cache for a given type.
|
||||
|
||||
@@ -18,7 +18,6 @@ public class ServerCacheOptions {
|
||||
* Construct with no set options.
|
||||
*/
|
||||
public ServerCacheOptions() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +72,6 @@ public class ServerCacheOptions {
|
||||
* Return a copy of this object.
|
||||
*/
|
||||
public ServerCacheOptions copy() {
|
||||
|
||||
ServerCacheOptions copy = new ServerCacheOptions();
|
||||
copy.maxSize = maxSize;
|
||||
copy.maxIdleSecs = maxIdleSecs;
|
||||
|
||||
@@ -8,7 +8,15 @@ public interface ServerCacheRegion {
|
||||
/**
|
||||
* Return the region name.
|
||||
*/
|
||||
String getName();
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to name().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the cache region is enabled.
|
||||
|
||||
@@ -63,7 +63,7 @@ abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
|
||||
*/
|
||||
AbstractBeanCollection(BeanCollectionLoader loader, EntityBean ownerBean, String propertyName) {
|
||||
this.loader = loader;
|
||||
this.ebeanServerName = loader.getName();
|
||||
this.ebeanServerName = loader.name();
|
||||
this.ownerBean = ownerBean;
|
||||
this.propertyName = propertyName;
|
||||
this.readOnly = ownerBean != null && ownerBean._ebean_getIntercept().isReadOnly();
|
||||
@@ -111,7 +111,7 @@ abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
|
||||
public void setLoader(BeanCollectionLoader loader) {
|
||||
this.registeredWithLoadContext = true;
|
||||
this.loader = loader;
|
||||
this.ebeanServerName = loader.getName();
|
||||
this.ebeanServerName = loader.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package io.ebean.config;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* Helper to find classes taking into account the context class loader.
|
||||
*/
|
||||
@@ -77,22 +72,14 @@ public class ClassLoadConfig {
|
||||
* Return a new instance of the class using the default constructor.
|
||||
*/
|
||||
public Object newInstance(String className) {
|
||||
|
||||
try {
|
||||
Class<?> cls = forName(className);
|
||||
return cls.newInstance();
|
||||
return cls.getDeclaredConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Error constructing " + className, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the resources for the given name.
|
||||
*/
|
||||
public Enumeration<URL> getResources(String name) throws IOException {
|
||||
return context.getResources(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given class is present.
|
||||
*/
|
||||
@@ -129,9 +116,7 @@ public class ClassLoadConfig {
|
||||
* Optional - if set only use this classLoader (no fallback).
|
||||
*/
|
||||
protected final ClassLoader preferredLoader;
|
||||
|
||||
protected final ClassLoader contextLoader;
|
||||
|
||||
protected final ClassLoader callerLoader;
|
||||
|
||||
ClassLoaderContext(ClassLoader preferredLoader) {
|
||||
@@ -145,15 +130,7 @@ public class ClassLoadConfig {
|
||||
return (loader != null) ? loader : callerLoader;
|
||||
}
|
||||
|
||||
Enumeration<URL> getResources(String name) throws IOException {
|
||||
if (preferredLoader != null) {
|
||||
return preferredLoader.getResources(name);
|
||||
}
|
||||
return contextLoader().getResources(name);
|
||||
}
|
||||
|
||||
Class<?> forName(String name) throws ClassNotFoundException {
|
||||
|
||||
if (preferredLoader != null) {
|
||||
// only use the explicitly set classLoader
|
||||
return classForName(name, preferredLoader);
|
||||
|
||||
@@ -2,11 +2,7 @@ package io.ebean.config;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import io.avaje.config.Config;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.EbeanVersion;
|
||||
import io.ebean.PersistenceContextScope;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.*;
|
||||
import io.ebean.annotation.*;
|
||||
import io.ebean.cache.ServerCachePlugin;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
@@ -14,14 +10,7 @@ import io.ebean.config.dbplatform.DbEncrypt;
|
||||
import io.ebean.config.dbplatform.DbType;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
import io.ebean.datasource.DataSourceConfig;
|
||||
import io.ebean.event.BeanFindController;
|
||||
import io.ebean.event.BeanPersistController;
|
||||
import io.ebean.event.BeanPersistListener;
|
||||
import io.ebean.event.BeanPostConstructListener;
|
||||
import io.ebean.event.BeanPostLoad;
|
||||
import io.ebean.event.BeanQueryAdapter;
|
||||
import io.ebean.event.BulkTableEventListener;
|
||||
import io.ebean.event.ServerConfigStartup;
|
||||
import io.ebean.event.*;
|
||||
import io.ebean.event.changelog.ChangeLogListener;
|
||||
import io.ebean.event.changelog.ChangeLogPrepare;
|
||||
import io.ebean.event.changelog.ChangeLogRegister;
|
||||
@@ -34,14 +23,7 @@ import javax.sql.DataSource;
|
||||
import java.time.Clock;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The configuration used for creating a Database.
|
||||
@@ -82,7 +64,6 @@ import java.util.ServiceLoader;
|
||||
*/
|
||||
public class DatabaseConfig {
|
||||
|
||||
|
||||
/**
|
||||
* The Database name.
|
||||
*/
|
||||
@@ -319,6 +300,8 @@ public class DatabaseConfig {
|
||||
*/
|
||||
private ExternalTransactionManager externalTransactionManager;
|
||||
|
||||
private boolean skipDataSourceCheck;
|
||||
|
||||
/**
|
||||
* The data source (if programmatically provided).
|
||||
*/
|
||||
@@ -400,8 +383,8 @@ public class DatabaseConfig {
|
||||
private List<BeanPostConstructListener> postConstructListeners = new ArrayList<>();
|
||||
private List<BeanPersistListener> persistListeners = new ArrayList<>();
|
||||
private List<BeanQueryAdapter> queryAdapters = new ArrayList<>();
|
||||
private List<BulkTableEventListener> bulkTableEventListeners = new ArrayList<>();
|
||||
private List<ServerConfigStartup> configStartupListeners = new ArrayList<>();
|
||||
private final List<BulkTableEventListener> bulkTableEventListeners = new ArrayList<>();
|
||||
private final List<ServerConfigStartup> configStartupListeners = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* By default inserts are included in the change log.
|
||||
@@ -409,42 +392,26 @@ public class DatabaseConfig {
|
||||
private boolean changeLogIncludeInserts = true;
|
||||
|
||||
private ChangeLogPrepare changeLogPrepare;
|
||||
|
||||
private ChangeLogListener changeLogListener;
|
||||
|
||||
private ChangeLogRegister changeLogRegister;
|
||||
|
||||
private boolean changeLogAsync = true;
|
||||
|
||||
private ReadAuditLogger readAuditLogger;
|
||||
|
||||
private ReadAuditPrepare readAuditPrepare;
|
||||
|
||||
private EncryptKeyManager encryptKeyManager;
|
||||
|
||||
private EncryptDeployManager encryptDeployManager;
|
||||
|
||||
private Encryptor encryptor;
|
||||
|
||||
private boolean dbOffline;
|
||||
|
||||
private DbEncrypt dbEncrypt;
|
||||
|
||||
private boolean dbOffline;
|
||||
private ServerCachePlugin serverCachePlugin;
|
||||
|
||||
/**
|
||||
* The default PersistenceContextScope used if one is not explicitly set on a query.
|
||||
*/
|
||||
private PersistenceContextScope persistenceContextScope = PersistenceContextScope.TRANSACTION;
|
||||
|
||||
private JsonFactory jsonFactory;
|
||||
|
||||
private boolean localTimeWithNanos;
|
||||
|
||||
private boolean durationWithNanos;
|
||||
|
||||
private int maxCallStack = 5;
|
||||
|
||||
private boolean transactionRollbackOnChecked = true;
|
||||
|
||||
// configuration for the background executor service (thread pool)
|
||||
@@ -1580,6 +1547,9 @@ public class DatabaseConfig {
|
||||
|
||||
/**
|
||||
* Set to true if all DB column and table names should use quoted identifiers.
|
||||
* <p>
|
||||
* For Postgres pgjdbc version 42.3.0 should be used with datasource property
|
||||
* <em>quoteReturningIdentifiers</em> set to <em>false</em> (refer #2303).
|
||||
*/
|
||||
public void setAllQuotedIdentifiers(boolean allQuotedIdentifiers) {
|
||||
platformConfig.setAllQuotedIdentifiers(allQuotedIdentifiers);
|
||||
@@ -1651,6 +1621,20 @@ public class DatabaseConfig {
|
||||
this.autoTuneConfig = autoTuneConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the startup DataSource check should be skipped.
|
||||
*/
|
||||
public boolean skipDataSourceCheck() {
|
||||
return skipDataSourceCheck;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to true to skip the startup DataSource check.
|
||||
*/
|
||||
public void setSkipDataSourceCheck(boolean skipDataSourceCheck) {
|
||||
this.skipDataSourceCheck = skipDataSourceCheck;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DataSource.
|
||||
*/
|
||||
@@ -2725,21 +2709,7 @@ public class DatabaseConfig {
|
||||
this.classLoadConfig = classLoadConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the service loader using the classLoader defined in ClassLoadConfig.
|
||||
*/
|
||||
public <T> ServiceLoader<T> serviceLoad(Class<T> spiService) {
|
||||
return ServiceLoader.load(spiService, classLoadConfig.getClassLoader());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first service using the service loader (or null).
|
||||
*/
|
||||
public <T> T service(Class<T> spiService) {
|
||||
ServiceLoader<T> load = serviceLoad(spiService);
|
||||
Iterator<T> serviceInstances = load.iterator();
|
||||
return serviceInstances.hasNext() ? serviceInstances.next() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load settings from application.properties, application.yaml and other sources.
|
||||
@@ -2778,7 +2748,7 @@ public class DatabaseConfig {
|
||||
*/
|
||||
private List<AutoConfigure> autoConfiguration() {
|
||||
List<AutoConfigure> list = new ArrayList<>();
|
||||
for (AutoConfigure autoConfigure : serviceLoad(AutoConfigure.class)) {
|
||||
for (AutoConfigure autoConfigure : ServiceLoader.load(AutoConfigure.class)) {
|
||||
autoConfigure.preConfigure(this);
|
||||
list.add(autoConfigure);
|
||||
}
|
||||
@@ -2932,6 +2902,7 @@ public class DatabaseConfig {
|
||||
jsonDate = p.getEnum(JsonConfig.Date.class, "jsonDate", jsonDate);
|
||||
jsonMutationDetection = p.getEnum(MutationDetection.class, "jsonMutationDetection", jsonMutationDetection);
|
||||
|
||||
skipDataSourceCheck = p.getBoolean("skipDataSourceCheck", skipDataSourceCheck);
|
||||
runMigration = p.getBoolean("migration.run", runMigration);
|
||||
ddlGenerate = p.getBoolean("ddl.generate", ddlGenerate);
|
||||
ddlRun = p.getBoolean("ddl.run", ddlRun);
|
||||
|
||||
@@ -117,6 +117,9 @@ public class PlatformConfig {
|
||||
|
||||
/**
|
||||
* Set to true if all DB column and table names should use quoted identifiers.
|
||||
* <p>
|
||||
* For Postgres pgjdbc version 42.3.0 should be used with datasource property
|
||||
* <em>quoteReturningIdentifiers</em> set to <em>false</em> (refer #2303).
|
||||
*/
|
||||
public void setAllQuotedIdentifiers(boolean allQuotedIdentifiers) {
|
||||
this.allQuotedIdentifiers = allQuotedIdentifiers;
|
||||
@@ -375,7 +378,7 @@ public class PlatformConfig {
|
||||
BINARY(false, true, false),
|
||||
|
||||
/**
|
||||
* Store using DB BINARY(16).
|
||||
* Store using DB BINARY(16) with optimized packing.
|
||||
*/
|
||||
BINARY_OPTIMIZED(false, true, true);
|
||||
|
||||
|
||||
@@ -21,6 +21,14 @@ public class QueryPlanCapture {
|
||||
/**
|
||||
* Return the database the plans were captured for.
|
||||
*/
|
||||
public Database database() {
|
||||
return database;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to database().
|
||||
*/
|
||||
@Deprecated
|
||||
public Database getDatabase() {
|
||||
return database;
|
||||
}
|
||||
@@ -28,6 +36,14 @@ public class QueryPlanCapture {
|
||||
/**
|
||||
* Return the captured query plans.
|
||||
*/
|
||||
public List<MetaQueryPlan> plans() {
|
||||
return plans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to plans().
|
||||
*/
|
||||
@Deprecated
|
||||
public List<MetaQueryPlan> getPlans() {
|
||||
return plans;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.sql.Types;
|
||||
*/
|
||||
public class DatabasePlatform {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DatabasePlatform.class);
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
|
||||
/**
|
||||
* Behavior used when ending a query only transaction (at read committed isolation level).
|
||||
@@ -640,7 +640,7 @@ public class DatabasePlatform {
|
||||
if (dbName.charAt(dbName.length() - 1) == BACK_TICK) {
|
||||
return openQuote + dbName.substring(1, dbName.length() - 1) + closeQuote;
|
||||
} else {
|
||||
logger.error("Missing backquote on [" + dbName + "]");
|
||||
log.error("Missing backquote on [" + dbName + "]");
|
||||
}
|
||||
} else if (allQuotedIdentifiers) {
|
||||
return openQuote + dbName + closeQuote;
|
||||
@@ -694,7 +694,7 @@ public class DatabasePlatform {
|
||||
|
||||
protected String withForUpdate(String sql, Query.LockWait lockWait, Query.LockType lockType) {
|
||||
// silently assume the database does not support the "for update" clause.
|
||||
logger.info("it seems your database does not support the 'for update' clause");
|
||||
log.info("it seems your database does not support the 'for update' clause");
|
||||
return sql;
|
||||
}
|
||||
|
||||
@@ -728,7 +728,7 @@ public class DatabasePlatform {
|
||||
if (!schemaExists(dbSchema, connection)) {
|
||||
Statement query = connection.createStatement();
|
||||
try {
|
||||
logger.info("create schema:{}", dbSchema);
|
||||
log.debug("create schema:{}", dbSchema);
|
||||
query.executeUpdate("create schema " + dbSchema);
|
||||
} finally {
|
||||
JdbcClose.close(query);
|
||||
@@ -758,7 +758,6 @@ public class DatabasePlatform {
|
||||
* Return true if the table exists.
|
||||
*/
|
||||
public boolean tableExists(Connection connection, String catalog, String schema, String table) throws SQLException {
|
||||
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
ResultSet tables = metaData.getTables(catalog, schema, table, null);
|
||||
try {
|
||||
|
||||
@@ -70,7 +70,6 @@ public class DbPlatformTypeMapping {
|
||||
* Load the standard types. These can be overridden by DB specific platform.
|
||||
*/
|
||||
private void loadDefaults(boolean logicalTypes) {
|
||||
|
||||
put(DbType.BOOLEAN, BOOLEAN_LOGICAL);
|
||||
put(DbType.BIT);
|
||||
put(DbType.INTEGER);
|
||||
@@ -88,7 +87,6 @@ public class DbPlatformTypeMapping {
|
||||
put(DbType.LONGVARCHAR);
|
||||
// most commonly real maps to db float
|
||||
put(DbType.REAL, new DbPlatformType("float"));
|
||||
|
||||
put(DbType.POINT, POINT);
|
||||
put(DbType.POLYGON, POLYGON);
|
||||
put(DbType.LINESTRING, LINESTRING);
|
||||
@@ -103,7 +101,7 @@ public class DbPlatformTypeMapping {
|
||||
put(DbType.VARBINARY, new DbPlatformType("varbinary"));
|
||||
put(DbType.BINARY, new DbPlatformType("binary"));
|
||||
put(DbType.CHAR, new DbPlatformType("char"));
|
||||
|
||||
put(DbType.LOCALDATETIME, new DbPlatformType("localdatetime", false));
|
||||
put(DbType.HSTORE, new DbPlatformType("hstore", false));
|
||||
put(DbType.JSON, new DbPlatformType("json", false));
|
||||
put(DbType.JSONB, new DbPlatformType("jsonb", false));
|
||||
@@ -120,7 +118,7 @@ public class DbPlatformTypeMapping {
|
||||
put(DbType.VARBINARY, new DbPlatformType("varbinary", 255));
|
||||
put(DbType.BINARY, new DbPlatformType("binary", 255));
|
||||
put(DbType.CHAR, new DbPlatformType("char", 1));
|
||||
|
||||
put(DbType.LOCALDATETIME, DbType.TIMESTAMP.createPlatformType());
|
||||
put(DbType.JSON, JSON_CLOB_PLACEHOLDER); // Postgres maps this to JSON
|
||||
put(DbType.JSONB, JSON_CLOB_PLACEHOLDER); // Postgres maps this to JSONB
|
||||
put(DbType.JSONCLOB, JSON_CLOB_PLACEHOLDER);
|
||||
@@ -137,7 +135,6 @@ public class DbPlatformTypeMapping {
|
||||
* Lookup the platform specific DbType given the standard sql type name.
|
||||
*/
|
||||
public DbPlatformType lookup(String name, boolean withScale) {
|
||||
|
||||
DbType type = lookup.byName(name);
|
||||
if (type == null) {
|
||||
throw new IllegalArgumentException("Unknown type [" + name + "] - not standard sql type");
|
||||
@@ -160,7 +157,6 @@ public class DbPlatformTypeMapping {
|
||||
}
|
||||
|
||||
private DbPlatformType getJsonType(DbType type, boolean withScale) {
|
||||
|
||||
DbPlatformType dbType = get(type);
|
||||
if (dbType == JSON_CLOB_PLACEHOLDER) {
|
||||
// if we have scale that implies this maps to varchar
|
||||
|
||||
@@ -34,6 +34,7 @@ public enum DbType {
|
||||
|
||||
ARRAY(Types.ARRAY),
|
||||
|
||||
LOCALDATETIME(ExtraDbTypes.LOCALDATETIME),
|
||||
UUID(ExtraDbTypes.UUID),
|
||||
INET(ExtraDbTypes.INET),
|
||||
CIDR(ExtraDbTypes.CIDR),
|
||||
|
||||
@@ -5,11 +5,6 @@ package io.ebean.config.dbplatform;
|
||||
*/
|
||||
public interface ExtraDbTypes {
|
||||
|
||||
/**
|
||||
* DB native UUID type (H2 and Postgres).
|
||||
*/
|
||||
int UUID = 5010;
|
||||
|
||||
/**
|
||||
* Type to map Map content to Postgres HSTORE.
|
||||
*/
|
||||
@@ -40,6 +35,12 @@ public interface ExtraDbTypes {
|
||||
*/
|
||||
int JSONBlob = 5005;
|
||||
|
||||
int LOCALDATETIME = 5009;
|
||||
|
||||
/**
|
||||
* DB native UUID type (H2 and Postgres).
|
||||
*/
|
||||
int UUID = 5010;
|
||||
int INET = 5020;
|
||||
int CIDR = 5021;
|
||||
|
||||
|
||||
@@ -24,23 +24,14 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
*/
|
||||
public abstract class SequenceIdGenerator implements PlatformIdGenerator {
|
||||
|
||||
protected static final Logger logger = LoggerFactory.getLogger("io.ebean.SEQ");
|
||||
protected static final Logger log = LoggerFactory.getLogger("io.ebean.SEQ");
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
/**
|
||||
* The actual sequence name.
|
||||
*/
|
||||
protected final String seqName;
|
||||
|
||||
protected final DataSource dataSource;
|
||||
|
||||
protected final BackgroundExecutor backgroundExecutor;
|
||||
|
||||
protected final NavigableSet<Long> idList = new TreeSet<>();
|
||||
|
||||
protected final int allocationSize;
|
||||
|
||||
protected AtomicBoolean currentlyBackgroundLoading = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
@@ -129,7 +120,7 @@ public abstract class SequenceIdGenerator implements PlatformIdGenerator {
|
||||
protected void loadInBackground(final int requestSize) {
|
||||
if (currentlyBackgroundLoading.get()) {
|
||||
// skip as already background loading
|
||||
logger.debug("... skip background sequence load (another load in progress)");
|
||||
log.debug("... skip background sequence load (another load in progress)");
|
||||
return;
|
||||
}
|
||||
currentlyBackgroundLoading.set(true);
|
||||
@@ -161,8 +152,8 @@ public abstract class SequenceIdGenerator implements PlatformIdGenerator {
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
List<Long> newIds = readIds(resultSet, requestSize);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("seq:{} loaded:{} sql:{}", seqName, newIds.size(), sql);
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("seq:{} loaded:{} sql:{}", seqName, newIds.size(), sql);
|
||||
}
|
||||
if (newIds.isEmpty()) {
|
||||
throw new PersistenceException("Always expecting more than 1 row from " + sql);
|
||||
@@ -173,7 +164,7 @@ public abstract class SequenceIdGenerator implements PlatformIdGenerator {
|
||||
} catch (SQLException e) {
|
||||
if (e.getMessage().contains("Database is already closed")) {
|
||||
String msg = "Error getting SEQ when DB shutting down " + e.getMessage();
|
||||
logger.error(msg);
|
||||
log.error(msg);
|
||||
System.out.println(msg);
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
|
||||
@@ -2,8 +2,6 @@ package io.ebean.config.dbplatform;
|
||||
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.util.JdbcClose;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
@@ -20,12 +18,8 @@ import java.sql.SQLException;
|
||||
*/
|
||||
public class SimpleSequenceIdGenerator implements PlatformIdGenerator {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SimpleSequenceIdGenerator.class);
|
||||
|
||||
private final String sql;
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
private final String seqName;
|
||||
|
||||
/**
|
||||
@@ -61,7 +55,7 @@ public class SimpleSequenceIdGenerator implements PlatformIdGenerator {
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rset = null;
|
||||
try {
|
||||
c = useTxnConnection ? t.getConnection() : dataSource.getConnection();
|
||||
c = useTxnConnection ? t.connection() : dataSource.getConnection();
|
||||
pstmt = c.prepareStatement(sql);
|
||||
rset = pstmt.executeQuery();
|
||||
if (rset.next()) {
|
||||
|
||||
+1
-4
@@ -26,7 +26,6 @@ public class ClickHousePlatform extends DatabasePlatform {
|
||||
|
||||
this.booleanDbType = Types.INTEGER;
|
||||
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("UInt8"));
|
||||
|
||||
// using unsigned as default types ...
|
||||
dbTypeMap.put(DbType.TINYINT, new DbPlatformType("UInt8", false));
|
||||
dbTypeMap.put(DbType.SMALLINT, new DbPlatformType("UInt16", false));
|
||||
@@ -34,15 +33,13 @@ public class ClickHousePlatform extends DatabasePlatform {
|
||||
dbTypeMap.put(DbType.BIGINT, new DbPlatformType("UInt64", false));
|
||||
dbTypeMap.put(DbType.DECIMAL, new DbPlatformType("Decimal", 16, 3));
|
||||
dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("Float64", false));
|
||||
|
||||
dbTypeMap.put(DbType.DATE, new DbPlatformType("Date", false));
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("DateTime", false));
|
||||
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("DateTime", false));
|
||||
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.CLOB, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.JSONVARCHAR, new DbPlatformType("String", false));
|
||||
|
||||
dbTypeMap.put(DbType.UUID, new DbPlatformType("UUID", false));
|
||||
dbTypeMap.put(DbType.INET, new DbPlatformType("String", false));
|
||||
dbTypeMap.put(DbType.CIDR, new DbPlatformType("String", false));
|
||||
|
||||
@@ -20,6 +20,8 @@ public class DB2Platform extends DatabasePlatform {
|
||||
public DB2Platform() {
|
||||
super();
|
||||
this.platform = Platform.DB2;
|
||||
// Note: DB2 (at least LUW supports length up to 128)
|
||||
// TOOD: Check if we need to introduce a new platform (DB2_LUW_11 ?)
|
||||
this.maxTableNameLength = 18;
|
||||
this.maxConstraintNameLength = 18;
|
||||
this.truncateTable = "truncate table %s reuse storage ignore delete triggers immediate";
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Arrays;
|
||||
*/
|
||||
public class H2HistoryTrigger implements Trigger {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(H2HistoryTrigger.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(H2HistoryTrigger.class);
|
||||
|
||||
/**
|
||||
* Hardcoding the column and history table suffix for now. Not sure how to get that
|
||||
@@ -69,7 +69,7 @@ public class H2HistoryTrigger implements Trigger {
|
||||
insertSql.append(");");
|
||||
|
||||
this.insertHistorySql = insertSql.toString();
|
||||
logger.debug("History table insert sql: {}", insertHistorySql);
|
||||
log.debug("History table insert sql: {}", insertHistorySql);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,8 +82,8 @@ public class H2HistoryTrigger implements Trigger {
|
||||
// update event. Set the effective start timestamp to now.
|
||||
newRow[effectStartPosition] = now;
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("History insert: {}", Arrays.toString(oldRow));
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("History insert: {}", Arrays.toString(oldRow));
|
||||
}
|
||||
insertIntoHistory(connection, oldRow);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public abstract class BaseMySqlPlatform extends DatabasePlatform {
|
||||
dbTypeMap.put(DbType.BIT, new DbPlatformType("tinyint(1)"));
|
||||
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("tinyint(1)"));
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime(6)"));
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime(6)"));
|
||||
dbTypeMap.put(DbType.CLOB, new MySqlClob());
|
||||
dbTypeMap.put(DbType.BLOB, new MySqlBlob());
|
||||
dbTypeMap.put(DbType.BINARY, new DbPlatformType("binary", 255));
|
||||
|
||||
@@ -10,5 +10,6 @@ public class MySql55Platform extends BaseMySqlPlatform {
|
||||
super();
|
||||
this.platform = Platform.MYSQL55;
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime"));
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,22 +69,19 @@ public class PostgresPlatform extends DatabasePlatform {
|
||||
|
||||
DbPlatformType dbTypeText = new DbPlatformType("text", false);
|
||||
DbPlatformType dbBytea = new DbPlatformType("bytea", false);
|
||||
|
||||
dbTypeMap.put(DbType.UUID, new DbPlatformType("uuid", false));
|
||||
dbTypeMap.put(DbType.INET, new DbPlatformType("inet", false));
|
||||
dbTypeMap.put(DbType.CIDR, new DbPlatformType("cidr", false));
|
||||
dbTypeMap.put(DbType.HSTORE, new DbPlatformType("hstore", false));
|
||||
dbTypeMap.put(DbType.JSON, new DbPlatformType("json", false));
|
||||
dbTypeMap.put(DbType.JSONB, new DbPlatformType("jsonb", false));
|
||||
|
||||
dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false));
|
||||
dbTypeMap.put(DbType.DOUBLE, new DbPlatformType("float"));
|
||||
dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint"));
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("timestamptz"));
|
||||
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("timestamp"));
|
||||
dbTypeMap.put(DbType.BINARY, dbBytea);
|
||||
dbTypeMap.put(DbType.VARBINARY, dbBytea);
|
||||
|
||||
dbTypeMap.put(DbType.BLOB, dbBytea);
|
||||
dbTypeMap.put(DbType.CLOB, dbTypeText);
|
||||
dbTypeMap.put(DbType.LONGVARBINARY, dbBytea);
|
||||
|
||||
@@ -24,6 +24,7 @@ public class SQLitePlatform extends DatabasePlatform {
|
||||
this.dbDefaultValue.setFalse("0");
|
||||
this.dbDefaultValue.setTrue("1");
|
||||
this.dbDefaultValue.setNow("CURRENT_TIMESTAMP");
|
||||
this.supportsResultSetConcurrencyModeUpdatable = false;
|
||||
|
||||
dbTypeMap.put(DbType.BIT, new DbPlatformType("int"));
|
||||
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("int"));
|
||||
|
||||
@@ -21,6 +21,8 @@ public class SqlServer16Platform extends SqlServerBasePlatform {
|
||||
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("varchar", 255));
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("text"));
|
||||
dbTypeMap.put(DbType.CLOB, new DbPlatformType("text"));
|
||||
dbTypeMap.put(DbType.JSON, new DbPlatformType("text"));
|
||||
dbTypeMap.put(DbType.JSONB, new DbPlatformType("text"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-4
@@ -57,7 +57,6 @@ abstract class SqlServerBasePlatform extends DatabasePlatform {
|
||||
this.dbDefaultValue.setTrue("1");
|
||||
this.dbDefaultValue.setNow("SYSUTCDATETIME()");
|
||||
dbTypeMap.put(DbType.BOOLEAN, new DbPlatformType("bit"));
|
||||
|
||||
dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false));
|
||||
dbTypeMap.put(DbType.BIGINT, new DbPlatformType("numeric", 19));
|
||||
dbTypeMap.put(DbType.REAL, new DbPlatformType("float(16)"));
|
||||
@@ -67,16 +66,14 @@ abstract class SqlServerBasePlatform extends DatabasePlatform {
|
||||
dbTypeMap.put(DbType.DATE, new DbPlatformType("date"));
|
||||
dbTypeMap.put(DbType.TIME, new DbPlatformType("time"));
|
||||
dbTypeMap.put(DbType.TIMESTAMP, new DbPlatformType("datetime2"));
|
||||
|
||||
dbTypeMap.put(DbType.LOCALDATETIME, new DbPlatformType("datetime2"));
|
||||
// UTF8 aware types - overwritten in SqlServer16 platform
|
||||
dbTypeMap.put(DbType.CHAR, new DbPlatformType("nchar", 1));
|
||||
dbTypeMap.put(DbType.VARCHAR, new DbPlatformType("nvarchar", 255));
|
||||
dbTypeMap.put(DbType.LONGVARCHAR, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
dbTypeMap.put(DbType.CLOB, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
|
||||
dbTypeMap.put(DbType.JSON, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
dbTypeMap.put(DbType.JSONB, new DbPlatformType("nvarchar", Integer.MAX_VALUE));
|
||||
|
||||
dbTypeMap.put(DbType.BLOB, new DbPlatformType("image"));
|
||||
dbTypeMap.put(DbType.LONGVARBINARY, new DbPlatformType("image"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.ebean.event;
|
||||
|
||||
import io.ebean.Database;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Transaction;
|
||||
|
||||
@@ -9,18 +10,62 @@ import io.ebean.Transaction;
|
||||
public interface BeanDeleteIdRequest {
|
||||
|
||||
/**
|
||||
* Return the server processing the request.
|
||||
* Deprecated migrate to database().
|
||||
*/
|
||||
@Deprecated
|
||||
EbeanServer getEbeanServer();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to database().
|
||||
*/
|
||||
@Deprecated
|
||||
default Database getDatabase() {
|
||||
return getEbeanServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DB processing the request.
|
||||
*/
|
||||
default Database database() {
|
||||
return getEbeanServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Transaction associated with this request.
|
||||
*/
|
||||
Transaction getTransaction();
|
||||
Transaction transaction();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to transaction().
|
||||
*/
|
||||
@Deprecated
|
||||
default Transaction getTransaction() {
|
||||
return transaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bean type of the bean being deleted.
|
||||
*/
|
||||
Class<?> beanType();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanType().
|
||||
*/
|
||||
@Deprecated
|
||||
default Class<?> getBeanType() {
|
||||
return beanType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Id value of the bean being deleted.
|
||||
*/
|
||||
Object getId();
|
||||
Object id();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to id().
|
||||
*/
|
||||
@Deprecated
|
||||
default Object getId() {
|
||||
return id();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,17 @@ public interface BeanFindController {
|
||||
*/
|
||||
<T> BeanCollection<T> findMany(BeanQueryRequest<T> request);
|
||||
|
||||
/**
|
||||
* Allows post-processing of the find result.
|
||||
*/
|
||||
default <T> BeanCollection<T> postProcessMany(BeanQueryRequest<T> request, BeanCollection<T> result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows post-processing of the find result.
|
||||
*/
|
||||
default <T> T postProcess(BeanQueryRequest<T> request, T result) {
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.ebean.event;
|
||||
|
||||
import io.ebean.Database;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.ValuePair;
|
||||
@@ -17,20 +18,50 @@ import java.util.Set;
|
||||
public interface BeanPersistRequest<T> {
|
||||
|
||||
/**
|
||||
* Return the server processing the request.
|
||||
* Return the DB processing the request.
|
||||
*/
|
||||
default Database database() {
|
||||
return getEbeanServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to database().
|
||||
*/
|
||||
@Deprecated
|
||||
EbeanServer getEbeanServer();
|
||||
|
||||
/**
|
||||
* Return the Transaction associated with this request.
|
||||
*/
|
||||
Transaction getTransaction();
|
||||
Transaction transaction();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to transaction().
|
||||
*/
|
||||
@Deprecated
|
||||
default Transaction getTransaction() {
|
||||
return transaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this request is due to cascading persist.
|
||||
* False implies this is a "top level" request.
|
||||
*/
|
||||
boolean isCascade();
|
||||
|
||||
/**
|
||||
* For an update or delete of a partially populated bean this is the set of
|
||||
* loaded properties and otherwise returns null.
|
||||
*/
|
||||
Set<String> getLoadedProperties();
|
||||
Set<String> loadedProperties();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to loadedProperties().
|
||||
*/
|
||||
@Deprecated
|
||||
default Set<String> getLoadedProperties() {
|
||||
return loadedProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* For an update this is the set of properties that where updated.
|
||||
@@ -39,12 +70,28 @@ public interface BeanPersistRequest<T> {
|
||||
* should be preferred if it satisfies the requirement.
|
||||
* </p>
|
||||
*/
|
||||
Set<String> getUpdatedProperties();
|
||||
Set<String> updatedProperties();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to updatedProperties().
|
||||
*/
|
||||
@Deprecated
|
||||
default Set<String> getUpdatedProperties() {
|
||||
return updatedProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Flags set for dirty properties (used by ElasticSearch integration).
|
||||
*/
|
||||
boolean[] getDirtyProperties();
|
||||
boolean[] dirtyProperties();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to updatedProperties().
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean[] getDirtyProperties() {
|
||||
return dirtyProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true for an update request if at least one of dirty properties is contained
|
||||
@@ -66,11 +113,27 @@ public interface BeanPersistRequest<T> {
|
||||
/**
|
||||
* Returns the bean being inserted updated or deleted.
|
||||
*/
|
||||
T getBean();
|
||||
T bean();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to bean().
|
||||
*/
|
||||
@Deprecated
|
||||
default T getBean() {
|
||||
return bean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of the properties that have changed and their new and old values.
|
||||
*/
|
||||
Map<String, ValuePair> getUpdatedValues();
|
||||
Map<String, ValuePair> updatedValues();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to updatedValues().
|
||||
*/
|
||||
@Deprecated
|
||||
default Map<String, ValuePair> getUpdatedValues() {
|
||||
return updatedValues();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.ebean.event;
|
||||
|
||||
import io.ebean.Database;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.Transaction;
|
||||
@@ -10,19 +11,43 @@ import io.ebean.Transaction;
|
||||
public interface BeanQueryRequest<T> {
|
||||
|
||||
/**
|
||||
* Return the server processing the request.
|
||||
* Return the DB processing the request.
|
||||
*/
|
||||
default Database database() {
|
||||
return getEbeanServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to database().
|
||||
*/
|
||||
@Deprecated
|
||||
EbeanServer getEbeanServer();
|
||||
|
||||
/**
|
||||
* Return the Transaction associated with this request.
|
||||
*/
|
||||
Transaction getTransaction();
|
||||
Transaction transaction();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to transaction().
|
||||
*/
|
||||
@Deprecated
|
||||
default Transaction getTransaction() {
|
||||
return transaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the query.
|
||||
*/
|
||||
Query<T> getQuery();
|
||||
Query<T> query();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to query().
|
||||
*/
|
||||
@Deprecated
|
||||
default Query<T> getQuery() {
|
||||
return query();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if an Id IN expression should have the bind parameters padded.
|
||||
|
||||
@@ -8,7 +8,15 @@ public interface BulkTableEvent {
|
||||
/**
|
||||
* Return the name of the table that was involved.
|
||||
*/
|
||||
String getTableName();
|
||||
String tableName();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to tableName().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getTableName() {
|
||||
return tableName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if rows were inserted.
|
||||
|
||||
@@ -14,25 +14,19 @@ import java.util.List;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* Manages the shutdown of the JVM Runtime.
|
||||
* Manages the shutdown of Ebean.
|
||||
* <p>
|
||||
* Makes sure all the resources are shutdown properly and in order.
|
||||
* </p>
|
||||
*/
|
||||
public final class ShutdownManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ShutdownManager.class);
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
private static final ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
private static final List<Database> databases = new ArrayList<>();
|
||||
|
||||
private static final ShutdownHook shutdownHook = new ShutdownHook();
|
||||
|
||||
private static boolean stopping;
|
||||
|
||||
private static SpiContainer container;
|
||||
|
||||
static {
|
||||
// Register the Shutdown hook
|
||||
registerShutdownHook();
|
||||
@@ -44,6 +38,9 @@ public final class ShutdownManager {
|
||||
private ShutdownManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the container (potentially with cluster management).
|
||||
*/
|
||||
public static void registerContainer(SpiContainer ebeanContainer) {
|
||||
container = ebeanContainer;
|
||||
}
|
||||
@@ -94,7 +91,7 @@ public final class ShutdownManager {
|
||||
/**
|
||||
* Register the shutdown hook with the Runtime.
|
||||
*/
|
||||
protected static void registerShutdownHook() {
|
||||
private static void registerShutdownHook() {
|
||||
lock.lock();
|
||||
try {
|
||||
String value = System.getProperty("ebean.registerShutdownHook");
|
||||
@@ -123,13 +120,10 @@ public final class ShutdownManager {
|
||||
// Already run shutdown...
|
||||
return;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Shutting down");
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Ebean shutting down");
|
||||
}
|
||||
|
||||
stopping = true;
|
||||
|
||||
deregisterShutdownHook();
|
||||
|
||||
String shutdownRunner = System.getProperty("ebean.shutdown.runnable");
|
||||
@@ -139,7 +133,7 @@ public final class ShutdownManager {
|
||||
Runnable r = (Runnable) ClassUtil.newInstance(shutdownRunner);
|
||||
r.run();
|
||||
} catch (Exception e) {
|
||||
logger.error("Error running custom shutdown runnable", e);
|
||||
log.error("Error running custom shutdown runnable", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,18 +141,16 @@ public final class ShutdownManager {
|
||||
// shutdown cluster networking if active
|
||||
container.shutdown();
|
||||
}
|
||||
|
||||
// shutdown any registered servers that have not
|
||||
// already been shutdown manually
|
||||
for (Database server : databases) {
|
||||
try {
|
||||
server.shutdown();
|
||||
} catch (Exception ex) {
|
||||
logger.error("Error executing shutdown runnable", ex);
|
||||
log.error("Error executing shutdown runnable", ex);
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if ("true".equalsIgnoreCase(System.getProperty("ebean.datasource.deregisterAllDrivers", "false"))) {
|
||||
deregisterAllJdbcDrivers();
|
||||
}
|
||||
@@ -168,15 +160,15 @@ public final class ShutdownManager {
|
||||
}
|
||||
|
||||
private static void deregisterAllJdbcDrivers() {
|
||||
// This manually deregisters all JDBC drivers
|
||||
// This manually de-registers all JDBC drivers
|
||||
Enumeration<Driver> drivers = DriverManager.getDrivers();
|
||||
while (drivers.hasMoreElements()) {
|
||||
Driver driver = drivers.nextElement();
|
||||
try {
|
||||
logger.info("Deregistering jdbc driver: " + driver);
|
||||
log.info("De-registering jdbc driver: " + driver);
|
||||
DriverManager.deregisterDriver(driver);
|
||||
} catch (SQLException e) {
|
||||
logger.error("Error deregistering driver " + driver, e);
|
||||
log.error("Error de-registering driver " + driver, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,6 +201,9 @@ public final class ShutdownManager {
|
||||
}
|
||||
|
||||
private static class ShutdownHook extends Thread {
|
||||
private ShutdownHook() {
|
||||
super("EbeanHook");
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
ShutdownManager.shutdown();
|
||||
|
||||
@@ -45,15 +45,8 @@ public interface MetaQueryMetric extends MetaTimedMetric {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the hash of the sql.
|
||||
* Return the hash of the plan.
|
||||
*/
|
||||
long sqlHash();
|
||||
String hash();
|
||||
|
||||
/**
|
||||
* Migrate to sqlHash().
|
||||
*/
|
||||
@Deprecated
|
||||
default long getSqlHash() {
|
||||
return sqlHash();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface MetaQueryPlan {
|
||||
/**
|
||||
* Return the hash of the plan.
|
||||
*/
|
||||
long sqlHash();
|
||||
String hash();
|
||||
|
||||
/**
|
||||
* Return a description of the bind values.
|
||||
|
||||
@@ -6,14 +6,6 @@ package io.ebean.meta;
|
||||
*/
|
||||
public interface MetaTimedMetric extends MetaMetric {
|
||||
|
||||
/**
|
||||
* Return the metric location hash if defined.
|
||||
* <p>
|
||||
* This hash excludes line number with the intention of being stable over time
|
||||
* as code changes move the source line (but the method is the same).
|
||||
*/
|
||||
long locationHash();
|
||||
|
||||
/**
|
||||
* Return the metric location if defined.
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@ package io.ebean.meta;
|
||||
public class MetricData {
|
||||
|
||||
private String name;
|
||||
private long sqlHash;
|
||||
private String hash;
|
||||
private String loc;
|
||||
private String sql;
|
||||
|
||||
@@ -14,7 +14,6 @@ public class MetricData {
|
||||
private Long mean;
|
||||
private Long max;
|
||||
private Long total;
|
||||
private long locHash;
|
||||
|
||||
public MetricData(String name) {
|
||||
this.name = name;
|
||||
@@ -31,20 +30,12 @@ public class MetricData {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public long getSqlHash() {
|
||||
return sqlHash;
|
||||
public String getHash() {
|
||||
return hash;
|
||||
}
|
||||
|
||||
public void setSqlHash(long sqlHash) {
|
||||
this.sqlHash = sqlHash;
|
||||
}
|
||||
|
||||
public void setLocHash(long locHash) {
|
||||
this.locHash = locHash;
|
||||
}
|
||||
|
||||
public long getLocHash() {
|
||||
return locHash;
|
||||
public void setHash(String hash) {
|
||||
this.hash = hash;
|
||||
}
|
||||
|
||||
public String getLoc() {
|
||||
|
||||
@@ -10,7 +10,7 @@ public class QueryPlanInit {
|
||||
|
||||
private boolean all;
|
||||
|
||||
private Set<Long> hashes = new HashSet<>();
|
||||
private Set<String> hashes = new HashSet<>();
|
||||
|
||||
private long thresholdMicros;
|
||||
|
||||
@@ -47,21 +47,21 @@ public class QueryPlanInit {
|
||||
/**
|
||||
* Return true if the query plan should be initiated based on it's hash.
|
||||
*/
|
||||
public boolean includeHash(long sqlHash) {
|
||||
return all || hashes.contains(sqlHash);
|
||||
public boolean includeHash(String hash) {
|
||||
return all || hashes.contains(hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the specific hashes that we want to collect query plans on.
|
||||
*/
|
||||
public Set<Long> sqlHashes() {
|
||||
public Set<String> hashes() {
|
||||
return hashes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the specific hashes that we want to collect query plans on.
|
||||
*/
|
||||
public void sqlHashes(Set<Long> hashes) {
|
||||
public void hashes(Set<String> hashes) {
|
||||
this.hashes = hashes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,15 @@ public interface QueryPlanMetric {
|
||||
/**
|
||||
* Return the underlying timed metric.
|
||||
*/
|
||||
TimedMetric getMetric();
|
||||
TimedMetric metric();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to metric().
|
||||
*/
|
||||
@Deprecated
|
||||
default TimedMetric getMetric() {
|
||||
return metric();
|
||||
}
|
||||
|
||||
/**
|
||||
* Visit the underlying metric.
|
||||
|
||||
@@ -12,11 +12,6 @@ public interface TimedMetricStats extends MetaTimedMetric {
|
||||
*/
|
||||
void setLocation(String location);
|
||||
|
||||
/**
|
||||
* Additionally set the location hash.
|
||||
*/
|
||||
void setLocationHash(long locationHash);
|
||||
|
||||
/**
|
||||
* Override the name based on profile location.
|
||||
*/
|
||||
|
||||
@@ -16,11 +16,27 @@ public interface BeanDocType<T> {
|
||||
/**
|
||||
* Return the doc store index type for this bean type.
|
||||
*/
|
||||
default String indexType() {
|
||||
return getIndexType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to indexType().
|
||||
*/
|
||||
@Deprecated
|
||||
String getIndexType();
|
||||
|
||||
/**
|
||||
* Return the doc store index name for this bean type.
|
||||
*/
|
||||
default String indexName() {
|
||||
return getIndexName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to indexName().
|
||||
*/
|
||||
@Deprecated
|
||||
String getIndexName();
|
||||
|
||||
/**
|
||||
@@ -32,12 +48,28 @@ public interface BeanDocType<T> {
|
||||
/**
|
||||
* Return the FetchPath for the embedded document.
|
||||
*/
|
||||
default FetchPath embedded(String path) {
|
||||
return getEmbedded(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to embedded().
|
||||
*/
|
||||
@Deprecated
|
||||
FetchPath getEmbedded(String path);
|
||||
|
||||
/**
|
||||
* For embedded 'many' properties we need a FetchPath relative to the root which is used to
|
||||
* build and replace the embedded list.
|
||||
*/
|
||||
default FetchPath embeddedManyRoot(String path) {
|
||||
return getEmbeddedManyRoot(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to embeddedManyRoot().
|
||||
*/
|
||||
@Deprecated
|
||||
FetchPath getEmbeddedManyRoot(String path);
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,6 @@ import io.ebean.event.BeanPersistController;
|
||||
import io.ebean.event.BeanPersistListener;
|
||||
import io.ebean.event.BeanQueryAdapter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
@@ -21,51 +20,111 @@ public interface BeanType<T> {
|
||||
/**
|
||||
* Return the short name of the bean type.
|
||||
*/
|
||||
@Nonnull
|
||||
String getName();
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to name().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the full name of the bean type.
|
||||
*/
|
||||
@Nonnull
|
||||
String getFullName();
|
||||
String fullName();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to fullName().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getFullName() {
|
||||
return fullName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class type this BeanDescriptor describes.
|
||||
*/
|
||||
@Nonnull
|
||||
Class<T> getBeanType();
|
||||
Class<T> type();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to type().
|
||||
*/
|
||||
@Deprecated
|
||||
default Class<T> getBeanType() {
|
||||
return type();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type bean for an OneToMany or ManyToOne or ManyToMany property.
|
||||
*/
|
||||
BeanType<?> getBeanTypeAtPath(String propertyName);
|
||||
BeanType<?> beanTypeAtPath(String propertyName);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanTypeAtPath().
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanType<?> getBeanTypeAtPath(String propertyName) {
|
||||
return beanTypeAtPath(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the properties for this bean type.
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<? extends Property> allProperties();
|
||||
|
||||
/**
|
||||
* Return the Id property.
|
||||
*/
|
||||
Property getIdProperty();
|
||||
Property idProperty();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to idProperty().
|
||||
*/
|
||||
@Deprecated
|
||||
default Property getIdProperty() {
|
||||
return idProperty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the when modified property if there is one defined.
|
||||
*/
|
||||
Property getWhenModifiedProperty();
|
||||
Property whenModifiedProperty();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to idProperty().
|
||||
*/
|
||||
@Deprecated
|
||||
default Property getWhenModifiedProperty() {
|
||||
return whenModifiedProperty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the when created property if there is one defined.
|
||||
*/
|
||||
Property getWhenCreatedProperty();
|
||||
Property whenCreatedProperty();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to idProperty().
|
||||
*/
|
||||
@Deprecated
|
||||
default Property getWhenCreatedProperty() {
|
||||
return whenCreatedProperty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Property to read values from a bean.
|
||||
*/
|
||||
Property getProperty(String propertyName);
|
||||
Property property(String propertyName);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to property().
|
||||
*/
|
||||
@Deprecated
|
||||
default Property getProperty(String propertyName) {
|
||||
return property(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ExpressionPath for a given property path.
|
||||
@@ -73,7 +132,15 @@ public interface BeanType<T> {
|
||||
* This can return a property or nested property path.
|
||||
* </p>
|
||||
*/
|
||||
ExpressionPath getExpressionPath(String path);
|
||||
ExpressionPath expressionPath(String path);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to expressionPath().
|
||||
*/
|
||||
@Deprecated
|
||||
default ExpressionPath getExpressionPath(String path) {
|
||||
return expressionPath(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the property is a valid known property or path for the given bean type.
|
||||
@@ -108,7 +175,15 @@ public interface BeanType<T> {
|
||||
/**
|
||||
* Return the base table this bean type maps to.
|
||||
*/
|
||||
String getBaseTable();
|
||||
String baseTable();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to baseTable().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getBaseTable() {
|
||||
return baseTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of the bean.
|
||||
@@ -118,42 +193,99 @@ public interface BeanType<T> {
|
||||
/**
|
||||
* Return the bean id. This is the same as getBeanId() but without the generic type.
|
||||
*/
|
||||
Object beanId(Object bean);
|
||||
Object id(Object bean);
|
||||
|
||||
/**
|
||||
* Return the id value for the given bean.
|
||||
* Deprecated migrate to id()
|
||||
*/
|
||||
@Deprecated
|
||||
default Object beanId(Object bean) {
|
||||
return id(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to id()
|
||||
*/
|
||||
@Deprecated
|
||||
Object getBeanId(T bean);
|
||||
|
||||
/**
|
||||
* Set the id value to the bean.
|
||||
*/
|
||||
void setBeanId(T bean, Object idValue);
|
||||
void setId(T bean, Object idValue);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to setId()
|
||||
*/
|
||||
@Deprecated
|
||||
default void setBeanId(T bean, Object idValue) {
|
||||
setId(bean, idValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the bean persist controller.
|
||||
*/
|
||||
BeanPersistController getPersistController();
|
||||
BeanPersistController persistController();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to persistController()
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanPersistController getPersistController() {
|
||||
return persistController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the bean persist listener.
|
||||
*/
|
||||
BeanPersistListener getPersistListener();
|
||||
BeanPersistListener persistListener();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to persistListener()
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanPersistListener getPersistListener() {
|
||||
return persistListener();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the beanFinder. Usually null unless overriding the finder.
|
||||
*/
|
||||
BeanFindController getFindController();
|
||||
BeanFindController findController();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to findController()
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanFindController getFindController() {
|
||||
return findController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BeanQueryAdapter or null if none is defined.
|
||||
*/
|
||||
BeanQueryAdapter getQueryAdapter();
|
||||
BeanQueryAdapter queryAdapter();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to queryAdapter()
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanQueryAdapter getQueryAdapter() {
|
||||
return queryAdapter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the identity generation type.
|
||||
*/
|
||||
IdType getIdType();
|
||||
IdType idType();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to idType()
|
||||
*/
|
||||
@Deprecated
|
||||
default IdType getIdType() {
|
||||
return idType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this bean type has doc store backing.
|
||||
@@ -167,12 +299,28 @@ public interface BeanType<T> {
|
||||
* for the document store.
|
||||
* </p>
|
||||
*/
|
||||
DocMapping getDocMapping();
|
||||
DocMapping docMapping();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to docMapping()
|
||||
*/
|
||||
@Deprecated
|
||||
default DocMapping getDocMapping() {
|
||||
return docMapping();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the doc store queueId for this bean type.
|
||||
*/
|
||||
String getDocStoreQueueId();
|
||||
String docStoreQueueId();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to docStoreQueueId()
|
||||
*/
|
||||
@Deprecated
|
||||
default String getDocStoreQueueId() {
|
||||
return docStoreQueueId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the doc store support for this bean type.\
|
||||
@@ -203,12 +351,28 @@ public interface BeanType<T> {
|
||||
/**
|
||||
* Returns all direct children of this beantype
|
||||
*/
|
||||
List<BeanType<?>> getInheritanceChildren();
|
||||
List<BeanType<?>> inheritanceChildren();
|
||||
|
||||
/**
|
||||
* Returns the parent in inheritance hiearchy
|
||||
* Deprecated migrate to inheritanceChildren()
|
||||
*/
|
||||
BeanType<?> getInheritanceParent();
|
||||
@Deprecated
|
||||
default List<BeanType<?>> getInheritanceChildren() {
|
||||
return inheritanceChildren();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent in inheritance hierarchy
|
||||
*/
|
||||
BeanType<?> inheritanceParent();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to inheritanceParent()
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanType<?> getInheritanceParent() {
|
||||
return inheritanceParent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Visit all children recursively
|
||||
@@ -218,7 +382,15 @@ public interface BeanType<T> {
|
||||
/**
|
||||
* Return the discriminator column.
|
||||
*/
|
||||
String getDiscColumn();
|
||||
String discColumn();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to discColumn()
|
||||
*/
|
||||
@Deprecated
|
||||
default String getDiscColumn() {
|
||||
return discColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a bean given the discriminator value.
|
||||
|
||||
@@ -37,7 +37,15 @@ public interface ExpressionPath {
|
||||
/**
|
||||
* Return the default StringParser for the scalar property.
|
||||
*/
|
||||
StringParser getStringParser();
|
||||
StringParser stringParser();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to stringParser().
|
||||
*/
|
||||
@Deprecated
|
||||
default StringParser getStringParser() {
|
||||
return stringParser();
|
||||
}
|
||||
|
||||
/**
|
||||
* For DateTime capable scalar types convert the long systemTimeMillis into
|
||||
@@ -54,7 +62,15 @@ public interface ExpressionPath {
|
||||
/**
|
||||
* Return the underlying JDBC type or 0 if this is not a scalar type.
|
||||
*/
|
||||
int getJdbcType();
|
||||
int jdbcType();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to jdbcType().
|
||||
*/
|
||||
@Deprecated
|
||||
default int getJdbcType() {
|
||||
return jdbcType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is an ManyToOne or OneToOne associated bean property.
|
||||
@@ -67,20 +83,52 @@ public interface ExpressionPath {
|
||||
* Typically used to produce id = ? expression strings.
|
||||
* </p>
|
||||
*/
|
||||
String getAssocIdExpression(String propName, String bindOperator);
|
||||
String assocIdExpression(String propName, String bindOperator);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to assocIdExpression().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getAssocIdExpression(String propName, String bindOperator) {
|
||||
return assocIdExpression(propName, bindOperator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Id values for the given bean value.
|
||||
*/
|
||||
Object[] getAssocIdValues(EntityBean bean);
|
||||
Object[] assocIdValues(EntityBean bean);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to assocIdValues().
|
||||
*/
|
||||
@Deprecated
|
||||
default Object[] getAssocIdValues(EntityBean bean) {
|
||||
return assocIdValues(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the underlying bean property.
|
||||
*/
|
||||
Property getProperty();
|
||||
Property property();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to property().
|
||||
*/
|
||||
@Deprecated
|
||||
default Property getProperty() {
|
||||
return property();
|
||||
}
|
||||
|
||||
/**
|
||||
* The ElPrefix plus name.
|
||||
*/
|
||||
String getElName();
|
||||
String elName();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to elName().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getElName() {
|
||||
return elName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package io.ebean.plugin;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Property of a entity bean that can be read.
|
||||
*/
|
||||
@@ -10,19 +8,41 @@ public interface Property {
|
||||
/**
|
||||
* Return the name of the property.
|
||||
*/
|
||||
@Nonnull
|
||||
String getName();
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to name().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of the property.
|
||||
*/
|
||||
@Nonnull
|
||||
Class<?> getPropertyType();
|
||||
Class<?> type();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to type().
|
||||
*/
|
||||
@Deprecated
|
||||
default Class<?> getPropertyType() {
|
||||
return type();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the property on the given bean.
|
||||
*/
|
||||
Object getVal(Object bean);
|
||||
Object value(Object bean);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to value().
|
||||
*/
|
||||
@Deprecated
|
||||
default Object getVal(Object bean) {
|
||||
return value(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a OneToMany or ManyToMany property.
|
||||
|
||||
@@ -16,32 +16,80 @@ public interface SpiServer extends Database {
|
||||
/**
|
||||
* Return the DatabaseConfig.
|
||||
*/
|
||||
DatabaseConfig getServerConfig();
|
||||
DatabaseConfig config();
|
||||
|
||||
/**
|
||||
* Migrate to config().
|
||||
*/
|
||||
@Deprecated
|
||||
default DatabaseConfig getServerConfig() {
|
||||
return config();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DatabasePlatform for this database.
|
||||
*/
|
||||
DatabasePlatform getDatabasePlatform();
|
||||
DatabasePlatform databasePlatform();
|
||||
|
||||
/**
|
||||
* Migrate to config().
|
||||
*/
|
||||
@Deprecated
|
||||
default DatabasePlatform getDatabasePlatform() {
|
||||
return databasePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the bean types registered on this server instance.
|
||||
*/
|
||||
List<? extends BeanType<?>> getBeanTypes();
|
||||
List<? extends BeanType<?>> beanTypes();
|
||||
|
||||
/**
|
||||
* Migrate to beanTypes().
|
||||
*/
|
||||
@Deprecated
|
||||
default List<? extends BeanType<?>> getBeanTypes() {
|
||||
return beanTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the bean type for a given entity bean class.
|
||||
*/
|
||||
<T> BeanType<T> getBeanType(Class<T> beanClass);
|
||||
<T> BeanType<T> beanType(Class<T> beanClass);
|
||||
|
||||
/**
|
||||
* Migrate to beanType().
|
||||
*/
|
||||
@Deprecated
|
||||
default <T> BeanType<T> getBeanType(Class<T> beanClass) {
|
||||
return beanType(beanClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the bean types mapped to the given base table.
|
||||
*/
|
||||
List<? extends BeanType<?>> getBeanTypes(String baseTableName);
|
||||
List<? extends BeanType<?>> beanTypes(String baseTableName);
|
||||
|
||||
/**
|
||||
* Migrate to beanTypes().
|
||||
*/
|
||||
@Deprecated
|
||||
default List<? extends BeanType<?>> getBeanTypes(String baseTableName) {
|
||||
return beanTypes(baseTableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the bean type for a given doc store queueId.
|
||||
*/
|
||||
BeanType<?> getBeanTypeForQueueId(String queueId);
|
||||
BeanType<?> beanTypeForQueueId(String queueId);
|
||||
|
||||
/**
|
||||
* Migrate to beanTypes().
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanType<?> getBeanTypeForQueueId(String queueId) {
|
||||
return beanTypeForQueueId(queueId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a BeanLoader.
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultCsvCallback.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(DefaultCsvCallback.class);
|
||||
|
||||
/**
|
||||
* The transaction to use (if not using CsvCallback).
|
||||
@@ -124,13 +124,11 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
*/
|
||||
@Override
|
||||
public void processBean(int row, String[] line, T bean) {
|
||||
|
||||
// assumes single bean or Cascade.PERSIST will save any
|
||||
// related beans (e.g. customer -> customer.billingAddress
|
||||
server.save(bean, transaction);
|
||||
|
||||
if (logInfoFrequency > 0 && (row % logInfoFrequency == 0)) {
|
||||
logger.info("processed " + row + " rows");
|
||||
log.debug("processed {} rows", row);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,11 +137,9 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
*/
|
||||
@Override
|
||||
public void end(int row) {
|
||||
|
||||
commitTransactionIfCreated();
|
||||
|
||||
exeTime = System.currentTimeMillis() - startTime;
|
||||
logger.info("Csv finished, rows[" + row + "] exeMillis[" + exeTime + "]");
|
||||
log.info("Csv finished, rows[{}] exeMillis[{}]", row, exeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,23 +155,20 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
* and batch size.
|
||||
*/
|
||||
protected void initTransactionIfRequired() {
|
||||
|
||||
transaction = server.currentTransaction();
|
||||
if (transaction == null || !transaction.isActive()) {
|
||||
|
||||
transaction = server.beginTransaction();
|
||||
createdTransaction = true;
|
||||
if (persistBatchSize > 1) {
|
||||
logger.info("Creating transaction, batchSize[" + persistBatchSize + "]");
|
||||
log.debug("Creating transaction, batchSize[{}]", persistBatchSize);
|
||||
transaction.setBatchMode(true);
|
||||
transaction.setBatchSize(persistBatchSize);
|
||||
transaction.setGetGeneratedKeys(false);
|
||||
|
||||
} else {
|
||||
// explicitly turn off JDBC batching in case
|
||||
// is has been turned on globally
|
||||
transaction.setBatchMode(false);
|
||||
logger.info("Creating transaction with no JDBC batching");
|
||||
log.debug("Creating transaction with no JDBC batching");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,7 +180,7 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
protected void commitTransactionIfCreated() {
|
||||
if (createdTransaction) {
|
||||
transaction.commit();
|
||||
logger.info("Committed transaction");
|
||||
log.debug("Committed transaction");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +191,7 @@ public class DefaultCsvCallback<T> implements CsvCallback<T> {
|
||||
protected void rollbackTransactionIfCreated(Throwable e) {
|
||||
if (createdTransaction) {
|
||||
transaction.rollback(e);
|
||||
logger.info("Rolled back transaction");
|
||||
log.debug("Rolled back transaction");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public interface JsonBeanReader<T> {
|
||||
/**
|
||||
* Create a new reader taking the context from the existing one but using a new JsonParser.
|
||||
*/
|
||||
JsonBeanReader<T> forJson(JsonParser moreJson, boolean resetContext);
|
||||
JsonBeanReader<T> forJson(JsonParser moreJson);
|
||||
|
||||
/**
|
||||
* Add a bean explicitly to the persistence context.
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.ebean.util;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.AnnotatedElement;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
@@ -57,10 +58,8 @@ public class AnnotationUtil {
|
||||
|
||||
private static <A extends Annotation> void typeGetAllCollect(Class<?> clazz, Class<A> annotationType, Set<A> result) {
|
||||
while (clazz != null && clazz != Object.class) {
|
||||
final A val = clazz.getAnnotation(annotationType);
|
||||
if (val != null) {
|
||||
result.add(val);
|
||||
}
|
||||
final A[] annotations = clazz.getAnnotationsByType(annotationType);
|
||||
Collections.addAll(result, annotations);
|
||||
clazz = clazz.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.sql.Statement;
|
||||
*/
|
||||
public class JdbcClose {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JdbcClose.class);
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
|
||||
/**
|
||||
* Close the resultSet logging if an error occurs.
|
||||
@@ -24,7 +24,7 @@ public class JdbcClose {
|
||||
statement.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error closing statement", e);
|
||||
log.warn("Error closing statement", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class JdbcClose {
|
||||
resultSet.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error closing resultSet", e);
|
||||
log.warn("Error closing resultSet", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class JdbcClose {
|
||||
connection.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error closing connection", e);
|
||||
log.warn("Error closing connection", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class JdbcClose {
|
||||
connection.rollback();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error on connection rollback", e);
|
||||
log.warn("Error on connection rollback", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class JdbcClose {
|
||||
stmt.cancel();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Error on cancelling statement", e);
|
||||
log.warn("Error on cancelling statement", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
module io.ebean.api {
|
||||
|
||||
uses io.ebean.config.AutoConfigure;
|
||||
uses io.ebean.datasource.DataSourceAlertFactory;
|
||||
uses io.ebean.metric.MetricFactory;
|
||||
uses io.ebean.service.SpiContainerFactory;
|
||||
uses io.ebean.service.SpiRawSqlService;
|
||||
uses io.ebean.service.SpiProfileLocationFactory;
|
||||
uses io.ebean.service.SpiFetchGroupService;
|
||||
|
||||
requires transitive java.sql;
|
||||
requires transitive io.avaje.config;
|
||||
requires transitive persistence.api;
|
||||
requires transitive io.ebean.annotation;
|
||||
requires transitive io.ebean.datasource.api;
|
||||
requires transitive org.slf4j;
|
||||
|
||||
requires static io.ebean.types;
|
||||
requires static io.avaje.jsr305x;
|
||||
requires static com.fasterxml.jackson.core;
|
||||
requires static javax.servlet.api;
|
||||
requires static com.h2database;
|
||||
|
||||
exports io.ebean;
|
||||
exports io.ebean.bean;
|
||||
exports io.ebean.cache;
|
||||
exports io.ebean.meta;
|
||||
exports io.ebean.config;
|
||||
exports io.ebean.config.dbplatform;
|
||||
exports io.ebean.config.dbplatform.clickhouse;
|
||||
exports io.ebean.config.dbplatform.h2;
|
||||
exports io.ebean.config.dbplatform.db2;
|
||||
exports io.ebean.config.dbplatform.cockroach;
|
||||
exports io.ebean.config.dbplatform.hana;
|
||||
exports io.ebean.config.dbplatform.hsqldb;
|
||||
exports io.ebean.config.dbplatform.mariadb;
|
||||
exports io.ebean.config.dbplatform.mysql;
|
||||
exports io.ebean.config.dbplatform.nuodb;
|
||||
exports io.ebean.config.dbplatform.oracle;
|
||||
exports io.ebean.config.dbplatform.postgres;
|
||||
exports io.ebean.config.dbplatform.sqlanywhere;
|
||||
exports io.ebean.config.dbplatform.sqlite;
|
||||
exports io.ebean.config.dbplatform.sqlserver;
|
||||
exports io.ebean.event;
|
||||
exports io.ebean.event.readaudit;
|
||||
exports io.ebean.event.changelog;
|
||||
exports io.ebean.common;
|
||||
exports io.ebean.docstore;
|
||||
exports io.ebean.plugin;
|
||||
exports io.ebean.metric;
|
||||
exports io.ebean.search;
|
||||
exports io.ebean.service;
|
||||
exports io.ebean.text;
|
||||
exports io.ebean.text.json;
|
||||
exports io.ebean.text.csv;
|
||||
exports io.ebean.util;
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Automatic-Module-Name: io.ebean.api
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.ebean;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class EbeanVersionTest {
|
||||
|
||||
@Test
|
||||
void checkMinAgentVersion_ok() {
|
||||
assertFalse(EbeanVersion.checkMinAgentVersion("12.12.0"));
|
||||
assertFalse(EbeanVersion.checkMinAgentVersion("12.12.99"));
|
||||
assertFalse(EbeanVersion.checkMinAgentVersion("13.1.0"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void checkMinAgentVersion_agentTooOld() {
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion("11.13.0"));
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion("12.11.0"));
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion("12.11.99"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void checkMinAgentVersion_unexpectedAgentVersion() {
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion("13.13"));
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion("13"));
|
||||
assertTrue(EbeanVersion.checkMinAgentVersion(""));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebean.config.dbplatform;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.sql.Types;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package io.ebean.util;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import io.ebean.annotation.Formula;
|
||||
|
||||
public class TestAnnotationUtil {
|
||||
|
||||
@Formula(select = "x")
|
||||
@Formula(select = "y")
|
||||
private static class TestObject {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRepeatableAnnotation() {
|
||||
|
||||
Set<Formula> list = AnnotationUtil.typeGetAll(TestObject.class, Formula.class);
|
||||
assertThat(list).hasSize(2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+8
-19
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.11.0</version>
|
||||
<version>12.13.2</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>ebean-parent-12.11.0</tag>
|
||||
<tag>ebean-parent-12.13.2</tag>
|
||||
</scm>
|
||||
|
||||
<name>ebean autotune</name>
|
||||
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.11.0</version>
|
||||
<version>12.13.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.avaje.composite</groupId>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -59,27 +59,16 @@
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.19</version>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<!-- other tiles ... -->
|
||||
<tile>io.ebean.tile:enhancement:12.6.0</tile>
|
||||
<tile>io.ebean.tile:enhancement:12.11.3</tile>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>12.13.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
<!-- <artifactId>java8-oss</artifactId>-->
|
||||
<!-- <version>2.2</version>-->
|
||||
<!-- </parent>-->
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<name>ebean autotune</name>
|
||||
<description>ebean automatic query tuning module</description>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>12.13.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- needed for java 11+ -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.ebean.tile:enhancement:12.11.3</tile>
|
||||
<tile>io.avaje.tile:moditech-module:1.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user