mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-09-20 11:17:36 +00:00
Compare commits
115
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b361b10571 | ||
|
|
c0e4e548ee | ||
|
|
92f3245919 | ||
|
|
59c2290916 | ||
|
|
1135eb3f99 | ||
|
|
1dccdff7bf | ||
|
|
5f74a53e3e | ||
|
|
1f9e652ea9 | ||
|
|
4e592c97ff | ||
|
|
760d19a10d | ||
|
|
d2693c3ff2 | ||
|
|
3324b2bda4 | ||
|
|
1b5e066562 | ||
|
|
104e4ec756 | ||
|
|
74a2967a6e | ||
|
|
e693b12a97 | ||
|
|
48fb9b34bb | ||
|
|
f64400400a | ||
|
|
d7cc081942 | ||
|
|
3351548b60 | ||
|
|
8d9858f57a | ||
|
|
9b520bc176 | ||
|
|
44fd8e3a56 | ||
|
|
6910016c4d | ||
|
|
5f8a3c0591 | ||
|
|
0ae6956c1c | ||
|
|
2e9c5d8548 | ||
|
|
93edc840b3 | ||
|
|
34311785fa | ||
|
|
63929f8ff3 | ||
|
|
d918c5117f | ||
|
|
dd845a7b0c | ||
|
|
df0e4d57f0 | ||
|
|
9c7fa25d49 | ||
|
|
e82c1a4140 | ||
|
|
389bf48e3e | ||
|
|
3b3b44543e | ||
|
|
297f334da5 | ||
|
|
78c7439445 | ||
|
|
2043ba6411 | ||
|
|
437c58001b | ||
|
|
0e812efa7e | ||
|
|
80d4d21986 | ||
|
|
fe66b8c242 | ||
|
|
206b2b2d3b | ||
|
|
c0bc3faea0 | ||
|
|
3d07e7d804 | ||
|
|
fc124e8318 | ||
|
|
f4fd4f4b09 | ||
|
|
16f5311885 | ||
|
|
75a0675977 | ||
|
|
80ebf4a1ee | ||
|
|
4185beb5aa | ||
|
|
79908c0164 | ||
|
|
b5a16f42ca | ||
|
|
a320a132b3 | ||
|
|
9e84e93511 | ||
|
|
6fb40c71ef | ||
|
|
202b9ae94a | ||
|
|
d79b452378 | ||
|
|
78a408dd10 | ||
|
|
6af974e432 | ||
|
|
04a8475291 | ||
|
|
c56345f92e | ||
|
|
ed0a46955e | ||
|
|
3c4b04a893 | ||
|
|
ee403bdb83 | ||
|
|
b18abe2221 | ||
|
|
d68f372d99 | ||
|
|
c8f769aa2a | ||
|
|
bde626fd45 | ||
|
|
b828b73b2c | ||
|
|
2795a8578f | ||
|
|
bd0a3c2303 | ||
|
|
21e50e9d00 | ||
|
|
88a47bf0a9 | ||
|
|
d9a45245f4 | ||
|
|
7be72df788 | ||
|
|
42685335e3 | ||
|
|
478a2be405 | ||
|
|
ebcac9a503 | ||
|
|
996239c29f | ||
|
|
caf2772fb3 | ||
|
|
1482c4c84f | ||
|
|
792d52b794 | ||
|
|
aa4ea4904f | ||
|
|
bab839fb38 | ||
|
|
dde2567ccd | ||
|
|
7e4d070b75 | ||
|
|
3151e3f82b | ||
|
|
c630aaff0e | ||
|
|
67ec848f15 | ||
|
|
57f0734381 | ||
|
|
cbd5bf23c9 | ||
|
|
5dc664a63f | ||
|
|
d9b53677f2 | ||
|
|
f55c2cf3b6 | ||
|
|
c98def7ab7 | ||
|
|
705e158a70 | ||
|
|
569e782e99 | ||
|
|
265b92fb12 | ||
|
|
74311fad0a | ||
|
|
1eded5682a | ||
|
|
ff21bfe1de | ||
|
|
86db7fadfd | ||
|
|
e48b327967 | ||
|
|
964b3ccf8e | ||
|
|
eb6906ad2b | ||
|
|
86e5ea3627 | ||
|
|
3a5e8290e0 | ||
|
|
929604e33d | ||
|
|
2eed68ad61 | ||
|
|
f705560b8b | ||
|
|
a35db6bdee | ||
|
|
3ab3f81fa3 |
@@ -40,5 +40,5 @@ jobs:
|
||||
# - name: Maven single test
|
||||
# run: mvn --batch-mode clean verify -Dtest="io.ebeaninternal.server.core.DefaultServer_getReferenceTest" -DfailIfNoTests=false
|
||||
- name: Build with Maven
|
||||
run: mvn -T 8 clean test
|
||||
run: mvn -T 8 clean test -Pdefault
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [GA,EA,23]
|
||||
java_version: [GA,EA]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
@@ -37,5 +37,5 @@ jobs:
|
||||
- name: Maven version
|
||||
run: mvn --version
|
||||
- name: Build with Maven
|
||||
run: mvn -T 8 test
|
||||
run: mvn test -Pea
|
||||
|
||||
|
||||
@@ -34,5 +34,5 @@ jobs:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: mariadb 10.6
|
||||
- name: mariadb 10.11
|
||||
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-mariadb.properties
|
||||
|
||||
@@ -34,5 +34,5 @@ jobs:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: sqlserver 2017
|
||||
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-sqlserver17.properties
|
||||
- name: sqlserver 2022
|
||||
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-sqlserver.properties
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-clickhouse</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-db2</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-hana</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mariadb</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mysql</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -47,19 +47,19 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-net-postgis-types</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-nuodb</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-oracle</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -47,19 +47,19 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis-types</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlite</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,7 +41,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-mapper</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -60,13 +60,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>composites</artifactId>
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
@@ -35,7 +35,7 @@
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-config</artifactId>
|
||||
<version>3.12</version>
|
||||
<version>4.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -137,6 +137,7 @@ public interface Database {
|
||||
/**
|
||||
* Return the associated read only DataSource for this Database instance (can be null).
|
||||
*/
|
||||
@Nullable
|
||||
DataSource readOnlyDataSource();
|
||||
|
||||
/**
|
||||
|
||||
@@ -1062,6 +1062,11 @@ public interface DatabaseBuilder {
|
||||
*/
|
||||
DatabaseBuilder readOnlyDatabase(boolean readOnlyDatabase);
|
||||
|
||||
/**
|
||||
* Set to false such that the instance does not register a JVM shutdown hook.
|
||||
*/
|
||||
DatabaseBuilder shutdownHook(boolean shutdownHook);
|
||||
|
||||
/**
|
||||
* Set a DataSource.
|
||||
*/
|
||||
@@ -2019,6 +2024,11 @@ public interface DatabaseBuilder {
|
||||
@Deprecated
|
||||
DatabaseBuilder setQueryPlanTTLSeconds(int queryPlanTTLSeconds);
|
||||
|
||||
/**
|
||||
* Set the EXPLAIN (with options) to use for query plan capture.
|
||||
*/
|
||||
DatabaseBuilder queryPlanExplain(String queryPlanExplain);
|
||||
|
||||
/**
|
||||
* Create a new PlatformConfig based of the one held but with overridden properties by reading
|
||||
* properties with the given path and prefix.
|
||||
@@ -2638,6 +2648,11 @@ public interface DatabaseBuilder {
|
||||
*/
|
||||
boolean readOnlyDatabase();
|
||||
|
||||
/**
|
||||
* Return if a JVM shutdown hook should be registered.
|
||||
*/
|
||||
boolean shutdownHook();
|
||||
|
||||
/**
|
||||
* Return the DataSource.
|
||||
*/
|
||||
@@ -3044,6 +3059,11 @@ public interface DatabaseBuilder {
|
||||
*/
|
||||
int getQueryPlanTTLSeconds();
|
||||
|
||||
/**
|
||||
* Return the EXPLAIN (with options) to use for capturing query plans.
|
||||
*/
|
||||
String getQueryPlanExplain();
|
||||
|
||||
/**
|
||||
* Return mapping locations to search for xml mapping via class path search.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package io.ebean;
|
||||
|
||||
import jakarta.persistence.PersistenceException;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
/**
|
||||
* FutureMap represents the result of a background query execution that will
|
||||
* return a map of entities.
|
||||
* <p>
|
||||
* It extends the java.util.concurrent.Future with the ability to cancel the
|
||||
* query, check if it is finished and get the resulting list waiting for the
|
||||
* query to finish (ie. the standard features of java.util.concurrent.Future).
|
||||
* </p>
|
||||
* <p>
|
||||
* A simple example:
|
||||
* </p>
|
||||
* <pre>{@code
|
||||
*
|
||||
* // create a query to find all orders
|
||||
* Query<Long,Order> query = DB.find(Order.class)
|
||||
* .setMapKey("id");
|
||||
*
|
||||
* // execute the query in a background thread
|
||||
* // immediately returning the futureMap
|
||||
* FutureMap<Long,Order> futureMap = query.findFutureMap();
|
||||
*
|
||||
* // do something else ...
|
||||
*
|
||||
* if (!futureMap.isDone()){
|
||||
* // we can cancel the query execution. This will cancel
|
||||
* // the underlying query if that is supported by the JDBC
|
||||
* // driver and database
|
||||
* futureMap.cancel(true);
|
||||
* }
|
||||
*
|
||||
* if (!futureMap.isCancelled()){
|
||||
* // wait for the query to finish and return the map
|
||||
* Map<Long,Order> map = futureMap.get();
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
public interface FutureMap<K, T> extends Future<Map<K, T>> {
|
||||
|
||||
/**
|
||||
* Return the query that is being executed by a background thread.
|
||||
*/
|
||||
Query<T> getQuery();
|
||||
|
||||
/**
|
||||
* Same as {@link #get()} but wraps InterruptedException and ExecutionException in the
|
||||
* unchecked PersistenceException.
|
||||
*
|
||||
* @return The query list result
|
||||
* @throws PersistenceException when a InterruptedException or ExecutionException occurs.
|
||||
*/
|
||||
Map<K, T> getUnchecked();
|
||||
|
||||
/**
|
||||
* Same as {@link #get(long, TimeUnit)} but wraps InterruptedException
|
||||
* and ExecutionException in the unchecked PersistenceException.
|
||||
*
|
||||
* @return The query list result
|
||||
* @throws TimeoutException if the wait timed out
|
||||
* @throws PersistenceException if a InterruptedException or ExecutionException occurs.
|
||||
*/
|
||||
Map<K, T> getUnchecked(long timeout, TimeUnit unit) throws TimeoutException;
|
||||
|
||||
}
|
||||
@@ -956,6 +956,16 @@ public interface QueryBuilder<SELF extends QueryBuilder<SELF, T>, T> extends Que
|
||||
*/
|
||||
FutureList<T> findFutureList();
|
||||
|
||||
/**
|
||||
* Execute find map query in a background thread.
|
||||
* <p>
|
||||
* This query will execute in it's own PersistenceContext and using its own transaction.
|
||||
* What that means is that it will not share any bean instances with other queries.
|
||||
*
|
||||
* @return a Future object for the map result of the query
|
||||
*/
|
||||
<K> FutureMap<K,T> findFutureMap();
|
||||
|
||||
/**
|
||||
* Return a PagedList for this query using firstRow and maxRows.
|
||||
* <p>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.ebean.cache;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -10,11 +11,11 @@ import java.util.Set;
|
||||
* the query cache entry is treated as invalid.
|
||||
* </p>
|
||||
*/
|
||||
public class QueryCacheEntry {
|
||||
public final class QueryCacheEntry {
|
||||
|
||||
private final Object value;
|
||||
private final Set<String> dependentTables;
|
||||
private final long timestamp;
|
||||
private final Instant timestamp;
|
||||
|
||||
/**
|
||||
* Create with dependent tables and timestamp.
|
||||
@@ -23,7 +24,7 @@ public class QueryCacheEntry {
|
||||
* @param dependentTables The extra tables the query is dependent on (joins to)
|
||||
* @param timestamp The timestamp that the query uses to check for modifications
|
||||
*/
|
||||
public QueryCacheEntry(Object value, Set<String> dependentTables, long timestamp) {
|
||||
public QueryCacheEntry(Object value, Set<String> dependentTables, Instant timestamp) {
|
||||
this.value = value;
|
||||
this.dependentTables = dependentTables;
|
||||
this.timestamp = timestamp;
|
||||
@@ -32,21 +33,21 @@ public class QueryCacheEntry {
|
||||
/**
|
||||
* Return the actual query result.
|
||||
*/
|
||||
public Object getValue() {
|
||||
public Object value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the tables the query result is dependent on.
|
||||
*/
|
||||
public Set<String> getDependentTables() {
|
||||
public Set<String> dependentTables() {
|
||||
return dependentTables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the timestamp used to check for modifications on the dependent tables.
|
||||
*/
|
||||
public long getTimestamp() {
|
||||
public Instant timestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ public class DatabaseConfig implements DatabaseBuilder.Settings {
|
||||
/**
|
||||
* The default batch size for lazy loading
|
||||
*/
|
||||
private int lazyLoadBatchSize = 10;
|
||||
private int lazyLoadBatchSize = 100;
|
||||
|
||||
/**
|
||||
* The default batch size for 'query joins'.
|
||||
@@ -311,6 +311,7 @@ public class DatabaseConfig implements DatabaseBuilder.Settings {
|
||||
private boolean skipDataSourceCheck;
|
||||
|
||||
private boolean readOnlyDatabase;
|
||||
private boolean shutdownHook = true;
|
||||
|
||||
/**
|
||||
* The data source (if programmatically provided).
|
||||
@@ -481,6 +482,7 @@ public class DatabaseConfig implements DatabaseBuilder.Settings {
|
||||
* Time to live for query plans - defaults to 5 minutes.
|
||||
*/
|
||||
private int queryPlanTTLSeconds = 60 * 5;
|
||||
private String queryPlanExplain;
|
||||
|
||||
/**
|
||||
* Set to true to globally disable L2 caching (typically for performance testing).
|
||||
@@ -1364,6 +1366,17 @@ public class DatabaseConfig implements DatabaseBuilder.Settings {
|
||||
return readOnlyDatabase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseBuilder shutdownHook(boolean shutdownHook) {
|
||||
this.shutdownHook = shutdownHook;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdownHook() {
|
||||
return shutdownHook;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getDataSource() {
|
||||
return dataSource;
|
||||
@@ -2136,6 +2149,7 @@ public class DatabaseConfig implements DatabaseBuilder.Settings {
|
||||
loadDocStoreSettings(p);
|
||||
|
||||
defaultServer = p.getBoolean("defaultServer", defaultServer);
|
||||
shutdownHook = p.getBoolean("shutdownHook", shutdownHook);
|
||||
readOnlyDatabase = p.getBoolean("readOnlyDatabase", readOnlyDatabase);
|
||||
autoPersistUpdates = p.getBoolean("autoPersistUpdates", autoPersistUpdates);
|
||||
loadModuleInfo = p.getBoolean("loadModuleInfo", loadModuleInfo);
|
||||
@@ -2151,6 +2165,7 @@ public class DatabaseConfig implements DatabaseBuilder.Settings {
|
||||
queryPlanCapturePeriodSecs = p.getLong("queryPlan.capturePeriodSecs", queryPlanCapturePeriodSecs);
|
||||
queryPlanCaptureMaxTimeMillis = p.getLong("queryPlan.captureMaxTimeMillis", queryPlanCaptureMaxTimeMillis);
|
||||
queryPlanCaptureMaxCount = p.getInt("queryPlan.captureMaxCount", queryPlanCaptureMaxCount);
|
||||
queryPlanExplain = p.get("queryPlan.explain", queryPlanExplain);
|
||||
docStoreOnly = p.getBoolean("docStoreOnly", docStoreOnly);
|
||||
disableL2Cache = p.getBoolean("disableL2Cache", disableL2Cache);
|
||||
localOnlyL2Cache = p.getBoolean("localOnlyL2Cache", localOnlyL2Cache);
|
||||
@@ -2402,6 +2417,17 @@ public class DatabaseConfig implements DatabaseBuilder.Settings {
|
||||
return queryPlanTTLSeconds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryPlanExplain() {
|
||||
return queryPlanExplain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseBuilder queryPlanExplain(String queryPlanExplain) {
|
||||
this.queryPlanExplain = queryPlanExplain;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseConfig setQueryPlanTTLSeconds(int queryPlanTTLSeconds) {
|
||||
this.queryPlanTTLSeconds = queryPlanTTLSeconds;
|
||||
|
||||
@@ -167,6 +167,7 @@ public class DatabasePlatform {
|
||||
* findIterate() and findVisit().
|
||||
*/
|
||||
protected boolean forwardOnlyHintOnFindIterate;
|
||||
protected boolean autoCommitFalseOnFindIterate;
|
||||
|
||||
/**
|
||||
* If set then use the CONCUR_UPDATABLE hint when creating ResultSets.
|
||||
@@ -528,6 +529,10 @@ public class DatabasePlatform {
|
||||
this.forwardOnlyHintOnFindIterate = forwardOnlyHintOnFindIterate;
|
||||
}
|
||||
|
||||
public boolean autoCommitFalseOnFindIterate() {
|
||||
return autoCommitFalseOnFindIterate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the ResultSet CONCUR_UPDATABLE Hint should be used on
|
||||
* createNativeSqlTree() PreparedStatements.
|
||||
@@ -780,4 +785,5 @@ public class DatabasePlatform {
|
||||
public String inlineSqlHint(String hint) {
|
||||
return "/*+ " + hint + " */ ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -97,8 +97,7 @@ public final class ShutdownManager {
|
||||
private static void registerShutdownHook() {
|
||||
lock.lock();
|
||||
try {
|
||||
String value = System.getProperty("ebean.registerShutdownHook");
|
||||
if (value == null || !value.trim().equalsIgnoreCase("false")) {
|
||||
if ("true".equalsIgnoreCase(System.getProperty("ebean.registerShutdownHook", "true"))) {
|
||||
Runtime.getRuntime().addShutdownHook(shutdownHook);
|
||||
}
|
||||
} catch (IllegalStateException ex) {
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package io.ebean.meta;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
/**
|
||||
* Initiate query plan collection for plans by their hash or all query plans.
|
||||
*/
|
||||
public class QueryPlanInit {
|
||||
|
||||
private final Map<String,Long> hashes = new HashMap<>();
|
||||
|
||||
private boolean all;
|
||||
|
||||
private Set<String> hashes = new HashSet<>();
|
||||
|
||||
private long thresholdMicros;
|
||||
private long defaultThresholdMicros;
|
||||
|
||||
/**
|
||||
* Return true if this initiates bind collection on all query plans.
|
||||
@@ -29,39 +30,74 @@ public class QueryPlanInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the query execution time threshold which must be exceeded to initiate
|
||||
* Return the default query execution time threshold which must be exceeded to initiate
|
||||
* query plan collection.
|
||||
*/
|
||||
public long thresholdMicros() {
|
||||
return thresholdMicros;
|
||||
return defaultThresholdMicros;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the query execution time threshold which must be exceeded to initiate
|
||||
* Set the default query execution time threshold which must be exceeded to initiate
|
||||
* query plan collection.
|
||||
*/
|
||||
public void thresholdMicros(long thresholdMicros) {
|
||||
this.thresholdMicros = thresholdMicros;
|
||||
this.defaultThresholdMicros = thresholdMicros;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the query plan should be initiated based on it's hash.
|
||||
*/
|
||||
public boolean includeHash(String hash) {
|
||||
return all || hashes.contains(hash);
|
||||
return all || hashes.containsKey(hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the specific hashes that we want to collect query plans on.
|
||||
*
|
||||
* @param hash The hash of the query plan.
|
||||
* @param thresholdMicros The threshold in micros to use.
|
||||
*/
|
||||
public Set<String> hashes() {
|
||||
return hashes;
|
||||
public void add(String hash, long thresholdMicros) {
|
||||
requireNonNull(hash);
|
||||
if (!"all".equals(hash)) {
|
||||
hashes.put(hash, thresholdMicros);
|
||||
} else {
|
||||
all = true;
|
||||
if (thresholdMicros > 0) {
|
||||
defaultThresholdMicros = thresholdMicros;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the specific hashes that we want to collect query plans on.
|
||||
* Remove a hash from this request.
|
||||
*/
|
||||
public void hashes(Set<String> hashes) {
|
||||
this.hashes = hashes;
|
||||
public void remove(String hash) {
|
||||
hashes.remove(hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the threshold in micros to use for the given hash.
|
||||
*/
|
||||
public long thresholdMicros(String hash) {
|
||||
Long threshold = hashes.get(hash);
|
||||
return threshold == null || threshold < 1 ? defaultThresholdMicros : threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there are no registered hashes and not collect <em>All</em> plans.
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return !all && hashes.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "QueryPlanInit{" +
|
||||
"all=" + all +
|
||||
", hashes=" + hashes +
|
||||
", thresholdMicros=" + defaultThresholdMicros +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,9 @@ class DatabaseConfigTest {
|
||||
props.setProperty("readOnlyDatabase", "true");
|
||||
props.setProperty("lengthCheck", "ON");
|
||||
props.setProperty("includeLabelInSql", "false");
|
||||
props.setProperty("lazyLoadBatchSize", "50");
|
||||
props.setProperty("queryBatchSize", "60");
|
||||
props.setProperty("shutdownHook", "false");
|
||||
|
||||
props.setProperty("queryPlan.enable", "true");
|
||||
props.setProperty("queryPlan.thresholdMicros", "10000");
|
||||
@@ -84,6 +87,7 @@ class DatabaseConfigTest {
|
||||
props.setProperty("queryPlan.capturePeriodSecs", "42");
|
||||
props.setProperty("queryPlan.captureMaxTimeMillis", "560");
|
||||
props.setProperty("queryPlan.captureMaxCount", "7");
|
||||
props.setProperty("queryPlan.explain", "explain (verbose)");
|
||||
|
||||
config.loadFromProperties(props);
|
||||
|
||||
@@ -97,8 +101,11 @@ class DatabaseConfigTest {
|
||||
assertTrue(settings.isLoadModuleInfo());
|
||||
assertTrue(settings.skipDataSourceCheck());
|
||||
assertTrue(settings.readOnlyDatabase());
|
||||
assertFalse(settings.shutdownHook());
|
||||
assertFalse(settings.isIncludeLabelInSql());
|
||||
assertThat(settings.getLengthCheck()).isEqualTo(LengthCheck.ON);
|
||||
assertThat(settings.getLazyLoadBatchSize()).isEqualTo(50);
|
||||
assertThat(settings.getQueryBatchSize()).isEqualTo(60);
|
||||
|
||||
assertTrue(settings.isIdGeneratorAutomatic());
|
||||
assertFalse(settings.getPlatformConfig().isCaseSensitiveCollation());
|
||||
@@ -129,15 +136,18 @@ class DatabaseConfigTest {
|
||||
assertEquals(42, settings.getQueryPlanCapturePeriodSecs());
|
||||
assertEquals(560, settings.getQueryPlanCaptureMaxTimeMillis());
|
||||
assertEquals(7, settings.getQueryPlanCaptureMaxCount());
|
||||
assertEquals("explain (verbose)", settings.getQueryPlanExplain());
|
||||
|
||||
assertThat(settings.getMappingLocations()).containsExactly("classpath:/foo","bar");
|
||||
|
||||
config.persistBatch(PersistBatch.NONE)
|
||||
.persistBatchOnCascade(PersistBatch.NONE)
|
||||
.lengthCheck(LengthCheck.ON)
|
||||
.lengthCheck(LengthCheck.UTF8);
|
||||
.lengthCheck(LengthCheck.UTF8)
|
||||
.queryPlanExplain("explain (buffers)");
|
||||
|
||||
|
||||
assertThat(config.settings().getQueryPlanExplain()).isEqualTo("explain (buffers)");
|
||||
Properties props1 = new Properties();
|
||||
props1.setProperty("ebean.persistBatch", "ALL");
|
||||
props1.setProperty("ebean.persistBatchOnCascade", "ALL");
|
||||
@@ -164,6 +174,7 @@ class DatabaseConfigTest {
|
||||
DatabaseBuilder.Settings config = new DatabaseConfig().settings();
|
||||
assertTrue(config.isIdGeneratorAutomatic());
|
||||
assertTrue(config.isDefaultServer());
|
||||
assertTrue(config.shutdownHook());
|
||||
assertFalse(config.isAutoPersistUpdates());
|
||||
assertFalse(config.skipDataSourceCheck());
|
||||
|
||||
@@ -175,6 +186,8 @@ class DatabaseConfigTest {
|
||||
assertTrue(config.getPlatformConfig().isCaseSensitiveCollation());
|
||||
assertTrue(config.isAutoLoadModuleInfo());
|
||||
assertTrue(config.isLoadModuleInfo());
|
||||
assertThat(config.getLazyLoadBatchSize()).isEqualTo(100);
|
||||
assertThat(config.getQueryBatchSize()).isEqualTo(100);
|
||||
|
||||
assertFalse(config.isQueryPlanEnable());
|
||||
assertEquals(Long.MAX_VALUE, config.getQueryPlanThresholdMicros());
|
||||
@@ -182,9 +195,12 @@ class DatabaseConfigTest {
|
||||
assertEquals(600, config.getQueryPlanCapturePeriodSecs());
|
||||
assertEquals(10000L, config.getQueryPlanCaptureMaxTimeMillis());
|
||||
assertEquals(10, config.getQueryPlanCaptureMaxCount());
|
||||
assertThat(config.getQueryPlanExplain()).isNull();
|
||||
assertThat(config.getLengthCheck()).isEqualTo(LengthCheck.OFF);
|
||||
assertTrue(config.isIncludeLabelInSql());
|
||||
|
||||
config.shutdownHook(false);
|
||||
assertFalse(config.shutdownHook());
|
||||
config.setLoadModuleInfo(false);
|
||||
assertFalse(config.isAutoLoadModuleInfo());
|
||||
assertFalse(config.isLoadModuleInfo());
|
||||
@@ -192,6 +208,10 @@ class DatabaseConfigTest {
|
||||
assertTrue(config.isAutoPersistUpdates());
|
||||
config.setSkipDataSourceCheck(true);
|
||||
assertTrue(config.skipDataSourceCheck());
|
||||
config.lazyLoadBatchSize(20);
|
||||
assertThat(config.getLazyLoadBatchSize()).isEqualTo(20);
|
||||
config.queryBatchSize(30);
|
||||
assertThat(config.getQueryBatchSize()).isEqualTo(30);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package io.ebean.meta;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class QueryPlanInitTest {
|
||||
|
||||
@Test
|
||||
void initialQueryPlanInit() {
|
||||
var init = new QueryPlanInit();
|
||||
assertThat(init.isEmpty()).isTrue();
|
||||
assertThat(init.isAll()).isFalse();
|
||||
assertThat(init.thresholdMicros()).isEqualTo(0L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void add_all() {
|
||||
var init = new QueryPlanInit();
|
||||
init.add("all", 57L);
|
||||
|
||||
assertThat(init.isEmpty()).isFalse();
|
||||
assertThat(init.isAll()).isTrue();
|
||||
assertThat(init.thresholdMicros()).isEqualTo(57L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void addWithThresholds() {
|
||||
var init = new QueryPlanInit();
|
||||
init.thresholdMicros(1000);
|
||||
init.add("xOne", 0);
|
||||
init.add("xTwo", 2000L);
|
||||
|
||||
assertThat(init.isEmpty()).isFalse();
|
||||
assertThat(init.isAll()).isFalse();
|
||||
assertThat(init.includeHash("xJunk")).isFalse();
|
||||
assertThat(init.includeHash("xOne")).isTrue();
|
||||
assertThat(init.includeHash("xTwo")).isTrue();
|
||||
assertThat(init.thresholdMicros("xJunk")).isEqualTo(1000L);
|
||||
assertThat(init.thresholdMicros("xOne")).isEqualTo(1000L);
|
||||
assertThat(init.thresholdMicros("xTwo")).isEqualTo(2000L);
|
||||
}
|
||||
}
|
||||
+26
-26
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
@@ -89,25 +89,25 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -125,13 +125,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-mapper</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -155,37 +155,37 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-spring-txn</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- platforms -->
|
||||
@@ -193,79 +193,79 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-clickhouse</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-db2</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-h2</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-hana</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-mariadb</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-mysql</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-nuodb</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-oracle</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgres</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis-types</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-sqlite</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-sqlserver</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<version>16.0.1</version>
|
||||
</parent>
|
||||
<artifactId>ebean-core-json</artifactId>
|
||||
<name>ebean-core-json</name>
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>16.0.1</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>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+5
-10
@@ -8,11 +8,7 @@ import io.ebean.service.SpiJsonService;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Utility that converts between JSON content and simple java Maps/Lists.
|
||||
@@ -52,8 +48,8 @@ public final class DJsonService implements SpiJsonService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the json and return as a Map additionally specifying if the returned map should
|
||||
* be modify aware meaning that it can detect when it has been modified.
|
||||
* Parse the json and return as a Map additionally specifying if the returned map should be modify
|
||||
* aware meaning that it can detect when it has been modified.
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> parseObject(String json, boolean modifyAware) throws IOException {
|
||||
@@ -94,9 +90,8 @@ public final class DJsonService implements SpiJsonService {
|
||||
|
||||
/**
|
||||
* Parse the json and return as a Map taking a JsonParser and a starting token.
|
||||
* <p>
|
||||
* Used when the first token is checked to see if the value is null prior to calling this.
|
||||
* </p>
|
||||
*
|
||||
* <p>Used when the first token is checked to see if the value is null prior to calling this.
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> parseObject(JsonParser parser, JsonToken token) throws IOException {
|
||||
+20
-32
@@ -8,15 +8,23 @@ import io.ebean.ModifyAwareType;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.*;
|
||||
|
||||
final class EJsonReader {
|
||||
|
||||
static final JsonFactory json = new JsonFactory();
|
||||
private final JsonParser parser;
|
||||
private final boolean modifyAware;
|
||||
private final ModifyAwareFlag modifyAwareOwner;
|
||||
private int depth;
|
||||
private Stack stack;
|
||||
private Context currentContext;
|
||||
|
||||
EJsonReader(JsonParser parser, boolean modifyAware) {
|
||||
this.parser = parser;
|
||||
this.modifyAware = modifyAware;
|
||||
this.modifyAwareOwner = modifyAware ? new ModifyAwareFlag() : null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static Map<String, Object> parseObject(String json, boolean modifyAware) throws IOException {
|
||||
@@ -102,24 +110,6 @@ final class EJsonReader {
|
||||
return new EJsonReader(parser, modifyAware).parseJson(token);
|
||||
}
|
||||
|
||||
private final JsonParser parser;
|
||||
|
||||
private final boolean modifyAware;
|
||||
|
||||
private final ModifyAwareFlag modifyAwareOwner;
|
||||
|
||||
private int depth;
|
||||
|
||||
private Stack stack;
|
||||
|
||||
private Context currentContext;
|
||||
|
||||
EJsonReader(JsonParser parser, boolean modifyAware) {
|
||||
this.parser = parser;
|
||||
this.modifyAware = modifyAware;
|
||||
this.modifyAwareOwner = (modifyAware) ? new ModifyAwareFlag() : null;
|
||||
}
|
||||
|
||||
private void startArray() {
|
||||
depth++;
|
||||
stack.push(currentContext);
|
||||
@@ -197,7 +187,6 @@ final class EJsonReader {
|
||||
*/
|
||||
private void processJsonToken(JsonToken token) throws IOException {
|
||||
switch (token) {
|
||||
|
||||
case START_ARRAY:
|
||||
startArray();
|
||||
break;
|
||||
@@ -273,17 +262,17 @@ final class EJsonReader {
|
||||
}
|
||||
}
|
||||
|
||||
private static abstract class Context {
|
||||
private abstract static class Context {
|
||||
Context next;
|
||||
|
||||
abstract void popContext(Context temp);
|
||||
|
||||
abstract Object getValue();
|
||||
|
||||
abstract void setKey(String key);
|
||||
|
||||
abstract void setValue(Object value);
|
||||
|
||||
abstract void setKey(String key);
|
||||
|
||||
abstract void setValueNull();
|
||||
}
|
||||
|
||||
@@ -312,13 +301,13 @@ final class EJsonReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
void setKey(String key) {
|
||||
this.key = key;
|
||||
void setValue(Object value) {
|
||||
map.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
void setValue(Object value) {
|
||||
map.put(key, value);
|
||||
void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -364,5 +353,4 @@ final class EJsonReader {
|
||||
// not expected
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+5
-7
@@ -20,6 +20,11 @@ final class EJsonWriter {
|
||||
* Base jsonFactory implementation used when it is not passed in.
|
||||
*/
|
||||
static final JsonFactory jsonFactory = new JsonFactory();
|
||||
private final JsonGenerator jsonGenerator;
|
||||
|
||||
private EJsonWriter(JsonGenerator jsonGenerator) {
|
||||
this.jsonGenerator = jsonGenerator;
|
||||
}
|
||||
|
||||
static String write(Object object) throws IOException {
|
||||
StringWriter writer = new StringWriter(200);
|
||||
@@ -42,12 +47,6 @@ final class EJsonWriter {
|
||||
new EJsonWriter(jsonGenerator).writeCollection(null, collection);
|
||||
}
|
||||
|
||||
private final JsonGenerator jsonGenerator;
|
||||
|
||||
private EJsonWriter(JsonGenerator jsonGenerator) {
|
||||
this.jsonGenerator = jsonGenerator;
|
||||
}
|
||||
|
||||
private void writeJson(Object object) {
|
||||
writeJson(null, object);
|
||||
}
|
||||
@@ -210,5 +209,4 @@ final class EJsonWriter {
|
||||
}
|
||||
jsonGenerator.writeEndObject();
|
||||
}
|
||||
|
||||
}
|
||||
-1
@@ -22,5 +22,4 @@ public final class ModifyAwareFlag implements ModifyAwareType, Serializable {
|
||||
public void setMarkedDirty(boolean markedDirty) {
|
||||
this.markedDirty = markedDirty;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-4
@@ -14,9 +14,8 @@ public final class ModifyAwareIterator<E> implements Iterator<E> {
|
||||
|
||||
/**
|
||||
* Create with an Owner and the underlying Iterator this wraps.
|
||||
* <p>
|
||||
* The owner is notified of the removals.
|
||||
* </p>
|
||||
*
|
||||
* <p>The owner is notified of the removals.
|
||||
*/
|
||||
public ModifyAwareIterator(ModifyAwareType owner, Iterator<E> it) {
|
||||
this.owner = owner;
|
||||
@@ -38,5 +37,4 @@ public final class ModifyAwareIterator<E> implements Iterator<E> {
|
||||
owner.setMarkedDirty(true);
|
||||
it.remove();
|
||||
}
|
||||
|
||||
}
|
||||
+2
-4
@@ -34,11 +34,11 @@ public final class ModifyAwareMap<K, V> implements Map<K, V>, ModifyAwareType, S
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o instanceof ModifyAwareMap) {
|
||||
ModifyAwareMap<?,?> that = (ModifyAwareMap<?,?>) o;
|
||||
ModifyAwareMap<?, ?> that = (ModifyAwareMap<?, ?>) o;
|
||||
return Objects.equals(map, that.map);
|
||||
}
|
||||
if (!(o instanceof Map)) return false;
|
||||
Map<?,?> that = (Map<?,?>) o;
|
||||
Map<?, ?> that = (Map<?, ?>) o;
|
||||
return Objects.equals(map, that);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,6 @@ public final class ModifyAwareMap<K, V> implements Map<K, V>, ModifyAwareType, S
|
||||
map.putAll(m);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (!map.isEmpty()) {
|
||||
@@ -135,5 +134,4 @@ public final class ModifyAwareMap<K, V> implements Map<K, V>, ModifyAwareType, S
|
||||
public Set<Map.Entry<K, V>> entrySet() {
|
||||
return new ModifyAwareSet<>(this, map.entrySet());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
module io.ebean.core.json {
|
||||
|
||||
requires io.ebean.api;
|
||||
|
||||
requires transitive com.fasterxml.jackson.core;
|
||||
exports io.ebeaninternal.json to io.ebean.test, io.ebean.core;
|
||||
|
||||
provides io.ebean.service.BootstrapService with io.ebeaninternal.json.DJsonService;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
io.ebeaninternal.json.DJsonService
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
+12
-6
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core</artifactId>
|
||||
@@ -22,7 +22,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-json</artifactId>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -46,7 +52,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -159,21 +165,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
import io.ebean.bean.EntityBean;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,10 +14,23 @@ public final class BindValuesKey {
|
||||
|
||||
private final List<Object> values = new ArrayList<>();
|
||||
|
||||
private final SpiEbeanServer server;
|
||||
|
||||
public BindValuesKey(SpiEbeanServer server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a bind value.
|
||||
*/
|
||||
public BindValuesKey add(Object value) {
|
||||
if (value instanceof EntityBean) {
|
||||
// only interested in id to keep the memory footprint low
|
||||
Object id = server.beanId(value);
|
||||
if (id != null) {
|
||||
value = id;
|
||||
}
|
||||
}
|
||||
values.add(value);
|
||||
return this;
|
||||
}
|
||||
@@ -31,5 +45,4 @@ public final class BindValuesKey {
|
||||
return values.hashCode();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -348,6 +348,8 @@ public interface SpiEbeanServer extends SpiServer, BeanCollectionLoader {
|
||||
|
||||
<T> FutureList<T> findFutureList(SpiQuery<T> query);
|
||||
|
||||
<K, T> FutureMap<K, T> findFutureMap(SpiQuery<T> query);
|
||||
|
||||
<T> PagedList<T> findPagedList(SpiQuery<T> query);
|
||||
|
||||
<T> Set<T> findSet(SpiQuery<T> query);
|
||||
|
||||
@@ -14,6 +14,7 @@ import io.ebeanservice.docstore.api.DocStoreTransaction;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* Extends Transaction with additional API required on server.
|
||||
@@ -64,12 +65,12 @@ public interface SpiTransaction extends Transaction {
|
||||
* <p>
|
||||
* This is to handle bi-directional relationships where both sides Cascade.
|
||||
*/
|
||||
void registerDeleteBean(Integer hash);
|
||||
void registerDeleteBean(Class<?> type, Object id);
|
||||
|
||||
/**
|
||||
* Return true if this is a bean that has already been saved/deleted.
|
||||
*/
|
||||
boolean isRegisteredDeleteBean(Integer hash);
|
||||
boolean isRegisteredDeleteBean(Class<?> type, Object id);
|
||||
|
||||
/**
|
||||
* Unregister the persisted beans. Expected after persisting top level beans
|
||||
@@ -95,7 +96,7 @@ public interface SpiTransaction extends Transaction {
|
||||
/**
|
||||
* Return the start timestamp for the transaction (JVM side).
|
||||
*/
|
||||
long startNanoTime();
|
||||
Instant startTime();
|
||||
|
||||
/**
|
||||
* Return true if this transaction has updateAllLoadedProperties set.
|
||||
@@ -361,4 +362,14 @@ public interface SpiTransaction extends Transaction {
|
||||
* Set the transaction to be inactive via external transaction manager.
|
||||
*/
|
||||
void deactivateExternal();
|
||||
|
||||
/**
|
||||
* Set autocommit to false for a findIterate query.
|
||||
* <p>
|
||||
* This is done for specific platforms that need it, in order to make
|
||||
* use cursors to stream a large or unbounded query result to the client.
|
||||
*/
|
||||
default void setAutoCommitOnFindIterate() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import io.ebeanservice.docstore.api.DocStoreTransaction;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* Proxy for an underlying SpiTransaction (most of the API).
|
||||
@@ -28,8 +29,8 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long startNanoTime() {
|
||||
return transaction.startNanoTime();
|
||||
public Instant startTime() {
|
||||
return transaction.startTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,13 +195,13 @@ public abstract class SpiTransactionProxy implements SpiTransaction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDeleteBean(Integer hash) {
|
||||
transaction.registerDeleteBean(hash);
|
||||
public void registerDeleteBean(Class<?> type, Object id) {
|
||||
transaction.registerDeleteBean(type, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRegisteredDeleteBean(Integer hash) {
|
||||
return transaction.isRegisteredDeleteBean(hash);
|
||||
public boolean isRegisteredDeleteBean(Class<?> type, Object id) {
|
||||
return transaction.isRegisteredDeleteBean(type, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class DefaultServerQueryCache extends DefaultServerCache {
|
||||
|
||||
@Override
|
||||
protected Object unwrapEntry(CacheEntry entry) {
|
||||
return ((QueryCacheEntry) entry.getValue()).getValue();
|
||||
return ((QueryCacheEntry) entry.getValue()).value();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.ebean.CancelableQuery;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.util.JdbcClose;
|
||||
import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.server.persist.Binder;
|
||||
@@ -98,6 +97,13 @@ public abstract class AbstractSqlQueryRequest implements CancelableQuery {
|
||||
public void setDefaultFetchBuffer(int fetchSize) {
|
||||
query.setDefaultFetchBuffer(fetchSize);
|
||||
}
|
||||
|
||||
public void setAutoCommitOnFindIterate() {
|
||||
if (createdTransaction) {
|
||||
transaction.setAutoCommitOnFindIterate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the underlying resources.
|
||||
*/
|
||||
|
||||
@@ -162,8 +162,10 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
this.scriptRunner = new DScriptRunner(this);
|
||||
|
||||
configureServerPlugins();
|
||||
// Register with the JVM Shutdown hook
|
||||
ShutdownManager.registerDatabase(this);
|
||||
if (this.config.shutdownHook() && "true".equalsIgnoreCase(System.getProperty("ebean.registerShutdownHook", "true"))) {
|
||||
// register with the JVM Shutdown hook
|
||||
ShutdownManager.registerDatabase(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -278,6 +280,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public DataSource readOnlyDataSource() {
|
||||
return transactionManager.readOnlyDataSource();
|
||||
}
|
||||
@@ -1249,66 +1252,55 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
}
|
||||
}
|
||||
|
||||
private <T> SpiQuery<T> configureForFuture(SpiQuery<T> query) {
|
||||
query.usingFuture();
|
||||
if (query.transaction() == null) {
|
||||
// use a current transaction if active
|
||||
query.usingTransaction(currentServerTransaction());
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> FutureRowCount<T> findFutureCount(SpiQuery<T> query) {
|
||||
SpiQuery<T> copy = query.copy();
|
||||
copy.usingFuture();
|
||||
boolean createdTransaction = false;
|
||||
SpiTransaction transaction = query.transaction();
|
||||
if (transaction == null) {
|
||||
transaction = currentServerTransaction();
|
||||
if (transaction == null) {
|
||||
transaction = (SpiTransaction) createTransaction();
|
||||
createdTransaction = true;
|
||||
}
|
||||
copy.usingTransaction(transaction);
|
||||
}
|
||||
var queryFuture = new QueryFutureRowCount<>(new CallableQueryCount<>(this, copy, createdTransaction));
|
||||
SpiQuery<T> copy = configureForFuture(query.copy());
|
||||
var queryFuture = new QueryFutureRowCount<>(new CallableQueryCount<>(this, copy));
|
||||
backgroundExecutor.execute(queryFuture.futureTask());
|
||||
return queryFuture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> FutureIds<T> findFutureIds(SpiQuery<T> query) {
|
||||
SpiQuery<T> copy = query.copy();
|
||||
copy.usingFuture();
|
||||
boolean createdTransaction = false;
|
||||
SpiTransaction transaction = query.transaction();
|
||||
if (transaction == null) {
|
||||
transaction = currentServerTransaction();
|
||||
if (transaction == null) {
|
||||
transaction = (SpiTransaction) createTransaction();
|
||||
createdTransaction = true;
|
||||
}
|
||||
copy.usingTransaction(transaction);
|
||||
}
|
||||
QueryFutureIds<T> queryFuture = new QueryFutureIds<>(new CallableQueryIds<>(this, copy, createdTransaction));
|
||||
SpiQuery<T> copy = configureForFuture(query.copy());
|
||||
final var queryFuture = new QueryFutureIds<T>(new CallableQueryIds<>(this, copy));
|
||||
backgroundExecutor.execute(queryFuture.futureTask());
|
||||
return queryFuture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> FutureList<T> findFutureList(SpiQuery<T> query) {
|
||||
SpiQuery<T> spiQuery = query.copy();
|
||||
spiQuery.usingFuture();
|
||||
// FutureList query always run in it's own persistence content
|
||||
SpiQuery<T> spiQuery = configureForFuture(query.copy());
|
||||
// FutureList query always run in its own persistence content
|
||||
spiQuery.setPersistenceContext(new DefaultPersistenceContext());
|
||||
if (!spiQuery.isDisableReadAudit()) {
|
||||
BeanDescriptor<T> desc = descriptorManager.descriptor(spiQuery.getBeanType());
|
||||
desc.readAuditFutureList(spiQuery);
|
||||
}
|
||||
// Create a new transaction solely to execute the findList() at some future time
|
||||
boolean createdTransaction = false;
|
||||
SpiTransaction transaction = query.transaction();
|
||||
if (transaction == null) {
|
||||
transaction = currentServerTransaction();
|
||||
if (transaction == null) {
|
||||
transaction = (SpiTransaction) createTransaction();
|
||||
createdTransaction = true;
|
||||
}
|
||||
spiQuery.usingTransaction(transaction);
|
||||
final var queryFuture = new QueryFutureList<T>(new CallableQueryList<>(this, spiQuery));
|
||||
backgroundExecutor.execute(queryFuture.futureTask());
|
||||
return queryFuture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, T> FutureMap<K, T> findFutureMap(SpiQuery<T> query) {
|
||||
SpiQuery<T> spiQuery = configureForFuture(query.copy());
|
||||
// FutureMap query always run in it's own persistence content
|
||||
spiQuery.setPersistenceContext(new DefaultPersistenceContext());
|
||||
if (!spiQuery.isDisableReadAudit()) {
|
||||
BeanDescriptor<T> desc = descriptorManager.descriptor(spiQuery.getBeanType());
|
||||
desc.readAuditFutureList(spiQuery);
|
||||
}
|
||||
QueryFutureList<T> queryFuture = new QueryFutureList<>(new CallableQueryList<>(this, spiQuery, createdTransaction));
|
||||
final var queryFuture = new QueryFutureMap<K, T>(new CallableQueryMap<>(this, spiQuery));
|
||||
backgroundExecutor.execute(queryFuture.futureTask());
|
||||
return queryFuture;
|
||||
}
|
||||
|
||||
@@ -301,12 +301,12 @@ public final class InternalConfiguration {
|
||||
}
|
||||
|
||||
DtoQueryEngine createDtoQueryEngine() {
|
||||
return new DtoQueryEngine(binder, config.getJdbcFetchSizeFindEach(), config.getJdbcFetchSizeFindList());
|
||||
return new DtoQueryEngine(binder, config.getJdbcFetchSizeFindEach(), config.getJdbcFetchSizeFindList(), databasePlatform.autoCommitFalseOnFindIterate());
|
||||
}
|
||||
|
||||
RelationalQueryEngine createRelationalQueryEngine() {
|
||||
return new DefaultRelationalQueryEngine(binder, config.getDatabaseBooleanTrue(), config.getPlatformConfig().getDbUuid().useBinaryOptimized(),
|
||||
config.getJdbcFetchSizeFindEach(), config.getJdbcFetchSizeFindList());
|
||||
config.getJdbcFetchSizeFindEach(), config.getJdbcFetchSizeFindList(), databasePlatform.autoCommitFalseOnFindIterate());
|
||||
}
|
||||
|
||||
OrmQueryEngine createOrmQueryEngine() {
|
||||
@@ -585,27 +585,32 @@ public final class InternalConfiguration {
|
||||
return QueryPlanManager.NOOP;
|
||||
}
|
||||
long threshold = config.getQueryPlanThresholdMicros();
|
||||
return new CQueryPlanManager(transactionManager, threshold, queryPlanLogger(databasePlatform.platform()), extraMetrics);
|
||||
return new CQueryPlanManager(transactionManager, threshold, queryPlanLogger(databasePlatform.platform(), config), extraMetrics);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the logger to log query plans for the given platform.
|
||||
*/
|
||||
QueryPlanLogger queryPlanLogger(Platform platform) {
|
||||
QueryPlanLogger queryPlanLogger(Platform platform, DatabaseBuilder.Settings config) {
|
||||
switch (platform.base()) {
|
||||
case SQLSERVER:
|
||||
return new QueryPlanLoggerSqlServer();
|
||||
case ORACLE:
|
||||
return new QueryPlanLoggerOracle();
|
||||
case POSTGRES:
|
||||
return new QueryPlanLoggerExplain("explain (analyze, buffers) ");
|
||||
return new QueryPlanLoggerExplain(explain(config, "explain (analyze, costs, verbose, buffers) "));
|
||||
case YUGABYTE:
|
||||
return new QueryPlanLoggerExplain("explain (analyze, buffers, dist) ");
|
||||
return new QueryPlanLoggerExplain(explain(config,"explain (analyze, buffers, dist) "));
|
||||
default:
|
||||
return new QueryPlanLoggerExplain("explain ");
|
||||
return new QueryPlanLoggerExplain(explain(config,"explain "));
|
||||
}
|
||||
}
|
||||
|
||||
private static String explain(DatabaseBuilder.Settings config, String defaultExplain) {
|
||||
String explain = config.getQueryPlanExplain();
|
||||
return explain == null ? defaultExplain : explain + ' ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DDL generator.
|
||||
*/
|
||||
|
||||
@@ -665,7 +665,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
}
|
||||
|
||||
public void putToQueryCache(Object result) {
|
||||
beanDescriptor.queryCachePut(cacheKey, new QueryCacheEntry(result, dependentTables, transaction.startNanoTime()));
|
||||
beanDescriptor.queryCachePut(cacheKey, new QueryCacheEntry(result, dependentTables, transaction.startTime()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -786,4 +786,10 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
beanDescriptor.freeze(bean);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAutoCommitOnFindIterate() {
|
||||
if (createdTransaction) {
|
||||
transaction.setAutoCommitOnFindIterate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,10 +54,6 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
* The unique id used for logging summary.
|
||||
*/
|
||||
private Object idValue;
|
||||
/**
|
||||
* Hash value used to handle cascade delete both ways in a relationship.
|
||||
*/
|
||||
private Integer beanHash;
|
||||
private boolean statelessUpdate;
|
||||
private boolean notifyCache;
|
||||
/**
|
||||
@@ -285,7 +281,9 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
private void onFailedUpdateUndoGeneratedProperties() {
|
||||
for (BeanProperty prop : beanDescriptor.propertiesGenUpdate()) {
|
||||
Object oldVal = intercept.origValue(prop.propertyIndex());
|
||||
prop.setValue(entityBean, oldVal);
|
||||
if (oldVal != null) {
|
||||
prop.setValue(entityBean, oldVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,34 +551,17 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The hash used to register the bean with the transaction.
|
||||
* <p>
|
||||
* Takes into account the class type and id value.
|
||||
*/
|
||||
private Integer beanHash() {
|
||||
if (beanHash == null) {
|
||||
Object id = beanDescriptor.getId(entityBean);
|
||||
int hc = 92821 * bean.getClass().getName().hashCode();
|
||||
if (id != null) {
|
||||
hc += id.hashCode();
|
||||
}
|
||||
beanHash = hc;
|
||||
}
|
||||
return beanHash;
|
||||
}
|
||||
|
||||
public void registerDeleteBean() {
|
||||
Integer hash = beanHash();
|
||||
transaction.registerDeleteBean(hash);
|
||||
final Object id = beanDescriptor.id(entityBean);
|
||||
transaction.registerDeleteBean(beanDescriptor.type(), id);
|
||||
}
|
||||
|
||||
public boolean isRegisteredForDeleteBean() {
|
||||
if (transaction == null) {
|
||||
return false;
|
||||
} else {
|
||||
Integer hash = beanHash();
|
||||
return transaction.isRegisteredDeleteBean(hash);
|
||||
final Object id = beanDescriptor.id(entityBean);
|
||||
return transaction.isRegisteredDeleteBean(beanDescriptor.type(), id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,7 +790,9 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
public void checkRowCount(int rowCount) {
|
||||
if (rowCount != 1 && rowCount != Statement.SUCCESS_NO_INFO) {
|
||||
if (ConcurrencyMode.VERSION == concurrencyMode) {
|
||||
onFailedUpdateUndoGeneratedProperties();
|
||||
if (type == Type.UPDATE) {
|
||||
onFailedUpdateUndoGeneratedProperties();
|
||||
}
|
||||
throw new OptimisticLockException("Data has changed. updated row count " + rowCount, null, bean);
|
||||
} else if (rowCount == 0 && type == Type.UPDATE) {
|
||||
throw new EntityNotFoundException("No rows updated");
|
||||
|
||||
@@ -1471,7 +1471,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
void queryPlanInit(QueryPlanInit request, List<MetaQueryPlan> list) {
|
||||
for (CQueryPlan queryPlan : queryPlanCache.values()) {
|
||||
if (request.includeHash(queryPlan.hash())) {
|
||||
queryPlan.queryPlanInit(request.thresholdMicros());
|
||||
queryPlan.queryPlanInit(request.thresholdMicros(queryPlan.hash()));
|
||||
list.add(queryPlan.createMeta(null, null));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ final class BeanEmbeddedMetaFactory {
|
||||
}
|
||||
|
||||
private static int dbLength(Column override, BeanProperty source) {
|
||||
return (override != null && (override.length() != 255)) ? override.length() : source.dbLength();
|
||||
return (override != null && (override.length() != 0)) ? override.length() : source.dbLength();
|
||||
}
|
||||
|
||||
private static int dbScale(Column override, BeanProperty source) {
|
||||
|
||||
@@ -436,14 +436,15 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
}
|
||||
TableJoinColumn[] cols = join.columns();
|
||||
if (!idProp.isEmbedded()) {
|
||||
// simple single scalar id
|
||||
if (cols.length != 1) {
|
||||
CoreLog.log.log(ERROR, "No Imported Id column for {0} in table {1}", idProp, join.getTable());
|
||||
return null;
|
||||
} else {
|
||||
BeanProperty[] idProps = {idProp};
|
||||
return createImportedScalar(owner, cols[0], idProps, others);
|
||||
// simple single scalar id, match on the foreign column, allow extra TableJoinColumn for #3664
|
||||
String matchColumn = idProp.dbColumn();
|
||||
for (TableJoinColumn col : cols) {
|
||||
if (matchColumn.equals(col.getForeignDbColumn())) {
|
||||
return createImportedScalar(owner, col, new BeanProperty[]{idProp}, others);
|
||||
}
|
||||
}
|
||||
CoreLog.log.log(ERROR, "No Imported Id column for {0} in table {1}", idProp, join.getTable());
|
||||
return null;
|
||||
} else {
|
||||
// embedded id
|
||||
BeanPropertyAssocOne<?> embProp = (BeanPropertyAssocOne<?>) idProp;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.Query;
|
||||
import io.ebean.SqlUpdate;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.ValuePair;
|
||||
@@ -125,15 +124,9 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
// no imported or exported information
|
||||
} else if (!oneToOneExported) {
|
||||
importedId = createImportedId(this, targetDescriptor, tableJoin);
|
||||
if (importedId.isScalar()) {
|
||||
// limit JoinColumn mapping to the @Id / primary key
|
||||
TableJoinColumn[] columns = tableJoin.columns();
|
||||
String foreignJoinColumn = columns[0].getForeignDbColumn();
|
||||
String foreignIdColumn = targetDescriptor.idProperty().dbColumn();
|
||||
if (!foreignJoinColumn.equalsIgnoreCase(foreignIdColumn)) {
|
||||
throw new PersistenceException("Mapping limitation - @JoinColumn on " + fullName() + " needs to map to a primary key as per Issue #529 "
|
||||
+ " - joining to " + foreignJoinColumn + " and not " + foreignIdColumn);
|
||||
}
|
||||
if (importedId == null) {
|
||||
throw new PersistenceException("Cannot find imported id for " + fullName() + " from " + targetDescriptor
|
||||
+ ". If using native-image, possibly missing reflect-config for the Id property.");
|
||||
}
|
||||
} else {
|
||||
exportedProperties = createExported();
|
||||
|
||||
@@ -264,6 +264,6 @@ public final class IdBinderSimple implements IdBinder {
|
||||
|
||||
@Override
|
||||
public String idNullOr(String prefix, String filterManyExpression) {
|
||||
return "(${" + prefix + "}" + idProperty.name() + " is null or (" + filterManyExpression + "))";
|
||||
return "(${" + prefix + "}" + idProperty.dbColumn() + " is null or (" + filterManyExpression + "))";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public abstract class AnnotationParser extends AnnotationBase {
|
||||
prop.setUnique(columnAnn.unique());
|
||||
if (columnAnn.precision() > 0) {
|
||||
prop.setDbLength(columnAnn.precision());
|
||||
} else if (columnAnn.length() != 255) {
|
||||
} else if (columnAnn.length() != 0) {
|
||||
// set default 255 on DbTypeMap
|
||||
prop.setDbLength(columnAnn.length());
|
||||
}
|
||||
|
||||
+6
-6
@@ -726,7 +726,7 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
|
||||
*/
|
||||
@Override
|
||||
public <T> Junction<T> conjunction(Query<T> query) {
|
||||
return new JunctionExpression<>(Junction.Type.AND, query, query.where());
|
||||
return new JunctionExpression<>(Junction.Type.AND, query, this, query.where());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -734,7 +734,7 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
|
||||
*/
|
||||
@Override
|
||||
public <T> Junction<T> disjunction(Query<T> query) {
|
||||
return new JunctionExpression<>(Junction.Type.OR, query, query.where());
|
||||
return new JunctionExpression<>(Junction.Type.OR, query, this, query.where());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -742,7 +742,7 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
|
||||
*/
|
||||
@Override
|
||||
public <T> Junction<T> conjunction(Query<T> query, ExpressionList<T> parent) {
|
||||
return new JunctionExpression<>(Junction.Type.AND, query, parent);
|
||||
return new JunctionExpression<>(Junction.Type.AND, query, this, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -750,14 +750,14 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
|
||||
*/
|
||||
@Override
|
||||
public <T> Junction<T> disjunction(Query<T> query, ExpressionList<T> parent) {
|
||||
return new JunctionExpression<>(Junction.Type.OR, query, parent);
|
||||
return new JunctionExpression<>(Junction.Type.OR, query, this, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of expressions that are wrapped by NOT.
|
||||
*/
|
||||
public <T> Junction<T> junction(Junction.Type type, Query<T> query) {
|
||||
return new JunctionExpression<>(type, query, query.where());
|
||||
return new JunctionExpression<>(type, query, this, query.where());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -765,6 +765,6 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
|
||||
*/
|
||||
@Override
|
||||
public <T> Junction<T> junction(Junction.Type type, Query<T> query, ExpressionList<T> parent) {
|
||||
return new JunctionExpression<>(type, query, parent);
|
||||
return new JunctionExpression<>(type, query, this, parent);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-6
@@ -40,12 +40,8 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
/**
|
||||
* Construct for Text root expression list - this handles implicit Bool Should, Must etc.
|
||||
*/
|
||||
public DefaultExpressionList(Query<T> query) {
|
||||
this(query, query.getExpressionFactory(), null, new ArrayList<>(), true);
|
||||
}
|
||||
|
||||
public DefaultExpressionList(Query<T> query, ExpressionList<T> parentExprList) {
|
||||
this(query, query.getExpressionFactory(), parentExprList, new ArrayList<>());
|
||||
public DefaultExpressionList(Query<T> query, boolean textRoot) {
|
||||
this(query, query.getExpressionFactory(), null, new ArrayList<>(), textRoot);
|
||||
}
|
||||
|
||||
DefaultExpressionList(Query<T> query, ExpressionFactory expr, ExpressionList<T> parentExprList, List<SpiExpression> list) {
|
||||
|
||||
@@ -24,9 +24,9 @@ final class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expr
|
||||
DefaultExpressionList<T> exprList;
|
||||
Junction.Type type;
|
||||
|
||||
JunctionExpression(Junction.Type type, Query<T> query, ExpressionList<T> parent) {
|
||||
JunctionExpression(Junction.Type type, Query<T> query, ExpressionFactory expr, ExpressionList<T> parent) {
|
||||
this.type = type;
|
||||
this.exprList = new DefaultExpressionList<>(query, parent);
|
||||
this.exprList = new DefaultExpressionList<>(query, expr, parent, new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,12 +37,14 @@ public final class CQueryEngine {
|
||||
private final CQueryBuilder queryBuilder;
|
||||
private final CQueryHistorySupport historySupport;
|
||||
private final DatabasePlatform dbPlatform;
|
||||
private final boolean autoCommitFalseOnFindIterate;
|
||||
|
||||
public CQueryEngine(DatabaseBuilder.Settings config, DatabasePlatform dbPlatform, Binder binder, Map<String, String> asOfTableMapping, Map<String, String> draftTableMap) {
|
||||
this.dbPlatform = dbPlatform;
|
||||
this.defaultFetchSizeFindEach = config.getJdbcFetchSizeFindEach();
|
||||
this.defaultFetchSizeFindList = config.getJdbcFetchSizeFindList();
|
||||
this.forwardOnlyHintOnFindIterate = dbPlatform.forwardOnlyHintOnFindIterate();
|
||||
this.autoCommitFalseOnFindIterate = dbPlatform.autoCommitFalseOnFindIterate();
|
||||
this.historySupport = new CQueryHistorySupport(dbPlatform.historySupport(), asOfTableMapping, config.getAsOfSysPeriod());
|
||||
this.queryBuilder = new CQueryBuilder(config, dbPlatform, binder, historySupport, new CQueryDraftSupport(draftTableMap));
|
||||
}
|
||||
@@ -181,6 +183,9 @@ public final class CQueryEngine {
|
||||
if (defaultFetchSizeFindEach > 0) {
|
||||
request.setDefaultFetchBuffer(defaultFetchSizeFindEach);
|
||||
}
|
||||
if (autoCommitFalseOnFindIterate) {
|
||||
request.setAutoCommitOnFindIterate();
|
||||
}
|
||||
if (!cquery.prepareBindExecuteQueryForwardOnly(forwardOnlyHintOnFindIterate)) {
|
||||
// query has been cancelled already
|
||||
return null;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.ebeaninternal.server.query;
|
||||
|
||||
import io.ebean.Transaction;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
|
||||
@@ -11,11 +10,9 @@ abstract class CallableQuery<T> {
|
||||
|
||||
final SpiQuery<T> query;
|
||||
final SpiEbeanServer server;
|
||||
final Transaction transaction;
|
||||
|
||||
CallableQuery(SpiEbeanServer server, SpiQuery<T> query) {
|
||||
this.server = server;
|
||||
this.query = query;
|
||||
this.transaction = query.transaction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,15 +10,8 @@ import java.util.concurrent.Callable;
|
||||
*/
|
||||
public final class CallableQueryCount<T> extends CallableQuery<T> implements Callable<Integer> {
|
||||
|
||||
private final boolean createdTransaction;
|
||||
|
||||
/**
|
||||
* Note that the transaction passed in is always a new transaction solely to
|
||||
* find the row count so it must be cleaned up by this CallableQueryRowCount.
|
||||
*/
|
||||
public CallableQueryCount(SpiEbeanServer server, SpiQuery<T> query, boolean createdTransaction) {
|
||||
public CallableQueryCount(SpiEbeanServer server, SpiQuery<T> query) {
|
||||
super(server, query);
|
||||
this.createdTransaction = createdTransaction;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,13 +19,7 @@ public final class CallableQueryCount<T> extends CallableQuery<T> implements Cal
|
||||
*/
|
||||
@Override
|
||||
public Integer call() {
|
||||
try {
|
||||
return server.findCountWithCopy(query);
|
||||
} finally {
|
||||
if (createdTransaction) {
|
||||
transaction.end();
|
||||
}
|
||||
}
|
||||
return server.findCountWithCopy(query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,28 +11,16 @@ import java.util.concurrent.Callable;
|
||||
*/
|
||||
public final class CallableQueryIds<T> extends CallableQuery<T> implements Callable<List<Object>> {
|
||||
|
||||
private final boolean createdTransaction;
|
||||
|
||||
public CallableQueryIds(SpiEbeanServer server, SpiQuery<T> query, boolean createdTransaction) {
|
||||
public CallableQueryIds(SpiEbeanServer server, SpiQuery<T> query) {
|
||||
super(server, query);
|
||||
this.createdTransaction = createdTransaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the find Id's query returning the list of Id's.
|
||||
*/
|
||||
@Override
|
||||
public List<Object> call() {
|
||||
// we have already made a copy of the query
|
||||
// this way the same query instance is available to the
|
||||
// QueryFutureIds (as so has access to the List before it is done)
|
||||
try {
|
||||
return server.findIdsWithCopy(query);
|
||||
} finally {
|
||||
if (createdTransaction) {
|
||||
transaction.end();
|
||||
}
|
||||
}
|
||||
return server.findIdsWithCopy(query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,25 +11,13 @@ import java.util.concurrent.Callable;
|
||||
*/
|
||||
public final class CallableQueryList<T> extends CallableQuery<T> implements Callable<List<T>> {
|
||||
|
||||
private final boolean createdTransaction;
|
||||
|
||||
public CallableQueryList(SpiEbeanServer server, SpiQuery<T> query, boolean createdTransaction) {
|
||||
public CallableQueryList(SpiEbeanServer server, SpiQuery<T> query) {
|
||||
super(server, query);
|
||||
this.createdTransaction = createdTransaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the query returning the resulting List.
|
||||
*/
|
||||
@Override
|
||||
public List<T> call() {
|
||||
try {
|
||||
return server.findList(query);
|
||||
} finally {
|
||||
if (createdTransaction) {
|
||||
transaction.end();
|
||||
}
|
||||
}
|
||||
return server.findList(query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package io.ebeaninternal.server.query;
|
||||
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
/**
|
||||
* Represent the findMap query as a Callable.
|
||||
*/
|
||||
public final class CallableQueryMap<K, T> extends CallableQuery<T> implements Callable<Map<K, T>> {
|
||||
|
||||
public CallableQueryMap(SpiEbeanServer server, SpiQuery<T> query) {
|
||||
super(server, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<K, T> call() {
|
||||
return server.findMap(query);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -365,6 +365,11 @@ final class DefaultFetchGroupQuery<T> implements SpiFetchGroupQuery<T>, SpiQuery
|
||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K> FutureMap<K,T> findFutureMap() {
|
||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PagedList<T> findPagedList() {
|
||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||
|
||||
+18
-9
@@ -15,6 +15,8 @@ import io.ebeaninternal.server.core.RowReader;
|
||||
import io.ebeaninternal.server.persist.Binder;
|
||||
|
||||
import jakarta.persistence.PersistenceException;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
@@ -28,15 +30,18 @@ public final class DefaultRelationalQueryEngine implements RelationalQueryEngine
|
||||
private final Binder binder;
|
||||
private final String dbTrueValue;
|
||||
private final boolean binaryOptimizedUUID;
|
||||
private final boolean autoCommitFalseOnFindIterate;
|
||||
private final TimedMetricMap timedMetricMap;
|
||||
private final int defaultFetchSizeFindEach;
|
||||
private final int defaultFetchSizeFindList;
|
||||
|
||||
public DefaultRelationalQueryEngine(Binder binder, String dbTrueValue, boolean binaryOptimizedUUID,
|
||||
int defaultFetchSizeFindEach, int defaultFetchSizeFindList) {
|
||||
int defaultFetchSizeFindEach, int defaultFetchSizeFindList,
|
||||
boolean autoCommitFalseOnFindIterate) {
|
||||
this.binder = binder;
|
||||
this.dbTrueValue = dbTrueValue == null ? "true" : dbTrueValue;
|
||||
this.binaryOptimizedUUID = binaryOptimizedUUID;
|
||||
this.autoCommitFalseOnFindIterate = autoCommitFalseOnFindIterate;
|
||||
this.timedMetricMap = MetricFactory.get().createTimedMetricMap("sql.query.");
|
||||
this.defaultFetchSizeFindEach = defaultFetchSizeFindEach;
|
||||
this.defaultFetchSizeFindList = defaultFetchSizeFindList;
|
||||
@@ -61,13 +66,20 @@ public final class DefaultRelationalQueryEngine implements RelationalQueryEngine
|
||||
return "Query threw SQLException:" + msg + " Query was:" + sql;
|
||||
}
|
||||
|
||||
private <T> void prepareForIterate(RelationalQueryRequest request) throws SQLException {
|
||||
if (defaultFetchSizeFindEach > 0) {
|
||||
request.setDefaultFetchBuffer(defaultFetchSizeFindEach);
|
||||
}
|
||||
if (autoCommitFalseOnFindIterate) {
|
||||
request.setAutoCommitOnFindIterate();
|
||||
}
|
||||
request.executeSql(binder, SpiQuery.Type.ITERATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findEach(RelationalQueryRequest request, RowConsumer consumer) {
|
||||
try {
|
||||
if (defaultFetchSizeFindEach > 0) {
|
||||
request.setDefaultFetchBuffer(defaultFetchSizeFindEach);
|
||||
}
|
||||
request.executeSql(binder, SpiQuery.Type.ITERATE);
|
||||
prepareForIterate(request);
|
||||
request.mapEach(consumer);
|
||||
request.logSummary();
|
||||
|
||||
@@ -82,10 +94,7 @@ public final class DefaultRelationalQueryEngine implements RelationalQueryEngine
|
||||
@Override
|
||||
public <T> void findEach(RelationalQueryRequest request, RowReader<T> reader, Predicate<T> consumer) {
|
||||
try {
|
||||
if (defaultFetchSizeFindEach > 0) {
|
||||
request.setDefaultFetchBuffer(defaultFetchSizeFindEach);
|
||||
}
|
||||
request.executeSql(binder, SpiQuery.Type.ITERATE);
|
||||
prepareForIterate(request);
|
||||
while (request.next()) {
|
||||
if (!consumer.test(reader.read())) {
|
||||
break;
|
||||
|
||||
@@ -17,11 +17,13 @@ public final class DtoQueryEngine {
|
||||
private final Binder binder;
|
||||
private final int defaultFetchSizeFindEach;
|
||||
private final int defaultFetchSizeFindList;
|
||||
private final boolean autoCommitFalseOnFindIterate;
|
||||
|
||||
public DtoQueryEngine(Binder binder, int defaultFetchSizeFindEach, int defaultFetchSizeFindList) {
|
||||
public DtoQueryEngine(Binder binder, int defaultFetchSizeFindEach, int defaultFetchSizeFindList, boolean autoCommitFalseOnFindIterate) {
|
||||
this.binder = binder;
|
||||
this.defaultFetchSizeFindEach = defaultFetchSizeFindEach;
|
||||
this.defaultFetchSizeFindList = defaultFetchSizeFindList;
|
||||
this.autoCommitFalseOnFindIterate = autoCommitFalseOnFindIterate;
|
||||
}
|
||||
|
||||
public <T> List<T> findList(DtoQueryRequest<T> request) {
|
||||
@@ -43,12 +45,19 @@ public final class DtoQueryEngine {
|
||||
}
|
||||
}
|
||||
|
||||
private <T> void prepareForIterate(DtoQueryRequest<T> request) throws SQLException {
|
||||
if (defaultFetchSizeFindEach > 0) {
|
||||
request.setDefaultFetchBuffer(defaultFetchSizeFindEach);
|
||||
}
|
||||
if (autoCommitFalseOnFindIterate) {
|
||||
request.setAutoCommitOnFindIterate();
|
||||
}
|
||||
request.executeSql(binder, SpiQuery.Type.ITERATE);
|
||||
}
|
||||
|
||||
public <T> QueryIterator<T> findIterate(DtoQueryRequest<T> request) {
|
||||
try {
|
||||
if (defaultFetchSizeFindEach > 0) {
|
||||
request.setDefaultFetchBuffer(defaultFetchSizeFindEach);
|
||||
}
|
||||
request.executeSql(binder, SpiQuery.Type.ITERATE);
|
||||
prepareForIterate(request);
|
||||
return new DtoQueryIterator<>(request);
|
||||
} catch (SQLException e) {
|
||||
throw new PersistenceException(errMsg(e.getMessage(), request.getSql()), e);
|
||||
@@ -57,10 +66,7 @@ public final class DtoQueryEngine {
|
||||
|
||||
public <T> void findEach(DtoQueryRequest<T> request, Consumer<T> consumer) {
|
||||
try {
|
||||
if (defaultFetchSizeFindEach > 0) {
|
||||
request.setDefaultFetchBuffer(defaultFetchSizeFindEach);
|
||||
}
|
||||
request.executeSql(binder, SpiQuery.Type.ITERATE);
|
||||
prepareForIterate(request);
|
||||
while (request.next()) {
|
||||
consumer.accept(request.readNextBean());
|
||||
}
|
||||
@@ -73,11 +79,8 @@ public final class DtoQueryEngine {
|
||||
|
||||
public <T> void findEach(DtoQueryRequest<T> request, int batchSize, Consumer<List<T>> consumer) {
|
||||
try {
|
||||
prepareForIterate(request);
|
||||
List<T> buffer = new ArrayList<>();
|
||||
if (defaultFetchSizeFindEach > 0) {
|
||||
request.setDefaultFetchBuffer(defaultFetchSizeFindEach);
|
||||
}
|
||||
request.executeSql(binder, SpiQuery.Type.ITERATE);
|
||||
while (request.next()) {
|
||||
buffer.add(request.readNextBean());
|
||||
if (buffer.size() >= batchSize) {
|
||||
@@ -98,10 +101,7 @@ public final class DtoQueryEngine {
|
||||
|
||||
public <T> void findEachWhile(DtoQueryRequest<T> request, Predicate<T> consumer) {
|
||||
try {
|
||||
if (defaultFetchSizeFindEach > 0) {
|
||||
request.setDefaultFetchBuffer(defaultFetchSizeFindEach);
|
||||
}
|
||||
request.executeSql(binder, SpiQuery.Type.ITERATE);
|
||||
prepareForIterate(request);
|
||||
while (request.next()) {
|
||||
if (!consumer.test(request.readNextBean())) {
|
||||
break;
|
||||
|
||||
@@ -23,10 +23,6 @@ public final class QueryFutureIds<T> extends BaseFuture<List<Object>> implements
|
||||
return futureTask;
|
||||
}
|
||||
|
||||
public Transaction transaction() {
|
||||
return call.transaction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query<T> getQuery() {
|
||||
return call.query;
|
||||
|
||||
@@ -27,10 +27,6 @@ public final class QueryFutureList<T> extends BaseFuture<List<T>> implements Fut
|
||||
return futureTask;
|
||||
}
|
||||
|
||||
public Transaction transaction() {
|
||||
return call.transaction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query<T> getQuery() {
|
||||
return call.query;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package io.ebeaninternal.server.query;
|
||||
|
||||
import io.ebean.FutureMap;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.Transaction;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
/**
|
||||
* Default implementation for FutureMap.
|
||||
*/
|
||||
public final class QueryFutureMap<K, T> extends BaseFuture<Map<K, T>> implements FutureMap<K, T> {
|
||||
|
||||
private final CallableQueryMap<K, T> call;
|
||||
|
||||
public QueryFutureMap(CallableQueryMap<K, T> call) {
|
||||
super(new FutureTask<>(call));
|
||||
this.call = call;
|
||||
}
|
||||
|
||||
public FutureTask<Map<K, T>> futureTask() {
|
||||
return futureTask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query<T> getQuery() {
|
||||
return call.query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
call.query.cancel();
|
||||
return super.cancel(mayInterruptIfRunning);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<K, T> getUnchecked() {
|
||||
try {
|
||||
return get();
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
// restore the interrupted status (so client can check for that)
|
||||
Thread.currentThread().interrupt();
|
||||
throw new PersistenceException(e);
|
||||
|
||||
} catch (ExecutionException e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<K, T> getUnchecked(long timeout, TimeUnit unit) throws TimeoutException {
|
||||
try {
|
||||
return get(timeout, unit);
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
// restore the interrupted status (so client can check for that)
|
||||
Thread.currentThread().interrupt();
|
||||
throw new PersistenceException(e);
|
||||
|
||||
} catch (ExecutionException e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,10 +21,6 @@ public final class QueryFutureRowCount<T> extends BaseFuture<Integer> implements
|
||||
return futureTask;
|
||||
}
|
||||
|
||||
public Transaction transaction() {
|
||||
return call.transaction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
call.query.cancel();
|
||||
|
||||
@@ -76,6 +76,7 @@ final class SqlTreeNodeRoot extends SqlTreeNodeBean {
|
||||
|
||||
@Override
|
||||
public void dependentTables(Set<String> tables) {
|
||||
tables.add(baseTable);
|
||||
for (SqlTreeNode child : children) {
|
||||
child.dependentTables(tables);
|
||||
}
|
||||
|
||||
@@ -1244,7 +1244,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
|
||||
public final HashQuery queryHash() {
|
||||
// calculateQueryPlanHash is called just after potential AutoTune tuning
|
||||
// so queryPlanHash is calculated well before this method is called
|
||||
BindValuesKey bindKey = new BindValuesKey();
|
||||
BindValuesKey bindKey = new BindValuesKey(server);
|
||||
queryBindKey(bindKey);
|
||||
return new HashQuery(queryPlanKey, bindKey);
|
||||
}
|
||||
@@ -1614,6 +1614,11 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
|
||||
return server.findFutureList(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <K> FutureMap<K, T> findFutureMap() {
|
||||
return server.findFutureMap(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final FutureRowCount<T> findFutureCount() {
|
||||
return server.findFutureCount(this);
|
||||
@@ -1890,7 +1895,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
|
||||
public final ExpressionList<T> text() {
|
||||
if (textExpressions == null) {
|
||||
useDocStore = true;
|
||||
textExpressions = new DefaultExpressionList<>(this);
|
||||
textExpressions = new DefaultExpressionList<>(this, true);
|
||||
}
|
||||
return textExpressions;
|
||||
}
|
||||
@@ -1898,7 +1903,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
|
||||
@Override
|
||||
public final ExpressionList<T> where() {
|
||||
if (whereExpressions == null) {
|
||||
whereExpressions = new DefaultExpressionList<>(this, null);
|
||||
whereExpressions = new DefaultExpressionList<>(this, false);
|
||||
}
|
||||
return whereExpressions;
|
||||
}
|
||||
@@ -1919,7 +1924,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
|
||||
@Override
|
||||
public final ExpressionList<T> having() {
|
||||
if (havingExpressions == null) {
|
||||
havingExpressions = new DefaultExpressionList<>(this, null);
|
||||
havingExpressions = new DefaultExpressionList<>(this, false);
|
||||
}
|
||||
return havingExpressions;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.ebeaninternal.server.transaction;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
@@ -25,6 +27,7 @@ public interface DataSourceSupplier {
|
||||
* This can return null meaning that no read only DataSource (with autoCommit)
|
||||
* is available for use so normal transactions with explicit commit should be used.
|
||||
*/
|
||||
@Nullable
|
||||
DataSource readOnlyDataSource();
|
||||
|
||||
/**
|
||||
|
||||
+17
-6
@@ -14,6 +14,7 @@ import io.ebeanservice.docstore.api.DocStoreTransaction;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -35,7 +36,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
|
||||
/**
|
||||
* Set false when using autoCommit (as a performance optimisation for the read-only case).
|
||||
*/
|
||||
private final boolean useCommit;
|
||||
private boolean useCommit;
|
||||
private final TransactionManager manager;
|
||||
private final SpiTxnLogger logger;
|
||||
private final boolean logSql;
|
||||
@@ -58,6 +59,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
|
||||
private SpiPersistenceContext persistenceContext;
|
||||
private Object tenantId;
|
||||
private Map<String, Object> userObjects;
|
||||
private final Instant startTime = Instant.now();
|
||||
private final long startNanos;
|
||||
private ProfileLocation profileLocation;
|
||||
|
||||
@@ -89,9 +91,8 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
|
||||
}
|
||||
|
||||
@Override
|
||||
public long startNanoTime() {
|
||||
// not used on read only transaction
|
||||
return startNanos;
|
||||
public Instant startTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,7 +200,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDeleteBean(Integer persistingBean) {
|
||||
public void registerDeleteBean(Class<?> type, Object id) {
|
||||
throw new IllegalStateException(notExpectedMessage);
|
||||
}
|
||||
|
||||
@@ -207,7 +208,7 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
|
||||
* Return true if this is a bean that has already been saved/deleted.
|
||||
*/
|
||||
@Override
|
||||
public boolean isRegisteredDeleteBean(Integer persistingBean) {
|
||||
public boolean isRegisteredDeleteBean(Class<?> type, Object id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -549,6 +550,16 @@ final class ImplicitReadOnlyTransaction implements SpiTransaction, TxnProfileEve
|
||||
throw new IllegalStateException(notExpectedMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAutoCommitOnFindIterate() {
|
||||
try {
|
||||
connection.setAutoCommit(false);
|
||||
useCommit = true;
|
||||
} catch (SQLException e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollbackAndContinue() {
|
||||
// do nothing
|
||||
|
||||
@@ -17,6 +17,7 @@ import jakarta.persistence.PersistenceException;
|
||||
import jakarta.persistence.RollbackException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -67,7 +68,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
private int depth;
|
||||
private boolean autoCommit;
|
||||
private IdentityHashMap<Object, Object> persistingBeans;
|
||||
private HashSet<Integer> deletingBeansHash;
|
||||
private Map<Class<?>, Set<Object>> deletingBeans;
|
||||
private HashMap<String, String> m2mIntersectionSave;
|
||||
private Map<String, Object> userObjects;
|
||||
private List<TransactionCallback> callbackList;
|
||||
@@ -91,6 +92,7 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
DocStoreTransaction docStoreTxn;
|
||||
private ProfileStream profileStream;
|
||||
private ProfileLocation profileLocation;
|
||||
private final Instant startTime = Instant.now();
|
||||
private final long startNanos;
|
||||
private boolean autoPersistUpdates;
|
||||
|
||||
@@ -141,8 +143,8 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final long startNanoTime() {
|
||||
return startNanos;
|
||||
public final Instant startTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -326,40 +328,28 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
deferredList.add(derived);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a bean to the registed list.
|
||||
* <p>
|
||||
* This is to handle bi-directional relationships where both sides Cascade.
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public final void registerDeleteBean(Integer persistingBean) {
|
||||
if (deletingBeansHash == null) {
|
||||
deletingBeansHash = new HashSet<>();
|
||||
public final void registerDeleteBean(Class<?> type, Object id) {
|
||||
deleteBeanIds(type).add(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isRegisteredDeleteBean(Class<?> type, Object id) {
|
||||
return deleteBeanIds(type).contains(id);
|
||||
}
|
||||
|
||||
private Set<Object> deleteBeanIds(Class<?> type) {
|
||||
if (deletingBeans == null) {
|
||||
deletingBeans = new HashMap<>();
|
||||
}
|
||||
deletingBeansHash.add(persistingBean);
|
||||
return deletingBeans.computeIfAbsent(type, k -> new HashSet<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a bean that has already been saved/deleted.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isRegisteredDeleteBean(Integer persistingBean) {
|
||||
return deletingBeansHash != null && deletingBeansHash.contains(persistingBean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister the persisted beans (when persisting at the top level).
|
||||
*/
|
||||
@Override
|
||||
public final void unregisterBeans() {
|
||||
persistingBeans.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a bean that has already been saved. This will
|
||||
* register the bean if it is not already.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isRegisteredBean(Object bean) {
|
||||
if (persistingBeans == null) {
|
||||
@@ -368,10 +358,6 @@ class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
|
||||
return (persistingBeans.put(bean, PLACEHOLDER) != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the m2m intersection save is allowed from a given bean direction.
|
||||
* This is to stop m2m intersection management via both directions of a m2m.
|
||||
*/
|
||||
@Override
|
||||
public final boolean isSaveAssocManyIntersection(String intersectionTable, String beanName) {
|
||||
if (m2mIntersectionSave == null) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import io.ebeanservice.docstore.api.DocStoreTransaction;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* Placeholder for use with SUPPORTS and NEVER transactional when there really isn't a transaction.
|
||||
@@ -56,9 +57,9 @@ final class NoTransaction implements SpiTransaction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long startNanoTime() {
|
||||
public Instant startTime() {
|
||||
// not used
|
||||
return System.nanoTime();
|
||||
return Instant.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,12 +154,12 @@ final class NoTransaction implements SpiTransaction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDeleteBean(Integer hash) {
|
||||
public void registerDeleteBean(Class<?> type, Object id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRegisteredDeleteBean(Integer hash) {
|
||||
public boolean isRegisteredDeleteBean(Class<?> type, Object id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.ebean.cache.QueryCacheEntryValidate;
|
||||
import io.ebean.cache.ServerCacheNotification;
|
||||
import io.ebean.cache.ServerCacheNotify;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -23,7 +24,7 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
|
||||
private static final System.Logger log = AppLog.getLogger("io.ebean.cache.TABLEMOD");
|
||||
|
||||
private final Map<String, Long> tableModStamp = new ConcurrentHashMap<>();
|
||||
private final Map<String, Instant> tableModStamp = new ConcurrentHashMap<>();
|
||||
|
||||
public TableModState() {
|
||||
}
|
||||
@@ -32,22 +33,22 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
* Set the modified timestamp on the tables that have been touched.
|
||||
*/
|
||||
void touch(Set<String> touchedTables) {
|
||||
long modNanoTime = System.nanoTime();
|
||||
final var modTime = Instant.now();
|
||||
for (String tableName : touchedTables) {
|
||||
tableModStamp.put(tableName, modNanoTime);
|
||||
tableModStamp.put(tableName, modTime);
|
||||
}
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "TableModState updated - touched:{0} modNanoTime:{1}", touchedTables, modNanoTime);
|
||||
log.log(DEBUG, "TableModState updated - touched:{0} modTime:{1}", touchedTables, modTime);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if all the tables are valid based on timestamp comparison.
|
||||
*/
|
||||
boolean isValid(Set<String> tables, long sinceNanoTime) {
|
||||
boolean isValid(Set<String> tables, Instant sinceTime) {
|
||||
for (String tableName : tables) {
|
||||
Long modTime = tableModStamp.get(tableName);
|
||||
if (modTime != null && modTime >= sinceNanoTime) {
|
||||
final var modTime = tableModStamp.get(tableName);
|
||||
if (modTime != null && !modTime.isBefore(sinceTime)) {
|
||||
if (log.isLoggable(TRACE)) {
|
||||
log.log(TRACE, "Invalidate on table:{0}", tableName);
|
||||
}
|
||||
@@ -59,9 +60,9 @@ public final class TableModState implements QueryCacheEntryValidate, ServerCache
|
||||
|
||||
@Override
|
||||
public boolean isValid(QueryCacheEntry entry) {
|
||||
Set<String> dependentTables = entry.getDependentTables();
|
||||
Set<String> dependentTables = entry.dependentTables();
|
||||
if (dependentTables != null && !dependentTables.isEmpty()) {
|
||||
return isValid(dependentTables, entry.getTimestamp());
|
||||
return isValid(dependentTables, entry.timestamp());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ abstract class TransactionFactory {
|
||||
/**
|
||||
* Set the Transaction Isolation level if required.
|
||||
*/
|
||||
final SpiTransaction setIsolationLevel(SpiTransaction t, boolean explicit, int isolationLevel) {
|
||||
final SpiTransaction setIsolationLevel(SpiTransaction t, int isolationLevel) {
|
||||
if (isolationLevel > -1) {
|
||||
Connection connection = t.internalConnection();
|
||||
try {
|
||||
|
||||
+2
-6
@@ -39,8 +39,8 @@ class TransactionFactoryBasic extends TransactionFactory {
|
||||
Connection connection = null;
|
||||
try {
|
||||
connection = dataSource.getConnection();
|
||||
SpiTransaction t = create(explicit, connection);
|
||||
return setIsolationLevel(t, explicit, isolationLevel);
|
||||
SpiTransaction t = manager.createTransaction(explicit, connection);
|
||||
return setIsolationLevel(t, isolationLevel);
|
||||
} catch (PersistenceException ex) {
|
||||
JdbcClose.close(connection);
|
||||
throw ex;
|
||||
@@ -49,8 +49,4 @@ class TransactionFactoryBasic extends TransactionFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private SpiTransaction create(boolean explicit, Connection c) {
|
||||
return manager.createTransaction(explicit, c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+17
-11
@@ -25,26 +25,32 @@ class TransactionFactoryTenant extends TransactionFactory {
|
||||
|
||||
@Override
|
||||
public SpiTransaction createReadOnlyTransaction(Object tenantId, boolean useMaster) {
|
||||
return create(false, tenantId);
|
||||
Connection connection = null;
|
||||
try {
|
||||
if (tenantId == null) {
|
||||
tenantId = tenantProvider.currentId();
|
||||
}
|
||||
connection = dataSourceSupplier.readOnlyConnection(tenantId, useMaster);
|
||||
return new ImplicitReadOnlyTransaction(manager, connection, tenantId);
|
||||
|
||||
} catch (PersistenceException ex) {
|
||||
JdbcClose.close(connection);
|
||||
throw ex;
|
||||
|
||||
} catch (SQLException ex) {
|
||||
throw new PersistenceException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SpiTransaction createTransaction(boolean explicit, int isolationLevel) {
|
||||
SpiTransaction t = create(explicit, null);
|
||||
return setIsolationLevel(t, explicit, isolationLevel);
|
||||
}
|
||||
|
||||
private SpiTransaction create(boolean explicit, Object tenantId) {
|
||||
Connection connection = null;
|
||||
try {
|
||||
if (tenantId == null) {
|
||||
// tenantId not set (by lazy loading) so get current tenantId
|
||||
tenantId = tenantProvider.currentId();
|
||||
}
|
||||
Object tenantId = tenantProvider.currentId();
|
||||
connection = dataSourceSupplier.connection(tenantId);
|
||||
SpiTransaction transaction = manager.createTransaction(explicit, connection);
|
||||
transaction.setTenantId(tenantId);
|
||||
return transaction;
|
||||
return setIsolationLevel(transaction, isolationLevel);
|
||||
|
||||
} catch (PersistenceException ex) {
|
||||
JdbcClose.close(connection);
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.ebean.cache.ServerCacheNotification;
|
||||
import io.ebean.cache.ServerCacheNotify;
|
||||
import io.ebean.config.CurrentTenantProvider;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.datasource.DataSourcePool;
|
||||
import io.ebean.event.changelog.ChangeLogListener;
|
||||
import io.ebean.event.changelog.ChangeLogPrepare;
|
||||
import io.ebean.event.changelog.ChangeSet;
|
||||
@@ -30,6 +31,8 @@ import io.ebeanservice.docstore.api.DocStoreUpdateProcessor;
|
||||
import io.ebeanservice.docstore.api.DocStoreUpdates;
|
||||
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
@@ -257,6 +260,7 @@ public class TransactionManager implements SpiTransactionManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final DataSource readOnlyDataSource() {
|
||||
return dataSourceSupplier.readOnlyDataSource();
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ module io.ebean.core {
|
||||
requires io.ebean.types;
|
||||
|
||||
requires static io.avaje.jsr305x;
|
||||
requires static io.ebean.core.json;
|
||||
requires static com.fasterxml.jackson.annotation;
|
||||
requires static com.fasterxml.jackson.core;
|
||||
requires static com.fasterxml.jackson.databind;
|
||||
@@ -49,7 +50,6 @@ module io.ebean.core {
|
||||
|
||||
exports io.ebeaninternal.api to io.ebean.ddl.generator, io.ebean.querybean, io.ebean.autotune, io.ebean.postgis, io.ebean.test, io.ebean.elastic, io.ebean.spring.txn, io.ebean.postgis.types;
|
||||
exports io.ebeaninternal.api.json to io.ebean.test;
|
||||
exports io.ebeaninternal.json to io.ebean.test;
|
||||
exports io.ebeaninternal.server.autotune to io.ebean.autotune;
|
||||
exports io.ebeaninternal.server.core to io.ebean.test, io.ebean.elastic;
|
||||
exports io.ebeaninternal.server.core.bootup to io.ebean.test;
|
||||
@@ -78,7 +78,6 @@ module io.ebean.core {
|
||||
io.ebeaninternal.server.query.DFetchGroupService,
|
||||
io.ebeaninternal.server.profile.DProfileLocationFactory,
|
||||
io.ebeaninternal.server.rawsql.DRawSqlService,
|
||||
io.ebeaninternal.server.profile.DMetricFactory,
|
||||
io.ebeaninternal.json.DJsonService;
|
||||
io.ebeaninternal.server.profile.DMetricFactory;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,4 +3,3 @@ io.ebeaninternal.server.rawsql.DRawSqlService
|
||||
io.ebeaninternal.server.query.DFetchGroupService
|
||||
io.ebeaninternal.server.profile.DProfileLocationFactory
|
||||
io.ebeaninternal.server.profile.DMetricFactory
|
||||
io.ebeaninternal.json.DJsonService
|
||||
|
||||
@@ -70,7 +70,7 @@ public class RawExpressionTest extends BaseExpressionTest {
|
||||
}
|
||||
|
||||
private BindValuesKey bindKey(RawExpression query) {
|
||||
BindValuesKey bindValuesKey = new BindValuesKey();
|
||||
BindValuesKey bindValuesKey = new BindValuesKey(spiEbeanServer());
|
||||
query.queryBindKey(bindValuesKey);
|
||||
return bindValuesKey;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
package io.ebeaninternal.server.querydefn;
|
||||
|
||||
import io.ebeaninternal.api.BindValuesKey;
|
||||
import io.ebeaninternal.server.deploy.BaseTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class BindValuesKeyTest {
|
||||
public class BindValuesKeyTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void update_with_null() {
|
||||
|
||||
BindValuesKey hash = new BindValuesKey();
|
||||
BindValuesKey hash = new BindValuesKey(spiEbeanServer());
|
||||
hash.add(1).add(null).add("hello");
|
||||
|
||||
BindValuesKey hash2 = new BindValuesKey();
|
||||
BindValuesKey hash2 = new BindValuesKey(spiEbeanServer());
|
||||
hash2.add(1).add(null).add("hello");
|
||||
|
||||
assertThat(hash).isEqualTo(hash2);
|
||||
@@ -22,13 +23,13 @@ public class BindValuesKeyTest {
|
||||
@Test
|
||||
public void notEqual() {
|
||||
|
||||
BindValuesKey hash = new BindValuesKey();
|
||||
BindValuesKey hash = new BindValuesKey(spiEbeanServer());
|
||||
hash.add(1).add(null).add("hello");
|
||||
|
||||
BindValuesKey hash2 = new BindValuesKey();
|
||||
BindValuesKey hash2 = new BindValuesKey(spiEbeanServer());
|
||||
hash2.add(1).add("hello");
|
||||
|
||||
BindValuesKey hash3 = new BindValuesKey();
|
||||
BindValuesKey hash3 = new BindValuesKey(spiEbeanServer());
|
||||
hash2.add(1).add(null);
|
||||
|
||||
assertThat(hash).isNotEqualTo(hash2);
|
||||
|
||||
@@ -139,7 +139,7 @@ public class DefaultOrmQueryTest extends BaseExpressionTest {
|
||||
}
|
||||
|
||||
private BindValuesKey bindKey(DefaultOrmQuery<Order> query) {
|
||||
BindValuesKey key = new BindValuesKey();
|
||||
BindValuesKey key = new BindValuesKey(spiEbeanServer());
|
||||
query.queryBindKey(key);
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.ebeaninternal.server.transaction;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -9,24 +10,23 @@ import java.util.Set;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class TableModStateTest {
|
||||
class TableModStateTest {
|
||||
|
||||
private TableModState tableModState = new TableModState();
|
||||
private final TableModState tableModState = new TableModState();
|
||||
|
||||
@Test
|
||||
public void isValid() {
|
||||
|
||||
long before = System.nanoTime();
|
||||
void isValid() {
|
||||
Instant before = Instant.now();
|
||||
|
||||
tableModState.touch(setOf("one", "two", "three"));
|
||||
|
||||
long after = System.nanoTime();
|
||||
Instant after = Instant.now();
|
||||
|
||||
// empty
|
||||
assertTrue(tableModState.isValid(Collections.emptySet(), 12L));
|
||||
assertTrue(tableModState.isValid(Collections.emptySet(), before));
|
||||
|
||||
// no entry
|
||||
assertTrue(tableModState.isValid(setOf("noEntry"), 12L));
|
||||
assertTrue(tableModState.isValid(setOf("noEntry"), before));
|
||||
|
||||
// later timestamp
|
||||
assertTrue(tableModState.isValid(setOf("one"), after));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean ddl generation</name>
|
||||
@@ -28,14 +28,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>14.10.0</version>
|
||||
<version>16.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ public class DB2Ddl extends PlatformDdl {
|
||||
}
|
||||
}
|
||||
if (requiresReorg) {
|
||||
ret.add(newRawCommand("call sysproc.admin_cmd('reorg table " + tableName() + "')"));
|
||||
ret.add(newRawCommand("call sysproc.admin_cmd('reorg table " + tableName() + " ${reorgArgs}')"));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user