mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Compare commits
169
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d92abbbe9c | ||
|
|
39500567c3 | ||
|
|
261b13ef4b | ||
|
|
7639034d7c | ||
|
|
c71971eb5c | ||
|
|
357af58db4 | ||
|
|
0abdb1550a | ||
|
|
c32fc814f6 | ||
|
|
8e035939dc | ||
|
|
edf98ee250 | ||
|
|
5f0a75a130 | ||
|
|
d2f16cbf6a | ||
|
|
04ba81d12f | ||
|
|
f63e7ed5af | ||
|
|
66940c0f14 | ||
|
|
1f48b3a6b3 | ||
|
|
7d368097e9 | ||
|
|
c849e29316 | ||
|
|
c78a3dd6c4 | ||
|
|
a4455ddbf2 | ||
|
|
9787af77e4 | ||
|
|
3786fb09a5 | ||
|
|
f34e7b6003 | ||
|
|
089dd8e364 | ||
|
|
44770382fb | ||
|
|
2a62d413cc | ||
|
|
0046d983cb | ||
|
|
006e33cb3e | ||
|
|
e80e8e027a | ||
|
|
2e1b52d7d4 | ||
|
|
09d5163396 | ||
|
|
a6a38b9a92 | ||
|
|
bd4521b240 | ||
|
|
8a7379879b | ||
|
|
b78dd6f79a | ||
|
|
4ebb5fd112 | ||
|
|
487368976f | ||
|
|
c6defceec9 | ||
|
|
ded6fd71b2 | ||
|
|
cbc4883672 | ||
|
|
64e227117b | ||
|
|
8ed3b765ec | ||
|
|
fcbcc53e27 | ||
|
|
b377e1a618 | ||
|
|
a0f612ed71 | ||
|
|
47e97a77a8 | ||
|
|
e8d3f50bb4 | ||
|
|
716cfaf938 | ||
|
|
7cd9e5ee03 | ||
|
|
f9c9bea623 | ||
|
|
720832122c | ||
|
|
7b635acf56 | ||
|
|
6b7efe65d7 | ||
|
|
03cd4000f0 | ||
|
|
dfd6434b59 | ||
|
|
4e7480237b | ||
|
|
9bfcf07486 | ||
|
|
b1f1344057 | ||
|
|
07201c1519 | ||
|
|
455a9fdffc | ||
|
|
3f67425727 | ||
|
|
3fd9ae06db | ||
|
|
a8ce726e47 | ||
|
|
29cd1a143d | ||
|
|
6a19c6a0ce | ||
|
|
eaec515cc1 | ||
|
|
97709d3493 | ||
|
|
87ad874621 | ||
|
|
dfe95f6fc0 | ||
|
|
05feccfeb6 | ||
|
|
196cb09c66 | ||
|
|
589e198301 | ||
|
|
b2b81677e8 | ||
|
|
f032aad22e | ||
|
|
c48e5428c5 | ||
|
|
cbca940611 | ||
|
|
0da3772ae9 | ||
|
|
496ef36b11 | ||
|
|
a4a2aba56f | ||
|
|
803f1d8642 | ||
|
|
ff1c73e20d | ||
|
|
7afd37cd98 | ||
|
|
24bb364d40 | ||
|
|
5d54a238bd | ||
|
|
b50ce5fc3f | ||
|
|
624e92840c | ||
|
|
b03adc412c | ||
|
|
e794f5e916 | ||
|
|
a2551ce718 | ||
|
|
5b0a3607f6 | ||
|
|
bcf7bd17be | ||
|
|
102d8d5979 | ||
|
|
3edc232003 | ||
|
|
043dc5c51f | ||
|
|
e2d666df35 | ||
|
|
314e0a14b8 | ||
|
|
1f9cf1e4b7 | ||
|
|
12029ed06e | ||
|
|
89741b9312 | ||
|
|
ae962c2e08 | ||
|
|
4e3501972a | ||
|
|
a65ba41850 | ||
|
|
3b11c1cb6b | ||
|
|
41185eeb5c | ||
|
|
e97ff54ab2 | ||
|
|
97fae09c52 | ||
|
|
8b0f58b3c2 | ||
|
|
70eb557929 | ||
|
|
fdb3a3759b | ||
|
|
7a5e8d0e17 | ||
|
|
a0748f8139 | ||
|
|
9f65673f54 | ||
|
|
8f6a3c59d1 | ||
|
|
05210ec411 | ||
|
|
faffda8318 | ||
|
|
af3901ce01 | ||
|
|
acd538207f | ||
|
|
84f0ef9fce | ||
|
|
7ab447b21c | ||
|
|
6f8805a6b3 | ||
|
|
0171c1afef | ||
|
|
31c106f604 | ||
|
|
20d2838be4 | ||
|
|
4238a951ca | ||
|
|
b5d4bed615 | ||
|
|
3ef715ef64 | ||
|
|
aea39528ab | ||
|
|
dd498409e0 | ||
|
|
bae33101df | ||
|
|
e1972ac544 | ||
|
|
c7241ba3dc | ||
|
|
73416ed65a | ||
|
|
cd70c178f1 | ||
|
|
aa298235f3 | ||
|
|
8733fed14b | ||
|
|
169d170247 | ||
|
|
d0ee42e0de | ||
|
|
91ecc074a7 | ||
|
|
c2b381af1e | ||
|
|
eeb0a15617 | ||
|
|
6abed0dd73 | ||
|
|
1318cd706f | ||
|
|
1e8c609dec | ||
|
|
4506596379 | ||
|
|
0b2c016af2 | ||
|
|
29d946ec59 | ||
|
|
da76b422c8 | ||
|
|
a1a3b33fc6 | ||
|
|
7ecd7877d5 | ||
|
|
e5f64f4211 | ||
|
|
90a6b71b7e | ||
|
|
131d531922 | ||
|
|
5684919a9f | ||
|
|
80fc0723c8 | ||
|
|
3ae4c8981e | ||
|
|
b80c67286b | ||
|
|
0bead4135e | ||
|
|
ac6473e039 | ||
|
|
32188bdd54 | ||
|
|
b3a577e3f9 | ||
|
|
7d1774e2ed | ||
|
|
395edb62bf | ||
|
|
716b7e7b93 | ||
|
|
9aadc347d7 | ||
|
|
d2d1423c88 | ||
|
|
73cfea6053 | ||
|
|
1614166d75 | ||
|
|
3d9b122a9f | ||
|
|
1cc1d29c2f |
@@ -13,7 +13,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
java_version: [11]
|
||||
java_version: [21]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
|
||||
@@ -34,6 +34,8 @@ jobs:
|
||||
path:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: Maven version
|
||||
run: mvn --version
|
||||
- name: Build with Maven
|
||||
run: mvn package
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-clickhouse</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-db2</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-hana</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mariadb</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mysql</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-nuodb</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-oracle</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
<name>ebean-postgis</name>
|
||||
<description>ebean-postgis composite</description>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
|
||||
<properties>
|
||||
<postgis.jdbc.version>2.5.1</postgis.jdbc.version>
|
||||
<postgres.jdbc.version>42.6.0</postgres.jdbc.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-datasource</artifactId>
|
||||
<version>${ebean-datasource.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-migration</artifactId>
|
||||
<version>${ebean-migration.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Technically optional but most expected to use query beans -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis-types</artifactId>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgres.jdbc.version}</version>
|
||||
<exclusions>
|
||||
<!-- exclude unnecessary checker framework -->
|
||||
<exclusion>
|
||||
<groupId>*</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.postgis</groupId>
|
||||
<artifactId>postgis-jdbc</artifactId>
|
||||
<version>${postgis.jdbc.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,7 @@
|
||||
package io.ebean.postgis.assembly;
|
||||
|
||||
/**
|
||||
* Nothing interesting here - required placeholder for javadoc.
|
||||
*/
|
||||
public class Assembly {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
module io.ebean.postgis {
|
||||
|
||||
requires transitive io.ebean.api;
|
||||
requires transitive io.ebean.core;
|
||||
requires transitive io.ebean.datasource;
|
||||
requires transitive io.ebean.querybean;
|
||||
requires transitive io.ebean.platform.postgres;
|
||||
// requires transitive io.ebean.postgis.types;
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlite</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -42,13 +42,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -17,31 +17,31 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-joda-time</artifactId>
|
||||
<version>13.18.0</version>
|
||||
<version>13.24.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-jsonnode</artifactId>
|
||||
<version>13.18.0</version>
|
||||
<version>13.24.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-mapper</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -60,13 +60,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
+2
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>composites</artifactId>
|
||||
@@ -23,6 +23,7 @@
|
||||
<module>ebean-nuodb</module>
|
||||
<module>ebean-oracle</module>
|
||||
<module>ebean-postgres</module>
|
||||
<module>ebean-postgis</module>
|
||||
<!-- <module>sqlanywhere</module>-->
|
||||
<module>ebean-sqlite</module>
|
||||
<module>ebean-sqlserver</module>
|
||||
|
||||
+49
-9
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
@@ -39,7 +39,7 @@
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-config</artifactId>
|
||||
<version>3.8</version>
|
||||
<version>3.10</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -107,13 +107,6 @@
|
||||
</dependency>
|
||||
<!-- JAKARTA-DEPENDENCY-END -->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -133,6 +126,53 @@
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<release>11</release>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile-21</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<release>21</release>
|
||||
<compileSourceRoots>
|
||||
<compileSourceRoot>${project.basedir}/src/main/java21</compileSourceRoot>
|
||||
</compileSourceRoots>
|
||||
<multiReleaseOutput>true</multiReleaseOutput>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<addMavenDescriptor>false</addMavenDescriptor>
|
||||
<manifestEntries>
|
||||
<Multi-Release>true</Multi-Release>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
<!-- <manifest>-->
|
||||
<!-- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>-->
|
||||
<!-- </manifest>-->
|
||||
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package io.ebean;
|
||||
|
||||
final class DInsertOptionsBuilder implements InsertOptions.Builder {
|
||||
|
||||
private Boolean getGeneratedKeys;
|
||||
private boolean onConflictUpdate;
|
||||
private boolean onConflictNothing;
|
||||
private String constraint;
|
||||
private String uniqueColumns;
|
||||
private String updateSet;
|
||||
|
||||
@Override
|
||||
public InsertOptions.Builder onConflictNothing() {
|
||||
this.onConflictNothing = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InsertOptions.Builder onConflictUpdate() {
|
||||
this.onConflictUpdate = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InsertOptions.Builder constraint(String constraint) {
|
||||
this.constraint = constraint;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InsertOptions.Builder uniqueColumns(String uniqueColumns) {
|
||||
this.uniqueColumns = uniqueColumns;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InsertOptions.Builder updateSet(String updateSet) {
|
||||
this.updateSet = updateSet;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InsertOptions.Builder getGeneratedKeys(boolean getGeneratedKeys) {
|
||||
this.getGeneratedKeys = getGeneratedKeys;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InsertOptions build() {
|
||||
return new Options(constraint, uniqueColumns, updateSet, onConflictUpdate, onConflictNothing, getGeneratedKeys);
|
||||
}
|
||||
|
||||
static final class Options implements InsertOptions {
|
||||
|
||||
private static final String UPDATE = "U";
|
||||
private static final String NOTHING = "N";
|
||||
private static final String NORMAL = "_";
|
||||
private final String key;
|
||||
private final Boolean getGeneratedKeys;
|
||||
private final String constraint;
|
||||
private final String uniqueColumns;
|
||||
private final String updateSet;
|
||||
|
||||
Options(String constraint, String uniqueColumns, String updateSet, boolean onConflictUpdate, boolean onConflictNothing, Boolean getGeneratedKeys) {
|
||||
this.constraint = constraint;
|
||||
this.uniqueColumns = uniqueColumns;
|
||||
this.updateSet = updateSet;
|
||||
this.getGeneratedKeys = getGeneratedKeys;
|
||||
this.key = (onConflictUpdate ? UPDATE : onConflictNothing ? NOTHING : NORMAL)
|
||||
+ '+' + plus(constraint)
|
||||
+ '+' + plus(uniqueColumns)
|
||||
+ '+' + plus(updateSet);
|
||||
}
|
||||
|
||||
private String plus(String val) {
|
||||
return val == null ? "" : val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String key() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String constraint() {
|
||||
return constraint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uniqueColumns() {
|
||||
return uniqueColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateSet() {
|
||||
return updateSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getGetGeneratedKeys() {
|
||||
return getGeneratedKeys;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ import java.util.concurrent.Callable;
|
||||
* <h5>Constructing a Database</h5>
|
||||
* <p>
|
||||
* Databases are constructed by the DatabaseFactory. They can be created
|
||||
* programmatically via {@link DatabaseFactory#create(DatabaseConfig)} or they
|
||||
* programmatically via {@link DatabaseFactory#create(DatabaseBuilder)} or they
|
||||
* can be automatically constructed on demand using configuration information in
|
||||
* the application.properties file.
|
||||
*
|
||||
@@ -86,6 +86,23 @@ import java.util.concurrent.Callable;
|
||||
@NonNullApi
|
||||
public interface Database {
|
||||
|
||||
/**
|
||||
* Return a new database builder.
|
||||
* <pre>{@code
|
||||
*
|
||||
* // build the 'default' database using configuration
|
||||
* // from application.properties / application.yaml
|
||||
*
|
||||
* Database db = Database.builder()
|
||||
* .loadFromProperties()
|
||||
* .build();
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
static DatabaseBuilder builder() {
|
||||
return new DatabaseConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown the Database instance.
|
||||
*/
|
||||
@@ -1210,22 +1227,53 @@ public interface Database {
|
||||
*/
|
||||
void insert(Object bean);
|
||||
|
||||
/**
|
||||
* Insert the bean with options (ON CONFLICT DO UPDATE | DO NOTHING).
|
||||
* <p>
|
||||
* Currently, this is limited to use with Postgres only,
|
||||
* <p>
|
||||
* When using this ebean will look to determine the unique columns by looking at
|
||||
* the mapping like {@code @Column(unique=true} and {@code @Index(unique=true}.
|
||||
*/
|
||||
void insert(Object bean, InsertOptions insertOptions);
|
||||
|
||||
/**
|
||||
* Insert the bean with a transaction.
|
||||
*/
|
||||
void insert(Object bean, Transaction transaction);
|
||||
|
||||
/**
|
||||
* Insert the beans with options (ON CONFLICT DO UPDATE | DO NOTHING) and transaction.
|
||||
* <p>
|
||||
* Currently, this is limited to use with Postgres only,
|
||||
*/
|
||||
void insert(Object bean, InsertOptions insertOptions, Transaction transaction);
|
||||
|
||||
/**
|
||||
* Insert a collection of beans. If there is no current transaction one is created and used to
|
||||
* insert all the beans in the collection.
|
||||
*/
|
||||
void insertAll(Collection<?> beans);
|
||||
|
||||
/**
|
||||
* Insert the beans with options - typically ON CONFLICT DO UPDATE | DO NOTHING.
|
||||
* <p>
|
||||
* Currently, this is limited to use with Postgres only,
|
||||
*/
|
||||
void insertAll(Collection<?> beans, InsertOptions options);
|
||||
|
||||
/**
|
||||
* Insert a collection of beans with an explicit transaction.
|
||||
*/
|
||||
void insertAll(Collection<?> beans, Transaction transaction);
|
||||
|
||||
/**
|
||||
* Insert the beans with options (ON CONFLICT DO UPDATE | DO NOTHING) and transaction.
|
||||
* <p>
|
||||
* Currently, this is limited to use with Postgres only,
|
||||
*/
|
||||
void insertAll(Collection<?> beans, InsertOptions options, Transaction transaction);
|
||||
|
||||
/**
|
||||
* Execute explicitly passing a transaction.
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,11 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.ebean.config.ContainerConfig;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.service.SpiContainer;
|
||||
import io.ebean.service.SpiContainerFactory;
|
||||
|
||||
import jakarta.persistence.PersistenceException;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@@ -76,9 +74,10 @@ public final class DatabaseFactory {
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
public static Database create(DatabaseConfig config) {
|
||||
public static Database create(DatabaseBuilder builder) {
|
||||
lock.lock();
|
||||
try {
|
||||
var config = builder.settings();
|
||||
if (config.getName() == null) {
|
||||
throw new PersistenceException("The name is null (it is required)");
|
||||
}
|
||||
@@ -102,7 +101,7 @@ public final class DatabaseFactory {
|
||||
/**
|
||||
* Create using the DatabaseConfig additionally specifying a classLoader to use as the context class loader.
|
||||
*/
|
||||
public static Database createWithContextClassLoader(DatabaseConfig config, ClassLoader classLoader) {
|
||||
public static Database createWithContextClassLoader(DatabaseBuilder config, ClassLoader classLoader) {
|
||||
lock.lock();
|
||||
try {
|
||||
ClassLoader currentContextLoader = Thread.currentThread().getContextClassLoader();
|
||||
@@ -132,7 +131,7 @@ public final class DatabaseFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private static Database createInternal(DatabaseConfig config) {
|
||||
private static Database createInternal(DatabaseBuilder.Settings config) {
|
||||
return container(config.getContainerConfig()).createServer(config);
|
||||
}
|
||||
|
||||
@@ -146,12 +145,9 @@ public final class DatabaseFactory {
|
||||
if (container != null) {
|
||||
return container;
|
||||
}
|
||||
|
||||
if (containerConfig == null) {
|
||||
// effectively load configuration from ebean.properties
|
||||
Properties properties = DbPrimary.getProperties();
|
||||
containerConfig = new ContainerConfig();
|
||||
containerConfig.loadFromProperties(properties);
|
||||
}
|
||||
container = createContainer(containerConfig);
|
||||
return container;
|
||||
@@ -160,7 +156,7 @@ public final class DatabaseFactory {
|
||||
/**
|
||||
* Create the container instance using the configuration.
|
||||
*/
|
||||
protected static SpiContainer createContainer(ContainerConfig containerConfig) {
|
||||
private static SpiContainer createContainer(ContainerConfig containerConfig) {
|
||||
Iterator<SpiContainerFactory> factories = ServiceLoader.load(SpiContainerFactory.class).iterator();
|
||||
if (factories.hasNext()) {
|
||||
return factories.next().create(containerConfig);
|
||||
|
||||
@@ -44,25 +44,12 @@ final class DbPrimary {
|
||||
* Return the default database name.
|
||||
*/
|
||||
static String getDefaultServerName() {
|
||||
lock.lock();
|
||||
try {
|
||||
getProperties();
|
||||
return defaultServerName;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default configuration Properties.
|
||||
*/
|
||||
static Properties getProperties() {
|
||||
lock.lock();
|
||||
try {
|
||||
if (defaultServerName == null) {
|
||||
defaultServerName = determineDefaultServerName();
|
||||
}
|
||||
return Config.asProperties();
|
||||
return defaultServerName;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package io.ebean;
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -206,14 +208,19 @@ public interface DtoQuery<T> extends CancelableQuery {
|
||||
*/
|
||||
DtoQuery<T> usingTransaction(Transaction transaction);
|
||||
|
||||
/**
|
||||
* Execute the query using the given connection.
|
||||
*/
|
||||
DtoQuery<T> usingConnection(Connection connection);
|
||||
|
||||
/**
|
||||
* Ensure that the master DataSource is used if there is a read only data source
|
||||
* being used (that is using a read replica database potentially with replication lag).
|
||||
* <p>
|
||||
* When the database is configured with a read-only DataSource via
|
||||
* say {@link io.ebean.config.DatabaseConfig#setReadOnlyDataSource(DataSource)} then
|
||||
* say {@link io.ebean.DatabaseBuilder#readOnlyDataSource(DataSource)} then
|
||||
* by default when a query is run without an active transaction, it uses the read-only data
|
||||
* source. We we use {@code usingMaster()} to instead ensure that the query is executed
|
||||
* source. We use {@code usingMaster()} to instead ensure that the query is executed
|
||||
* against the master data source.
|
||||
*/
|
||||
DtoQuery<T> usingMaster();
|
||||
|
||||
@@ -54,7 +54,7 @@ public interface ExpressionList<T> {
|
||||
Query<T> orderById(boolean orderById);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to {@link #orderBy(String)}
|
||||
* @deprecated migrate to {@link #orderBy(String)}
|
||||
*/
|
||||
@Deprecated(since = "13.19", forRemoval = true)
|
||||
default ExpressionList<T> order(String orderByClause) {
|
||||
@@ -72,7 +72,7 @@ public interface ExpressionList<T> {
|
||||
ExpressionList<T> orderBy(String orderBy);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to orderBy().
|
||||
* @deprecated migrate to {@link #orderBy()}.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
default OrderBy<T> order() {
|
||||
@@ -508,7 +508,7 @@ public interface ExpressionList<T> {
|
||||
ExpressionList<T> filterMany(String manyProperty);
|
||||
|
||||
/**
|
||||
* Deprecated for removal - migrate to filterManyRaw()
|
||||
* @deprecated for removal - migrate to {@link #filterManyRaw(String, String, Object...)}.
|
||||
* <p>
|
||||
* Add filter expressions to the many property.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package io.ebean;
|
||||
|
||||
import io.avaje.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Options to be used with insert such as ON CONFLICT DO UPDATE | NOTHING.
|
||||
*/
|
||||
public interface InsertOptions {
|
||||
|
||||
/**
|
||||
* Use ON CONFLICT UPDATE with automatic determination of the unique columns to conflict on.
|
||||
* <p>
|
||||
* Uses mapping to determine the unique columns - {@code @Column(unique=true)} and {@code @Index(unique=true)} .
|
||||
*/
|
||||
InsertOptions ON_CONFLICT_UPDATE = InsertOptions.builder()
|
||||
.onConflictUpdate()
|
||||
.build();
|
||||
|
||||
/**
|
||||
* Use ON CONFLICT DO NOTHING with automatic determination of the unique columns to conflict on.
|
||||
* <p>
|
||||
* Uses mapping to determine the unique columns - {@code @Column(unique=true)} and {@code @Index(unique=true)} .
|
||||
*/
|
||||
InsertOptions ON_CONFLICT_NOTHING = InsertOptions.builder()
|
||||
.onConflictNothing()
|
||||
.build();
|
||||
|
||||
/**
|
||||
* Return a builder for InsertOptions.
|
||||
*/
|
||||
static Builder builder() {
|
||||
return new DInsertOptionsBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the constraint name that is used for ON CONFLICT.
|
||||
*/
|
||||
@Nullable
|
||||
String constraint();
|
||||
|
||||
/**
|
||||
* Return the unique columns that is used for ON CONFLICT.
|
||||
* <p>
|
||||
* When not explicitly set will use mapping like {@code @Column(unique=true)} to determine the
|
||||
* non-unique columns.
|
||||
*/
|
||||
@Nullable
|
||||
String uniqueColumns();
|
||||
|
||||
/**
|
||||
* Return the ON CONFLICT UPDATE SET clause.
|
||||
* <p>
|
||||
* When not set will use the non-unique columns.
|
||||
*/
|
||||
@Nullable
|
||||
String updateSet();
|
||||
|
||||
/**
|
||||
* Return if GetGeneratedKeys should be used to fetch the generated keys after insert.
|
||||
*/
|
||||
@Nullable
|
||||
Boolean getGetGeneratedKeys();
|
||||
|
||||
/**
|
||||
* Return the key for these build options.
|
||||
*/
|
||||
String key();
|
||||
|
||||
/**
|
||||
* The builder for InsertOptions.
|
||||
*/
|
||||
interface Builder {
|
||||
|
||||
/**
|
||||
* Use a ON CONFLICT UPDATE automatically determining the unique columns.
|
||||
*/
|
||||
Builder onConflictUpdate();
|
||||
|
||||
/**
|
||||
* Use a ON CONFLICT DO NOTHING automatically determining the unique columns.
|
||||
*/
|
||||
Builder onConflictNothing();
|
||||
|
||||
/**
|
||||
* Specify an explicit conflict constraint name.
|
||||
* <p>
|
||||
* When this is used then unique columns will not be used.
|
||||
*/
|
||||
Builder constraint(String constraint);
|
||||
|
||||
/**
|
||||
* Specify the unique columns for the conflict target.
|
||||
* <p>
|
||||
* When not specified and constraint is also not specified then
|
||||
* it will automatically determine the unique columns
|
||||
* based on mapping like {@code @Column(unique=true)} and
|
||||
* {@code @Index(unique=true)} .
|
||||
*/
|
||||
Builder uniqueColumns(String uniqueColumns);
|
||||
|
||||
/**
|
||||
* Specify the ON CONFLICT DO UPDATE SET clause.
|
||||
* <p>
|
||||
* When not specified ebean will include all the non-unique columns.
|
||||
*/
|
||||
Builder updateSet(String updateSet);
|
||||
|
||||
/**
|
||||
* Specify if GetGeneratedKeys should be used to return generated keys.
|
||||
*/
|
||||
Builder getGeneratedKeys(boolean getGeneratedKeys);
|
||||
|
||||
/**
|
||||
* Build and return the insert options.
|
||||
*/
|
||||
InsertOptions build();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -702,9 +702,9 @@ public interface Query<T> extends CancelableQuery {
|
||||
* being used (that is using a read replica database potentially with replication lag).
|
||||
* <p>
|
||||
* When the database is configured with a read-only DataSource via
|
||||
* say {@link io.ebean.config.DatabaseConfig#setReadOnlyDataSource(DataSource)} then
|
||||
* say {@link io.ebean.DatabaseBuilder#readOnlyDataSource(DataSource)} then
|
||||
* by default when a query is run without an active transaction, it uses the read-only data
|
||||
* source. We we use {@code usingMaster()} to instead ensure that the query is executed
|
||||
* source. We use {@code usingMaster()} to instead ensure that the query is executed
|
||||
* against the master data source.
|
||||
*/
|
||||
Query<T> usingMaster();
|
||||
@@ -970,6 +970,25 @@ public interface Query<T> extends CancelableQuery {
|
||||
@Nullable
|
||||
<A> A findSingleAttribute();
|
||||
|
||||
/**
|
||||
* Execute the query returning a single optional attribute value.
|
||||
* <p>
|
||||
* <h3>Example</h3>
|
||||
* <pre>{@code
|
||||
*
|
||||
* Optional<String> maybeName =
|
||||
* new QCustomer()
|
||||
* .select(name)
|
||||
* .id.eq(42)
|
||||
* .status.eq(NEW)
|
||||
* .findSingleAttributeOrEmpty();
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
* @return an optional value for the selected property
|
||||
*/
|
||||
<A> Optional<A> findSingleAttributeOrEmpty();
|
||||
|
||||
/**
|
||||
* Return true if this is countDistinct query.
|
||||
*/
|
||||
@@ -1396,7 +1415,7 @@ public interface Query<T> extends CancelableQuery {
|
||||
Query<T> orderBy(String orderByClause);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to orderBy().
|
||||
* @deprecated migrate to {@link #orderBy()}.
|
||||
*/
|
||||
@Deprecated(since = "13.19", forRemoval = true)
|
||||
default Query<T> order(String orderByClause) {
|
||||
@@ -1415,7 +1434,7 @@ public interface Query<T> extends CancelableQuery {
|
||||
OrderBy<T> orderBy();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to orderBy().
|
||||
* @deprecated migrate to {@link #orderBy()}.
|
||||
*/
|
||||
@Deprecated(since = "13.19", forRemoval = true)
|
||||
default OrderBy<T> order() {
|
||||
@@ -1428,7 +1447,7 @@ public interface Query<T> extends CancelableQuery {
|
||||
Query<T> setOrderBy(OrderBy<T> orderBy);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to setOrderBy().
|
||||
* @deprecated migrate to {@link #setOrderBy(OrderBy)}.
|
||||
*/
|
||||
@Deprecated(since = "13.19", forRemoval = true)
|
||||
default Query<T> setOrder(OrderBy<T> orderBy) {
|
||||
|
||||
@@ -3,7 +3,9 @@ package io.ebean;
|
||||
import io.avaje.lang.NonNullApi;
|
||||
import io.avaje.lang.Nullable;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Connection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
@@ -45,14 +47,19 @@ public interface SqlQuery extends Serializable, CancelableQuery {
|
||||
*/
|
||||
SqlQuery usingTransaction(Transaction transaction);
|
||||
|
||||
/**
|
||||
* Execute the query using the given connection.
|
||||
*/
|
||||
SqlQuery usingConnection(Connection connection);
|
||||
|
||||
/**
|
||||
* Ensure that the master DataSource is used if there is a read only data source
|
||||
* being used (that is using a read replica database potentially with replication lag).
|
||||
* <p>
|
||||
* When the database is configured with a read-only DataSource via
|
||||
* say {@link io.ebean.config.DatabaseConfig#setReadOnlyDataSource(DataSource)} then
|
||||
* say {@link io.ebean.DatabaseBuilder#readOnlyDataSource(DataSource)}then
|
||||
* by default when a query is run without an active transaction, it uses the read-only data
|
||||
* source. We we use {@code usingMaster()} to instead ensure that the query is executed
|
||||
* source. We use {@code usingMaster()} to instead ensure that the query is executed
|
||||
* against the master data source.
|
||||
*/
|
||||
SqlQuery usingMaster();
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.Collection;
|
||||
* <p>
|
||||
* This is currently deemed to be experimental and subject to change.
|
||||
*/
|
||||
@Deprecated(since = "experimental")
|
||||
public final class StdOperators {
|
||||
|
||||
// ---- Functions ---- //
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebean.cache;
|
||||
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
|
||||
/**
|
||||
* Plugin that provides a ServerCacheNotify implementation.
|
||||
@@ -12,5 +12,5 @@ public interface ServerCacheNotifyPlugin {
|
||||
/**
|
||||
* Create a ServerCacheNotify implementation given the server configuration.
|
||||
*/
|
||||
ServerCacheNotify create(DatabaseConfig config);
|
||||
ServerCacheNotify create(DatabaseBuilder config);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean.cache;
|
||||
|
||||
import io.ebean.BackgroundExecutor;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
|
||||
/**
|
||||
* The plugin interface that creates a ServerCacheFactory.
|
||||
@@ -11,5 +11,5 @@ public interface ServerCachePlugin {
|
||||
/**
|
||||
* Create the ServerCacheFactory given the server config and background executor service.
|
||||
*/
|
||||
ServerCacheFactory create(DatabaseConfig config, BackgroundExecutor executor);
|
||||
ServerCacheFactory create(DatabaseBuilder config, BackgroundExecutor executor);
|
||||
}
|
||||
|
||||
@@ -141,14 +141,16 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the actual underlying list.
|
||||
* <p>
|
||||
* This is primarily for the deferred fetching function.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setActualList(List<?> list) {
|
||||
this.list = (List<E>) list;
|
||||
public BeanCollectionAdd collectionAdd() {
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void refresh(ModifyListenMode modifyListenMode, BeanList<E> newList) {
|
||||
setModifyListening(modifyListenMode);
|
||||
this.list = newList.actualList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package io.ebean.common;
|
||||
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollectionLoader;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.ToStringBuilder;
|
||||
import io.ebean.bean.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -17,12 +14,12 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
|
||||
/**
|
||||
* The underlying map implementation.
|
||||
*/
|
||||
private Map<K, E> map;
|
||||
private LinkedHashMap<K, E> map;
|
||||
|
||||
/**
|
||||
* Create with a given Map.
|
||||
*/
|
||||
public BeanMap(Map<K, E> map) {
|
||||
public BeanMap(LinkedHashMap<K, E> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
@@ -160,18 +157,23 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the actual underlying map. Used for performing lazy fetch.
|
||||
*/
|
||||
public LinkedHashMap<K, E> collectionAdd() {
|
||||
if (map == null) {
|
||||
map = new LinkedHashMap<>();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setActualMap(Map<?, ?> map) {
|
||||
this.map = (Map<K, E>) map;
|
||||
public void refresh(ModifyListenMode modifyListenMode, BeanMap<?, ?> newMap) {
|
||||
setModifyListening(modifyListenMode);
|
||||
this.map = (LinkedHashMap<K, E>) newMap.actualMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual underlying map.
|
||||
*/
|
||||
public Map<K, E> actualMap() {
|
||||
public LinkedHashMap<K, E> actualMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,7 @@ package io.ebean.common;
|
||||
import io.ebean.bean.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Set capable of lazy loading and modification aware.
|
||||
@@ -18,12 +15,12 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
|
||||
/**
|
||||
* The underlying Set implementation.
|
||||
*/
|
||||
private Set<E> set;
|
||||
private LinkedHashSet<E> set;
|
||||
|
||||
/**
|
||||
* Create with a specific Set implementation.
|
||||
*/
|
||||
public BeanSet(Set<E> set) {
|
||||
public BeanSet(LinkedHashSet<E> set) {
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
@@ -144,18 +141,22 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the underlying set (used for lazy fetch).
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setActualSet(Set<?> set) {
|
||||
this.set = (Set<E>) set;
|
||||
public BeanCollectionAdd collectionAdd() {
|
||||
if (set == null) {
|
||||
set = new LinkedHashSet<>();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void refresh(ModifyListenMode modifyListenMode, BeanSet<E> newSet) {
|
||||
setModifyListening(modifyListenMode);
|
||||
this.set = newSet.actualSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual underlying set.
|
||||
*/
|
||||
public Set<E> actualSet() {
|
||||
public LinkedHashSet<E> actualSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.ebean.config;
|
||||
|
||||
import io.ebean.DatabaseBuilder;
|
||||
|
||||
/**
|
||||
* Used to provide some automatic configuration early in the creation of a Database.
|
||||
*/
|
||||
@@ -8,11 +10,11 @@ public interface AutoConfigure {
|
||||
/**
|
||||
* Perform configuration for the DatabaseConfig prior to properties load.
|
||||
*/
|
||||
void preConfigure(DatabaseConfig config);
|
||||
void preConfigure(DatabaseBuilder config);
|
||||
|
||||
/**
|
||||
* Provide some configuration the DatabaseConfig prior to server creation but after properties have been applied.
|
||||
*/
|
||||
void postConfigure(DatabaseConfig config);
|
||||
void postConfigure(DatabaseBuilder config);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package io.ebean.config;
|
||||
|
||||
import io.avaje.config.Config;
|
||||
import io.avaje.config.Configuration;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
@@ -15,8 +18,17 @@ public class ContainerConfig {
|
||||
private String namespace;
|
||||
private String podName;
|
||||
private int port;
|
||||
|
||||
private Properties properties;
|
||||
private Configuration configuration;
|
||||
|
||||
public ContainerConfig() {
|
||||
this.configuration = Config.asConfiguration();
|
||||
this.active = configuration.getBool("ebean.cluster.active", active);
|
||||
this.serviceName = configuration.getNullable("ebean.cluster.serviceName", serviceName);
|
||||
this.namespace = configuration.getNullable("ebean.cluster.namespace", namespace);
|
||||
this.podName = configuration.getNullable("ebean.cluster.podName", podName);
|
||||
this.port = configuration.getInt("ebean.cluster.port", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the service name.
|
||||
@@ -92,7 +104,7 @@ public class ContainerConfig {
|
||||
* Return the deployment properties.
|
||||
*/
|
||||
public Properties getProperties() {
|
||||
return properties;
|
||||
return properties != null ? properties : configuration.asProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,26 +114,4 @@ public class ContainerConfig {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the settings from properties.
|
||||
*/
|
||||
public void loadFromProperties(Properties properties) {
|
||||
this.properties = properties;
|
||||
this.active = getProperty(properties, "ebean.cluster.active", active);
|
||||
this.serviceName = properties.getProperty("ebean.cluster.serviceName", serviceName);
|
||||
this.namespace = properties.getProperty("ebean.cluster.namespace", namespace);
|
||||
this.podName = properties.getProperty("ebean.cluster.podName", podName);
|
||||
String portParam = properties.getProperty("ebean.cluster.port");
|
||||
if (portParam != null) {
|
||||
this.port = Integer.parseInt(portParam);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the boolean property setting.
|
||||
*/
|
||||
protected boolean getProperty(Properties properties, String key, boolean defaultValue) {
|
||||
return "true".equalsIgnoreCase(properties.getProperty(key, Boolean.toString(defaultValue)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,7 @@
|
||||
package io.ebean.config;
|
||||
|
||||
import io.ebean.DatabaseBuilder;
|
||||
|
||||
/**
|
||||
* Provides a ServiceLoader based mechanism to configure a DatabaseConfig.
|
||||
* <p>
|
||||
@@ -35,5 +37,5 @@ public interface DatabaseConfigProvider {
|
||||
* Typically we explicitly register entity bean classes and thus avoid classpath scanning.
|
||||
* </p>
|
||||
*/
|
||||
void apply(DatabaseConfig config);
|
||||
void apply(DatabaseBuilder config);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebean.event;
|
||||
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
|
||||
/**
|
||||
* Used to configure the server on startup.
|
||||
@@ -13,6 +13,6 @@ public interface ServerConfigStartup {
|
||||
/**
|
||||
* On starting configure the DatabaseConfig.
|
||||
*/
|
||||
void onStart(DatabaseConfig config);
|
||||
void onStart(DatabaseBuilder config);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package io.ebean.event;
|
||||
import jakarta.servlet.ServletContextEvent;
|
||||
|
||||
/**
|
||||
* Deprecated for removal - no intention to replace. Create your own copy of this
|
||||
* ServletContextListener if needed for your application.
|
||||
* <p>
|
||||
* Listens for webserver server starting and stopping events.
|
||||
* <p>
|
||||
* This should be used when the deployment is into a servlet container where the webapp
|
||||
@@ -15,6 +18,7 @@ import jakarta.servlet.ServletContextEvent;
|
||||
* hook that Ebean registers.
|
||||
* </p>
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public class ServletContextListener implements jakarta.servlet.ServletContextListener {
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.ebean.plugin;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.bean.BeanLoader;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,7 +16,7 @@ public interface SpiServer extends Database {
|
||||
/**
|
||||
* Return the DatabaseConfig.
|
||||
*/
|
||||
DatabaseConfig config();
|
||||
DatabaseBuilder.Settings config();
|
||||
|
||||
/**
|
||||
* Return the DatabasePlatform for this database.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean.service;
|
||||
|
||||
import io.ebean.Database;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
|
||||
/**
|
||||
* Creates the Database implementations. This is used internally by the EbeanServerFactory and is not currently
|
||||
@@ -14,7 +14,7 @@ public interface SpiContainer {
|
||||
*
|
||||
* @param configuration The configuration information for this database.
|
||||
*/
|
||||
Database createServer(DatabaseConfig configuration);
|
||||
Database createServer(DatabaseBuilder configuration);
|
||||
|
||||
/**
|
||||
* Create an EbeanServer just using the name.
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
/* Javadoc style sheet */
|
||||
|
||||
/* Define colors, fonts and other style attributes here to override the defaults */
|
||||
|
||||
/* Page background color */
|
||||
body {
|
||||
background-color: #FFFFFF;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
pre.code {
|
||||
padding: 1em;
|
||||
margin-left: 2em;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
/* Headings */
|
||||
h1 {
|
||||
font-size: 14pt
|
||||
}
|
||||
|
||||
#overviewexamples h3 {
|
||||
font-size: 10pt
|
||||
}
|
||||
|
||||
/* Table colors */
|
||||
.TableHeadingColor {
|
||||
background: #CCCCFF
|
||||
}
|
||||
|
||||
/* Dark mauve */
|
||||
.TableSubHeadingColor {
|
||||
background: #EEEEFF
|
||||
}
|
||||
|
||||
/* Light mauve */
|
||||
.TableRowColor {
|
||||
background: #FFFFFF
|
||||
}
|
||||
|
||||
/* White */
|
||||
|
||||
/* Font used in left-hand frame lists */
|
||||
.FrameTitleFont {
|
||||
font-size: 12pt;
|
||||
font-family: Helvetica, Arial, sans-serif
|
||||
}
|
||||
|
||||
.FrameHeadingFont {
|
||||
font-size: 10pt;
|
||||
font-family: Helvetica, Arial, sans-serif
|
||||
}
|
||||
|
||||
.FrameItemFont {
|
||||
font-size: 10pt;
|
||||
font-family: Helvetica, Arial, sans-serif
|
||||
}
|
||||
|
||||
/* Navigation bar fonts and colors */
|
||||
.NavBarCell1 {
|
||||
background-color: #EEEEFF;
|
||||
}
|
||||
|
||||
/* Light mauve */
|
||||
.NavBarCell1Rev {
|
||||
background-color: #00008B;
|
||||
}
|
||||
|
||||
/* Dark Blue */
|
||||
.NavBarFont1 {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.NavBarFont1Rev {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.NavBarCell2 {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.NavBarCell3 {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,450 @@
|
||||
package io.ebean.common;
|
||||
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollectionLoader;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.ToStringBuilder;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Map capable of lazy loading and modification aware.
|
||||
*/
|
||||
public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements SequencedMap<K, E> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The underlying map implementation.
|
||||
*/
|
||||
private LinkedHashMap<K, E> map;
|
||||
|
||||
/**
|
||||
* Create with a given Map.
|
||||
*/
|
||||
public BeanMap(LinkedHashMap<K, E> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create using a underlying LinkedHashMap.
|
||||
*/
|
||||
public BeanMap() {
|
||||
this(new LinkedHashMap<>());
|
||||
}
|
||||
|
||||
public BeanMap(BeanCollectionLoader ebeanServer, EntityBean ownerBean, String propertyName) {
|
||||
super(ebeanServer, ownerBean, propertyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toString(ToStringBuilder builder) {
|
||||
if (map == null || map.isEmpty()) {
|
||||
builder.addRaw("{}");
|
||||
} else {
|
||||
builder.addRaw("{");
|
||||
for (Entry<K, E> entry : map.entrySet()) {
|
||||
builder.add(String.valueOf(entry.getKey()), entry.getValue());
|
||||
}
|
||||
builder.addRaw("}");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(EntityBean ownerBean, String propertyName) {
|
||||
this.ownerBean = ownerBean;
|
||||
this.propertyName = propertyName;
|
||||
this.map = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSkipSave() {
|
||||
return map == null || (map.isEmpty() && !holdsModifications());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void loadFrom(BeanCollection<?> other) {
|
||||
BeanMap<K, E> otherMap = (BeanMap<K, E>) other;
|
||||
internalPutNull();
|
||||
map.putAll(otherMap.actualMap());
|
||||
}
|
||||
|
||||
public void internalPutNull() {
|
||||
if (map == null) {
|
||||
map = new LinkedHashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void internalPut(Object key, Object bean) {
|
||||
if (map == null) {
|
||||
map = new LinkedHashMap<>();
|
||||
}
|
||||
if (key != null) {
|
||||
map.put((K) key, (E) bean);
|
||||
}
|
||||
}
|
||||
|
||||
public void internalPutWithCheck(Object key, Object bean) {
|
||||
if (map == null || key == null || !map.containsKey(key)) {
|
||||
internalPut(key, bean);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void internalAddWithCheck(Object bean) {
|
||||
throw new RuntimeException("Not allowed for map");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void internalAdd(Object bean) {
|
||||
throw new RuntimeException("Not allowed for map");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the underlying map has been populated. Returns false if it
|
||||
* has a deferred fetch pending.
|
||||
*/
|
||||
@Override
|
||||
public boolean isPopulated() {
|
||||
return map != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a reference (lazy loading) bean collection. This is
|
||||
* the same as !isPopulated();
|
||||
*/
|
||||
@Override
|
||||
public boolean isReference() {
|
||||
return map == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEmptyLazyLoad() {
|
||||
if (map == null) {
|
||||
map = new LinkedHashMap<>();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void initClear() {
|
||||
lock.lock();
|
||||
try {
|
||||
if (map == null) {
|
||||
if (!disableLazyLoad && modifyListening) {
|
||||
lazyLoadCollection(true);
|
||||
} else {
|
||||
map = new LinkedHashMap<>();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
lock.lock();
|
||||
try {
|
||||
if (map == null) {
|
||||
if (disableLazyLoad) {
|
||||
map = new LinkedHashMap<>();
|
||||
} else {
|
||||
lazyLoadCollection(false);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public LinkedHashMap<K, E> collectionAdd() {
|
||||
if (map == null) {
|
||||
map = new LinkedHashMap<>();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void refresh(ModifyListenMode modifyListenMode, BeanMap<?, ?> newMap) {
|
||||
setModifyListening(modifyListenMode);
|
||||
this.map = (LinkedHashMap<K, E>) newMap.actualMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual underlying map.
|
||||
*/
|
||||
public LinkedHashMap<K, E> actualMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the collection of beans (map values).
|
||||
*/
|
||||
@Override
|
||||
public Collection<E> actualDetails() {
|
||||
return map.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the map entrySet.
|
||||
*/
|
||||
@Override
|
||||
public Collection<?> actualEntries() {
|
||||
return map.entrySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (map == null) {
|
||||
return "BeanMap<deferred>";
|
||||
} else {
|
||||
return map.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equal if object is a Map and equal in a Map sense.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
init();
|
||||
return map.equals(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
init();
|
||||
return map.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
checkReadOnly();
|
||||
initClear();
|
||||
if (modifyListening) {
|
||||
// add all beans to the removal list
|
||||
for (E bean : map.values()) {
|
||||
modifyRemoval(bean);
|
||||
}
|
||||
}
|
||||
map.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
init();
|
||||
return map.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
init();
|
||||
return map.containsValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<K, E>> entrySet() {
|
||||
init();
|
||||
if (readOnly) {
|
||||
return Collections.unmodifiableSet(map.entrySet());
|
||||
}
|
||||
return modifyListening ? new ModifyEntrySet<>(this, map.entrySet()) : map.entrySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E get(Object key) {
|
||||
init();
|
||||
return map.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
init();
|
||||
return map.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<K> keySet() {
|
||||
init();
|
||||
if (readOnly) {
|
||||
return Collections.unmodifiableSet(map.keySet());
|
||||
}
|
||||
return modifyListening ? new ModifyKeySet<>(this, map.keySet()) : map.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E put(K key, E value) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
E oldBean = map.put(key, value);
|
||||
if (value != oldBean) {
|
||||
// register the add of the new and the removal of the old
|
||||
modifyAddition(value);
|
||||
modifyRemoval(oldBean);
|
||||
}
|
||||
return oldBean;
|
||||
} else {
|
||||
return map.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Map<? extends K, ? extends E> puts) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
for (Entry<? extends K, ? extends E> entry : puts.entrySet()) {
|
||||
Object oldBean = map.put(entry.getKey(), entry.getValue());
|
||||
if (entry.getValue() != oldBean) {
|
||||
modifyAddition(entry.getValue());
|
||||
modifyRemoval(oldBean);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
map.putAll(puts);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBean(E bean) {
|
||||
throw new IllegalStateException("Method not allowed on Map. Please use List instead.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBean(E bean) {
|
||||
throw new IllegalStateException("Method not allowed on Map. Please use List instead.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public E remove(Object key) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
E o = map.remove(key);
|
||||
modifyRemoval(o);
|
||||
return o;
|
||||
}
|
||||
return map.remove(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
init();
|
||||
return map.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<E> values() {
|
||||
init();
|
||||
if (readOnly) {
|
||||
return Collections.unmodifiableCollection(map.values());
|
||||
}
|
||||
return modifyListening ? new ModifyCollection<>(this, map.values()) : map.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanCollection<E> shallowCopy() {
|
||||
BeanMap<K, E> copy = new BeanMap<>(new LinkedHashMap<>(map));
|
||||
copy.setFromOriginal(this);
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SequencedMap<K, E> reversed() {
|
||||
init();
|
||||
if (modifyListening) {
|
||||
throw new UnsupportedOperationException("Not supported on modify listening map");
|
||||
}
|
||||
return map.reversed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, E> firstEntry() {
|
||||
init();
|
||||
return map.firstEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, E> lastEntry() {
|
||||
init();
|
||||
return map.lastEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, E> pollFirstEntry() {
|
||||
checkReadOnly();
|
||||
init();
|
||||
var entry = map.pollFirstEntry();
|
||||
if (modifyListening && entry != null) {
|
||||
modifyRemoval(entry.getValue());
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, E> pollLastEntry() {
|
||||
checkReadOnly();
|
||||
init();
|
||||
var entry = map.pollLastEntry();
|
||||
if (modifyListening && entry != null) {
|
||||
modifyRemoval(entry.getValue());
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public E putFirst(K key, E value) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
E oldBean = map.putFirst(key, value);
|
||||
if (value != oldBean) {
|
||||
// register the add of the new and the removal of the old
|
||||
modifyAddition(value);
|
||||
modifyRemoval(oldBean);
|
||||
}
|
||||
return oldBean;
|
||||
} else {
|
||||
return map.putFirst(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public E putLast(K key, E value) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
E oldBean = map.putLast(key, value);
|
||||
if (value != oldBean) {
|
||||
// register the add of the new and the removal of the old
|
||||
modifyAddition(value);
|
||||
modifyRemoval(oldBean);
|
||||
}
|
||||
return oldBean;
|
||||
} else {
|
||||
return map.putLast(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SequencedSet<K> sequencedKeySet() {
|
||||
init();
|
||||
return map.sequencedKeySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SequencedCollection<E> sequencedValues() {
|
||||
init();
|
||||
return map.sequencedValues();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SequencedSet<Entry<K, E>> sequencedEntrySet() {
|
||||
init();
|
||||
return map.sequencedEntrySet();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,460 @@
|
||||
package io.ebean.common;
|
||||
|
||||
import io.ebean.bean.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.SequencedSet;
|
||||
|
||||
/**
|
||||
* Set capable of lazy loading and modification aware.
|
||||
*/
|
||||
public final class BeanSet<E> extends AbstractBeanCollection<E> implements SequencedSet<E>, BeanCollectionAdd {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The underlying Set implementation.
|
||||
*/
|
||||
private LinkedHashSet<E> set;
|
||||
|
||||
/**
|
||||
* Create with a specific Set implementation.
|
||||
*/
|
||||
public BeanSet(LinkedHashSet<E> set) {
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create using an underlying LinkedHashSet.
|
||||
*/
|
||||
public BeanSet() {
|
||||
this(new LinkedHashSet<>());
|
||||
}
|
||||
|
||||
public BeanSet(BeanCollectionLoader loader, EntityBean ownerBean, String propertyName) {
|
||||
super(loader, ownerBean, propertyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toString(ToStringBuilder builder) {
|
||||
builder.addCollection(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(EntityBean ownerBean, String propertyName) {
|
||||
this.ownerBean = ownerBean;
|
||||
this.propertyName = propertyName;
|
||||
this.set = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSkipSave() {
|
||||
return set == null || (set.isEmpty() && !holdsModifications());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addEntityBean(EntityBean bean) {
|
||||
set.add((E) bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void loadFrom(BeanCollection<?> other) {
|
||||
if (set == null) {
|
||||
set = new LinkedHashSet<>();
|
||||
}
|
||||
set.addAll((Collection<? extends E>) other.actualDetails());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void internalAddWithCheck(Object bean) {
|
||||
// set add() already de-dups so just add it
|
||||
internalAdd(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void internalAdd(Object bean) {
|
||||
if (set == null) {
|
||||
set = new LinkedHashSet<>();
|
||||
}
|
||||
if (bean != null) {
|
||||
set.add((E) bean);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the underlying set has its data.
|
||||
*/
|
||||
@Override
|
||||
public boolean isPopulated() {
|
||||
return set != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a reference (lazy loading) bean collection. This is
|
||||
* the same as !isPopulated();
|
||||
*/
|
||||
@Override
|
||||
public boolean isReference() {
|
||||
return set == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEmptyLazyLoad() {
|
||||
if (set == null) {
|
||||
set = new LinkedHashSet<>();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void initClear() {
|
||||
lock.lock();
|
||||
try {
|
||||
if (set == null) {
|
||||
if (!disableLazyLoad && modifyListening) {
|
||||
lazyLoadCollection(false);
|
||||
} else {
|
||||
set = new LinkedHashSet<>();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
lock.lock();
|
||||
try {
|
||||
if (set == null) {
|
||||
if (disableLazyLoad) {
|
||||
set = new LinkedHashSet<>();
|
||||
} else {
|
||||
lazyLoadCollection(false);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public BeanCollectionAdd collectionAdd() {
|
||||
if (set == null) {
|
||||
set = new LinkedHashSet<>();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void refresh(ModifyListenMode modifyListenMode, BeanSet<E> newSet) {
|
||||
setModifyListening(modifyListenMode);
|
||||
this.set = newSet.actualSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual underlying set.
|
||||
*/
|
||||
public LinkedHashSet<E> actualSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<E> actualDetails() {
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<?> actualEntries() {
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (set == null) {
|
||||
return "BeanSet<deferred>";
|
||||
} else {
|
||||
return set.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equal if obj is a Set and equal in a Set sense.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
init();
|
||||
return set.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
init();
|
||||
return set.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBean(E bean) {
|
||||
add(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBean(E bean) {
|
||||
if (set.remove(bean)) {
|
||||
getModifyHolder().modifyRemoval(bean);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------//
|
||||
// proxy method for map
|
||||
// -----------------------------------------------------//
|
||||
|
||||
@Override
|
||||
public boolean add(E bean) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
if (set.add(bean)) {
|
||||
modifyAddition(bean);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return set.add(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends E> beans) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
boolean changed = false;
|
||||
for (E bean : beans) {
|
||||
if (set.add(bean)) {
|
||||
// register the addition of the bean
|
||||
modifyAddition(bean);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
return set.addAll(beans);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
checkReadOnly();
|
||||
initClear();
|
||||
if (modifyListening) {
|
||||
for (E bean : set) {
|
||||
modifyRemoval(bean);
|
||||
}
|
||||
}
|
||||
set.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object bean) {
|
||||
init();
|
||||
return set.contains(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> beans) {
|
||||
init();
|
||||
return set.containsAll(beans);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
init();
|
||||
return set.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<E> iterator() {
|
||||
init();
|
||||
if (readOnly) {
|
||||
return new ReadOnlyIterator<>(set.iterator());
|
||||
}
|
||||
if (modifyListening) {
|
||||
return new ModifyIterator<>(this, set.iterator());
|
||||
}
|
||||
return set.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object bean) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
if (set.remove(bean)) {
|
||||
modifyRemoval(bean);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return set.remove(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> beans) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
boolean changed = false;
|
||||
for (Object bean : beans) {
|
||||
if (set.remove(bean)) {
|
||||
modifyRemoval(bean);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
return set.removeAll(beans);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> beans) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
boolean changed = false;
|
||||
Iterator<?> it = set.iterator();
|
||||
while (it.hasNext()) {
|
||||
Object bean = it.next();
|
||||
if (!beans.contains(bean)) {
|
||||
// not retaining this bean so add it to the removal list
|
||||
it.remove();
|
||||
modifyRemoval(bean);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
return set.retainAll(beans);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
init();
|
||||
return set.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
init();
|
||||
return set.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(T[] array) {
|
||||
init();
|
||||
//noinspection SuspiciousToArrayCall
|
||||
return set.toArray(array);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SequencedSet<E> reversed() {
|
||||
init();
|
||||
if (modifyListening) {
|
||||
throw new UnsupportedOperationException("Not supported on modify listening set");
|
||||
}
|
||||
return set.reversed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFirst(E bean) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
modifyAddition(bean);
|
||||
}
|
||||
set.addFirst(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLast(E bean) {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
modifyAddition(bean);
|
||||
}
|
||||
set.addLast(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public E getFirst() {
|
||||
init();
|
||||
return set.getFirst();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E getLast() {
|
||||
init();
|
||||
return set.getLast();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E removeFirst() {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
var bean = set.removeFirst();
|
||||
modifyRemoval(bean);
|
||||
return bean;
|
||||
}
|
||||
return set.removeFirst();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E removeLast() {
|
||||
checkReadOnly();
|
||||
init();
|
||||
if (modifyListening) {
|
||||
var bean = set.removeLast();
|
||||
modifyRemoval(bean);
|
||||
return bean;
|
||||
}
|
||||
return set.removeLast();
|
||||
}
|
||||
|
||||
private static final class ReadOnlyIterator<E> implements Iterator<E>, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2577697326745352605L;
|
||||
|
||||
private final Iterator<E> it;
|
||||
|
||||
ReadOnlyIterator(Iterator<E> it) {
|
||||
this.it = it;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return it.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E next() {
|
||||
return it.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new IllegalStateException("This collection is in ReadOnly mode");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanCollection<E> shallowCopy() {
|
||||
BeanSet<E> copy = new BeanSet<>(new LinkedHashSet<>(set));
|
||||
copy.setFromOriginal(this);
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,4 @@ class DbPrimaryTest {
|
||||
assertEquals("h2", DbPrimary.getDefaultServerName());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLoadProperties() {
|
||||
Properties properties = DbPrimary.getProperties();
|
||||
assertFalse(properties.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,13 +136,13 @@ class ToStringBuilderTest {
|
||||
@Test
|
||||
void beanSet_null_empty() {
|
||||
assertThat(toStringFor(new BeanSet<String>(null))).isEqualTo("[]");
|
||||
assertThat(toStringFor(new BeanSet<String>(Collections.emptySet()))).isEqualTo("[]");
|
||||
assertThat(toStringFor(new BeanSet<String>(new LinkedHashSet<>()))).isEqualTo("[]");
|
||||
}
|
||||
|
||||
@Test
|
||||
void beanMap_null_empty() {
|
||||
assertThat(toStringFor(new BeanMap<String, String>(null))).isEqualTo("{}");
|
||||
assertThat(toStringFor(new BeanMap<String, String>(Collections.emptyMap()))).isEqualTo("{}");
|
||||
assertThat(toStringFor(new BeanMap<String, String>(new LinkedHashMap<>()))).isEqualTo("{}");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -159,7 +159,7 @@ class ToStringBuilderTest {
|
||||
|
||||
@Test
|
||||
void beanMap_some() {
|
||||
Map<String, Recurse> under = new LinkedHashMap<>();
|
||||
var under = new LinkedHashMap<String, Recurse>();
|
||||
under.put("a", new Recurse(1, "a"));
|
||||
under.put("b", new Recurse(2, "b"));
|
||||
BeanMap<String, Recurse> list = new BeanMap<>(under);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.ebean.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.annotation.MutationDetection;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
@@ -17,7 +18,7 @@ class DatabaseConfigTest {
|
||||
|
||||
@Test
|
||||
void testLoadFromEbeanProperties() {
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
var config = new DatabaseConfig().settings();
|
||||
config.loadFromProperties();
|
||||
|
||||
assertEquals(PersistBatch.NONE, config.getPersistBatch());
|
||||
@@ -32,7 +33,7 @@ class DatabaseConfigTest {
|
||||
Properties props = new Properties();
|
||||
props.setProperty("ddl.initSql", "${user.home}" + fileSeparator + "initSql");
|
||||
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
var config = new DatabaseConfig().settings();
|
||||
config.loadFromProperties(props);
|
||||
|
||||
String ddlInitSql = config.getDdlInitSql();
|
||||
@@ -41,7 +42,7 @@ class DatabaseConfigTest {
|
||||
|
||||
@Test
|
||||
void testLoadWithProperties() {
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
DatabaseBuilder config = new DatabaseConfig();
|
||||
config.setPersistBatch(PersistBatch.NONE);
|
||||
config.setPersistBatchOnCascade(PersistBatch.NONE);
|
||||
config.setAutoReadOnlyDataSource(false);
|
||||
@@ -73,6 +74,7 @@ class DatabaseConfigTest {
|
||||
props.setProperty("forUpdateNoKey", "true");
|
||||
props.setProperty("defaultServer", "false");
|
||||
props.setProperty("skipDataSourceCheck", "true");
|
||||
props.setProperty("readOnlyDatabase", "true");
|
||||
|
||||
props.setProperty("queryPlan.enable", "true");
|
||||
props.setProperty("queryPlan.thresholdMicros", "10000");
|
||||
@@ -83,46 +85,48 @@ class DatabaseConfigTest {
|
||||
|
||||
config.loadFromProperties(props);
|
||||
|
||||
assertFalse(config.isDefaultServer());
|
||||
assertTrue(config.isDisableL2Cache());
|
||||
assertTrue(config.isNotifyL2CacheInForeground());
|
||||
assertTrue(config.isDbOffline());
|
||||
assertTrue(config.isAutoReadOnlyDataSource());
|
||||
assertTrue(config.isAutoLoadModuleInfo());
|
||||
assertTrue(config.isLoadModuleInfo());
|
||||
assertTrue(config.skipDataSourceCheck());
|
||||
var settings = config.settings();
|
||||
assertFalse(settings.isDefaultServer());
|
||||
assertTrue(settings.isDisableL2Cache());
|
||||
assertTrue(settings.isNotifyL2CacheInForeground());
|
||||
assertTrue(settings.isDbOffline());
|
||||
assertTrue(settings.isAutoReadOnlyDataSource());
|
||||
assertTrue(settings.isAutoLoadModuleInfo());
|
||||
assertTrue(settings.isLoadModuleInfo());
|
||||
assertTrue(settings.skipDataSourceCheck());
|
||||
assertTrue(settings.readOnlyDatabase());
|
||||
|
||||
assertTrue(config.isIdGeneratorAutomatic());
|
||||
assertFalse(config.getPlatformConfig().isCaseSensitiveCollation());
|
||||
assertTrue(config.getPlatformConfig().isForUpdateNoKey());
|
||||
assertTrue(settings.isIdGeneratorAutomatic());
|
||||
assertFalse(settings.getPlatformConfig().isCaseSensitiveCollation());
|
||||
assertTrue(settings.getPlatformConfig().isForUpdateNoKey());
|
||||
|
||||
assertThat(config.getNamingConvention()).isInstanceOf(MatchingNamingConvention.class);
|
||||
assertThat(settings.getNamingConvention()).isInstanceOf(MatchingNamingConvention.class);
|
||||
|
||||
assertEquals(MutationDetection.NONE, config.getJsonMutationDetection());
|
||||
assertEquals(MutationDetection.NONE, settings.getJsonMutationDetection());
|
||||
config.setJsonMutationDetection(MutationDetection.SOURCE);
|
||||
assertEquals(MutationDetection.SOURCE, config.getJsonMutationDetection());
|
||||
assertEquals(IdType.SEQUENCE, config.getIdType());
|
||||
assertEquals(PersistBatch.ALL, config.getPersistBatch());
|
||||
assertEquals(PersistBatch.ALL, config.getPersistBatchOnCascade());
|
||||
Assertions.assertEquals(PlatformConfig.DbUuid.BINARY, config.getPlatformConfig().getDbUuid());
|
||||
Assertions.assertEquals(JsonConfig.DateTime.MILLIS, config.getJsonDateTime());
|
||||
assertEquals(JsonConfig.Date.MILLIS, config.getJsonDate());
|
||||
assertEquals(MutationDetection.SOURCE, settings.getJsonMutationDetection());
|
||||
assertEquals(IdType.SEQUENCE, settings.getIdType());
|
||||
assertEquals(PersistBatch.ALL, settings.getPersistBatch());
|
||||
assertEquals(PersistBatch.ALL, settings.getPersistBatchOnCascade());
|
||||
Assertions.assertEquals(PlatformConfig.DbUuid.BINARY, settings.getPlatformConfig().getDbUuid());
|
||||
Assertions.assertEquals(JsonConfig.DateTime.MILLIS, settings.getJsonDateTime());
|
||||
assertEquals(JsonConfig.Date.MILLIS, settings.getJsonDate());
|
||||
|
||||
assertEquals("r0,users,orgs", config.getEnabledL2Regions());
|
||||
assertEquals("r0,users,orgs", settings.getEnabledL2Regions());
|
||||
|
||||
assertEquals(42, config.getJdbcFetchSizeFindEach());
|
||||
assertEquals(43, config.getJdbcFetchSizeFindList());
|
||||
assertEquals(4, config.getBackgroundExecutorSchedulePoolSize());
|
||||
assertEquals(98, config.getBackgroundExecutorShutdownSecs());
|
||||
assertEquals(42, settings.getJdbcFetchSizeFindEach());
|
||||
assertEquals(43, settings.getJdbcFetchSizeFindList());
|
||||
assertEquals(4, settings.getBackgroundExecutorSchedulePoolSize());
|
||||
assertEquals(98, settings.getBackgroundExecutorShutdownSecs());
|
||||
|
||||
assertTrue(config.isQueryPlanEnable());
|
||||
assertEquals(10000, config.getQueryPlanThresholdMicros());
|
||||
assertTrue(config.isQueryPlanCapture());
|
||||
assertEquals(42, config.getQueryPlanCapturePeriodSecs());
|
||||
assertEquals(560, config.getQueryPlanCaptureMaxTimeMillis());
|
||||
assertEquals(7, config.getQueryPlanCaptureMaxCount());
|
||||
assertTrue(settings.isQueryPlanEnable());
|
||||
assertEquals(10000, settings.getQueryPlanThresholdMicros());
|
||||
assertTrue(settings.isQueryPlanCapture());
|
||||
assertEquals(42, settings.getQueryPlanCapturePeriodSecs());
|
||||
assertEquals(560, settings.getQueryPlanCaptureMaxTimeMillis());
|
||||
assertEquals(7, settings.getQueryPlanCaptureMaxCount());
|
||||
|
||||
assertThat(config.getMappingLocations()).containsExactly("classpath:/foo","bar");
|
||||
assertThat(settings.getMappingLocations()).containsExactly("classpath:/foo","bar");
|
||||
|
||||
config.setPersistBatch(PersistBatch.NONE);
|
||||
config.setPersistBatchOnCascade(PersistBatch.NONE);
|
||||
@@ -137,19 +141,19 @@ class DatabaseConfigTest {
|
||||
props1.setProperty("ebean.notifyL2CacheInForeground", "false");
|
||||
|
||||
config.loadFromProperties(props1);
|
||||
assertFalse(config.isDisableL2Cache());
|
||||
assertFalse(config.isNotifyL2CacheInForeground());
|
||||
assertFalse(settings.isDisableL2Cache());
|
||||
assertFalse(settings.isNotifyL2CacheInForeground());
|
||||
|
||||
assertEquals(PersistBatch.ALL, config.getPersistBatch());
|
||||
assertEquals(PersistBatch.ALL, config.getPersistBatchOnCascade());
|
||||
assertEquals(PersistBatch.ALL, settings.getPersistBatch());
|
||||
assertEquals(PersistBatch.ALL, settings.getPersistBatchOnCascade());
|
||||
|
||||
config.setEnabledL2Regions("r0,orgs");
|
||||
assertEquals("r0,orgs", config.getEnabledL2Regions());
|
||||
assertEquals("r0,orgs", settings.getEnabledL2Regions());
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_defaults() {
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
DatabaseBuilder.Settings config = new DatabaseConfig().settings();
|
||||
assertTrue(config.isIdGeneratorAutomatic());
|
||||
assertTrue(config.isDefaultServer());
|
||||
assertFalse(config.isAutoPersistUpdates());
|
||||
@@ -184,7 +188,7 @@ class DatabaseConfigTest {
|
||||
void test_putServiceObject() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
var config = new DatabaseConfig().settings();
|
||||
config.putServiceObject(objectMapper);
|
||||
|
||||
ObjectMapper mapper0 = config.getServiceObject(ObjectMapper.class);
|
||||
|
||||
+38
-35
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
@@ -89,49 +89,49 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-joda-time</artifactId>
|
||||
<version>13.18.0</version>
|
||||
<version>13.24.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-jsonnode</artifactId>
|
||||
<version>13.18.0</version>
|
||||
<version>13.24.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-mapper</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -155,46 +155,37 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<scope>provided</scope>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<scope>provided</scope>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-spring-txn</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<!-- platforms -->
|
||||
@@ -202,67 +193,79 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-clickhouse</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-db2</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-h2</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-hana</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-mariadb</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-mysql</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-nuodb</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-oracle</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgres</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis-types</artifactId>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-sqlite</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-sqlserver</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
+3
-10
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -30,17 +30,10 @@
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.4.3</version>
|
||||
<version>42.6.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebean.core.type;
|
||||
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,5 +12,5 @@ public interface ExtraTypeFactory {
|
||||
/**
|
||||
* Provide extra types to Ebean.
|
||||
*/
|
||||
List<? extends ScalarType<?>> createTypes(DatabaseConfig config, Object objectMapper);
|
||||
List<? extends ScalarType<?>> createTypes(DatabaseBuilder.Settings config, Object objectMapper);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean.core.type;
|
||||
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
|
||||
/**
|
||||
* Factory to create ScalarTypeSet.
|
||||
@@ -12,6 +12,6 @@ public interface ScalarTypeSetFactory {
|
||||
* Create the ScalarTypeSet given the config and optional objectMapper.
|
||||
*/
|
||||
@Nullable
|
||||
ScalarTypeSet<?> createTypeSet(DatabaseConfig config, @Nullable Object objectMapper);
|
||||
ScalarTypeSet<?> createTypeSet(DatabaseBuilder.Settings config, @Nullable Object objectMapper);
|
||||
|
||||
}
|
||||
|
||||
+8
-15
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core</artifactId>
|
||||
@@ -22,7 +22,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -46,7 +46,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -58,7 +58,7 @@
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
<version>4.8-1</version>
|
||||
<version>4.13.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
@@ -151,7 +151,7 @@
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.5.1</version>
|
||||
<version>42.6.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
@@ -159,21 +159,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.22.0</version>
|
||||
<version>13.26.1-jakarta</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -184,13 +184,6 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebeaninternal.server.type.GeoTypeBinder;
|
||||
|
||||
/**
|
||||
@@ -11,5 +11,5 @@ public interface GeoTypeProvider {
|
||||
/**
|
||||
* Create a binder for binding geometry types.
|
||||
*/
|
||||
GeoTypeBinder createBinder(DatabaseConfig config);
|
||||
GeoTypeBinder createBinder(DatabaseBuilder.Settings config);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public final class LoadBeanRequest extends LoadRequest {
|
||||
}
|
||||
|
||||
private String mode() {
|
||||
return lazy ? "+lazy" : loadBuffer.isCache() ? "+cache" : "+query";
|
||||
return lazy ? "lazy" : loadBuffer.isCache() ? "cache" : "query";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,7 +101,7 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
query.setLazyLoadForParents(many);
|
||||
many.addWhereParentIdIn(query, parentIdList(server), loadContext.isUseDocStore());
|
||||
query.setPersistenceContext(loadContext.persistenceContext());
|
||||
query.setLoadDescription(lazy ? "+lazy" : "+query", description());
|
||||
query.setLoadDescription(lazy ? "lazy" : "query", description());
|
||||
if (lazy) {
|
||||
query.setLazyLoadBatchSize(loadContext.batchSize());
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.CacheMode;
|
||||
import io.ebean.CountDistinctOrder;
|
||||
import io.ebean.ExpressionList;
|
||||
@@ -339,7 +340,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
|
||||
/**
|
||||
* Set the on a secondary query given the label, relativePath and profile location of the parent query.
|
||||
*/
|
||||
void setProfilePath(String label, String relativePath, ProfileLocation profileLocation);
|
||||
void setProfilePath(String label, String relativePath, @Nullable ProfileLocation profileLocation);
|
||||
|
||||
/**
|
||||
* Set the query mode.
|
||||
@@ -653,6 +654,16 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
|
||||
*/
|
||||
ObjectGraphNode parentNode();
|
||||
|
||||
/**
|
||||
* Set that this is a future query that will execute in the background.
|
||||
*/
|
||||
void usingFuture();
|
||||
|
||||
/**
|
||||
* Return true if this is a future query.
|
||||
*/
|
||||
boolean isUsingFuture();
|
||||
|
||||
/**
|
||||
* Return false when this is a lazy load or refresh query for a bean.
|
||||
* <p>
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package io.ebeaninternal.server.autotune;
|
||||
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
|
||||
public interface AutoTuneServiceProvider {
|
||||
|
||||
AutoTuneService create(SpiEbeanServer server, DatabaseConfig config);
|
||||
AutoTuneService create(SpiEbeanServer server, DatabaseBuilder config);
|
||||
}
|
||||
|
||||
+6
-6
@@ -4,7 +4,7 @@ import io.ebean.cache.QueryCacheEntryValidate;
|
||||
import io.ebean.cache.ServerCacheFactory;
|
||||
import io.ebean.cache.ServerCacheOptions;
|
||||
import io.ebean.config.CurrentTenantProvider;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
public final class CacheManagerOptions {
|
||||
|
||||
private final ClusterManager clusterManager;
|
||||
private final DatabaseConfig databaseConfig;
|
||||
private final DatabaseBuilder.Settings databaseBuilder;
|
||||
private final boolean localL2Caching;
|
||||
private CurrentTenantProvider currentTenantProvider;
|
||||
private QueryCacheEntryValidate queryCacheEntryValidate;
|
||||
@@ -24,15 +24,15 @@ public final class CacheManagerOptions {
|
||||
CacheManagerOptions() {
|
||||
this.localL2Caching = true;
|
||||
this.clusterManager = null;
|
||||
this.databaseConfig = null;
|
||||
this.databaseBuilder = null;
|
||||
this.cacheFactory = new DefaultServerCacheFactory();
|
||||
this.beanDefault = new ServerCacheOptions();
|
||||
this.queryDefault = new ServerCacheOptions();
|
||||
}
|
||||
|
||||
public CacheManagerOptions(ClusterManager clusterManager, DatabaseConfig config, boolean localL2Caching) {
|
||||
public CacheManagerOptions(ClusterManager clusterManager, DatabaseBuilder.Settings config, boolean localL2Caching) {
|
||||
this.clusterManager = clusterManager;
|
||||
this.databaseConfig = config;
|
||||
this.databaseBuilder = config;
|
||||
this.localL2Caching = localL2Caching;
|
||||
this.currentTenantProvider = config.getCurrentTenantProvider();
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public final class CacheManagerOptions {
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
return (databaseConfig == null) ? "db" : databaseConfig.getName();
|
||||
return (databaseBuilder == null) ? "db" : databaseBuilder.getName();
|
||||
}
|
||||
|
||||
public boolean isLocalL2Caching() {
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package io.ebeaninternal.server.cache;
|
||||
import io.ebean.BackgroundExecutor;
|
||||
import io.ebean.cache.ServerCacheFactory;
|
||||
import io.ebean.cache.ServerCachePlugin;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
|
||||
/**
|
||||
* Default implementation of ServerCachePlugin.
|
||||
@@ -14,7 +14,7 @@ public final class DefaultServerCachePlugin implements ServerCachePlugin {
|
||||
* Creates the default ServerCacheFactory.
|
||||
*/
|
||||
@Override
|
||||
public ServerCacheFactory create(DatabaseConfig config, BackgroundExecutor executor) {
|
||||
public ServerCacheFactory create(DatabaseBuilder config, BackgroundExecutor executor) {
|
||||
return new DefaultServerCacheFactory(executor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import io.ebean.Database;
|
||||
import io.ebean.config.ContainerConfig;
|
||||
import io.ebeaninternal.server.transaction.RemoteTransactionEvent;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -20,38 +19,22 @@ public class ClusterManager implements ServerLookup {
|
||||
private static final System.Logger clusterLogger = AppLog.getLogger("io.ebean.Cluster");
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
private final ConcurrentHashMap<String, Database> serverMap = new ConcurrentHashMap<>();
|
||||
|
||||
private final Object monitor = new Object();
|
||||
|
||||
private final ClusterBroadcast broadcast;
|
||||
|
||||
private boolean started;
|
||||
|
||||
private boolean shutdown;
|
||||
|
||||
public ClusterManager(ContainerConfig config) {
|
||||
ClusterBroadcastFactory factory = createFactory();
|
||||
if (factory != null && config.isActive()) {
|
||||
broadcast = factory.create(this, config);
|
||||
if (config.isActive()) {
|
||||
ClusterBroadcastFactory factory = createFactory();
|
||||
broadcast = factory != null ? factory.create(this, config) : null;
|
||||
} else {
|
||||
broadcast = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ClusterTransportFactory via ServiceLoader.
|
||||
*/
|
||||
private ClusterBroadcastFactory createFactory() {
|
||||
|
||||
ServiceLoader<ClusterBroadcastFactory> load = ServiceLoader.load(ClusterBroadcastFactory.class);
|
||||
ClusterBroadcastFactory factory = null;
|
||||
Iterator<ClusterBroadcastFactory> iterator = load.iterator();
|
||||
if (iterator.hasNext()) {
|
||||
factory = iterator.next();
|
||||
}
|
||||
return factory;
|
||||
return ServiceLoader.load(ClusterBroadcastFactory.class).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public void registerServer(Database server) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.ebeaninternal.server.core;
|
||||
|
||||
import io.avaje.classpath.scanner.ClassPathScanner;
|
||||
import io.avaje.classpath.scanner.ClassPathScannerFactory;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -16,7 +16,7 @@ public class ClassPathScanners {
|
||||
/**
|
||||
* Return the list of ClassPathScanner services using DatabaseConfig service loader.
|
||||
*/
|
||||
public static List<ClassPathScanner> find(DatabaseConfig config) {
|
||||
public static List<ClassPathScanner> find(DatabaseBuilder.Settings config) {
|
||||
List<ClassPathScanner> scanners = new ArrayList<>();
|
||||
for (ClassPathScannerFactory factory : ServiceLoader.load(ClassPathScannerFactory.class)) {
|
||||
scanners.add(factory.createScanner(config.getClassLoadConfig().getClassLoader()));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.DatabasePlatformProvider;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
@@ -37,7 +37,7 @@ public class DatabasePlatformFactory {
|
||||
/**
|
||||
* Create the appropriate database specific platform.
|
||||
*/
|
||||
public DatabasePlatform create(DatabaseConfig config) {
|
||||
public DatabasePlatform create(DatabaseBuilder.Settings config) {
|
||||
try {
|
||||
String offlinePlatform = DbOffline.getPlatform();
|
||||
if (offlinePlatform != null) {
|
||||
|
||||
@@ -82,9 +82,9 @@ final class DefaultBeanLoader {
|
||||
// populate a new collection
|
||||
BeanCollection<?> emptyCollection = many.createEmpty(parentBean);
|
||||
many.setValue(parentBean, emptyCollection);
|
||||
query.setLoadDescription("+refresh", null);
|
||||
query.setLoadDescription("refresh", null);
|
||||
} else {
|
||||
query.setLoadDescription("+lazy", null);
|
||||
query.setLoadDescription("lazy", null);
|
||||
}
|
||||
|
||||
query.select(parentDesc.idBinder().idSelect());
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.config.*;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.event.ShutdownManager;
|
||||
@@ -12,11 +14,13 @@ import io.ebeaninternal.server.cluster.ClusterManager;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClassPathSearch;
|
||||
import io.ebeaninternal.server.core.bootup.BootupClasses;
|
||||
import io.ebeaninternal.server.executor.DefaultBackgroundExecutor;
|
||||
|
||||
import jakarta.persistence.PersistenceException;
|
||||
|
||||
import java.net.URL;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -32,12 +36,22 @@ public final class DefaultContainer implements SpiContainer {
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final ClusterManager clusterManager;
|
||||
private final List<EntityClassRegister> entityClassRegisters;
|
||||
|
||||
public DefaultContainer(ContainerConfig containerConfig) {
|
||||
this.clusterManager = new ClusterManager(containerConfig);
|
||||
// register so that we can shutdown any Ebean wide
|
||||
// resources such as clustering
|
||||
ShutdownManager.registerContainer(this);
|
||||
entityClassRegisters = initEntityRegisters();
|
||||
}
|
||||
|
||||
private List<EntityClassRegister> initEntityRegisters() {
|
||||
var entityClassRegisters = new ArrayList<EntityClassRegister>();
|
||||
for (EntityClassRegister entityClassRegister : ServiceLoader.load(EntityClassRegister.class)) {
|
||||
entityClassRegisters.add(entityClassRegister);
|
||||
}
|
||||
return entityClassRegisters;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,13 +65,12 @@ public final class DefaultContainer implements SpiContainer {
|
||||
*/
|
||||
@Override
|
||||
public SpiEbeanServer createServer(String name) {
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
config.setName(name);
|
||||
config.loadFromProperties();
|
||||
return createServer(config);
|
||||
var builder = Database.builder().name(name).loadFromProperties();
|
||||
return createServer(builder);
|
||||
}
|
||||
|
||||
private SpiBackgroundExecutor createBackgroundExecutor(DatabaseConfig config) {
|
||||
private SpiBackgroundExecutor createBackgroundExecutor(DatabaseBuilder builder) {
|
||||
var config = builder.settings();
|
||||
String namePrefix = "ebean-" + config.getName();
|
||||
int schedulePoolSize = config.getBackgroundExecutorSchedulePoolSize();
|
||||
int shutdownSecs = config.getBackgroundExecutorShutdownSecs();
|
||||
@@ -69,9 +82,10 @@ public final class DefaultContainer implements SpiContainer {
|
||||
* Create the implementation from the configuration.
|
||||
*/
|
||||
@Override
|
||||
public SpiEbeanServer createServer(DatabaseConfig config) {
|
||||
public SpiEbeanServer createServer(DatabaseBuilder builder) {
|
||||
lock.lock();
|
||||
try {
|
||||
var config = builder.settings();
|
||||
long start = System.currentTimeMillis();
|
||||
applyConfigServices(config);
|
||||
setNamingConvention(config);
|
||||
@@ -79,7 +93,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
|
||||
boolean online = true;
|
||||
if (config.isDocStoreOnly()) {
|
||||
config.setDatabasePlatform(new DatabasePlatform());
|
||||
config.databasePlatform(new DatabasePlatform());
|
||||
} else {
|
||||
TenantMode tenantMode = config.getTenantMode();
|
||||
if (TenantMode.DB != tenantMode) {
|
||||
@@ -115,7 +129,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyConfigServices(DatabaseConfig config) {
|
||||
private void applyConfigServices(DatabaseBuilder.Settings config) {
|
||||
if (config.isDefaultServer()) {
|
||||
for (DatabaseConfigProvider configProvider : ServiceLoader.load(DatabaseConfigProvider.class)) {
|
||||
configProvider.apply(config);
|
||||
@@ -123,12 +137,10 @@ public final class DefaultContainer implements SpiContainer {
|
||||
}
|
||||
if (config.isLoadModuleInfo()) {
|
||||
// auto register entity classes
|
||||
boolean found = false;
|
||||
for (EntityClassRegister loader : ServiceLoader.load(EntityClassRegister.class)) {
|
||||
for (EntityClassRegister loader : entityClassRegisters) {
|
||||
config.addAll(loader.classesFor(config.getName(), config.isDefaultServer()));
|
||||
found = true;
|
||||
}
|
||||
if (!found) {
|
||||
if (entityClassRegisters.isEmpty()) {
|
||||
checkMissingModulePathProvides();
|
||||
}
|
||||
}
|
||||
@@ -158,7 +170,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
* Get the entities, scalarTypes, Listeners etc combining the class registered
|
||||
* ones with the already created instances.
|
||||
*/
|
||||
private BootupClasses bootupClasses(DatabaseConfig config) {
|
||||
private BootupClasses bootupClasses(DatabaseBuilder.Settings config) {
|
||||
BootupClasses bootup = bootupClasses1(config);
|
||||
bootup.addServerConfigStartup(config.getServerConfigStartupListeners());
|
||||
bootup.runServerConfigStartup(config);
|
||||
@@ -176,7 +188,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
/**
|
||||
* Get the class based entities, scalarTypes, Listeners etc.
|
||||
*/
|
||||
private BootupClasses bootupClasses1(DatabaseConfig config) {
|
||||
private BootupClasses bootupClasses1(DatabaseBuilder.Settings config) {
|
||||
Set<Class<?>> classes = config.classes();
|
||||
if (config.isDisableClasspathSearch() || (classes != null && !classes.isEmpty())) {
|
||||
// use classes we explicitly added via configuration
|
||||
@@ -188,16 +200,16 @@ public final class DefaultContainer implements SpiContainer {
|
||||
/**
|
||||
* Set the naming convention to underscore if it has not already been set.
|
||||
*/
|
||||
private void setNamingConvention(DatabaseConfig config) {
|
||||
private void setNamingConvention(DatabaseBuilder.Settings config) {
|
||||
if (config.getNamingConvention() == null) {
|
||||
config.setNamingConvention(new UnderscoreNamingConvention());
|
||||
config.namingConvention(new UnderscoreNamingConvention());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the DatabasePlatform if it has not already been set.
|
||||
*/
|
||||
private void setDatabasePlatform(DatabaseConfig config) {
|
||||
private void setDatabasePlatform(DatabaseBuilder.Settings config) {
|
||||
DatabasePlatform platform = config.getDatabasePlatform();
|
||||
if (platform == null) {
|
||||
if (config.getTenantMode().isDynamicDataSource()) {
|
||||
@@ -205,7 +217,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
}
|
||||
// automatically determine the platform
|
||||
platform = new DatabasePlatformFactory().create(config);
|
||||
config.setDatabasePlatform(platform);
|
||||
config.databasePlatform(platform);
|
||||
}
|
||||
platform.configure(config.getPlatformConfig());
|
||||
}
|
||||
@@ -213,7 +225,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
/**
|
||||
* Set the DataSource if it has not already been set.
|
||||
*/
|
||||
private void setDataSource(DatabaseConfig config) {
|
||||
private void setDataSource(DatabaseBuilder.Settings config) {
|
||||
if (isOfflineMode(config)) {
|
||||
log.log(DEBUG, "... DbOffline using platform [{0}]", DbOffline.getPlatform());
|
||||
} else {
|
||||
@@ -221,7 +233,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isOfflineMode(DatabaseConfig config) {
|
||||
private boolean isOfflineMode(DatabaseBuilder.Settings config) {
|
||||
return config.isDbOffline() || DbOffline.isSet();
|
||||
}
|
||||
|
||||
@@ -229,13 +241,11 @@ public final class DefaultContainer implements SpiContainer {
|
||||
* Check the autoCommit and Transaction Isolation levels of the DataSource.
|
||||
* <p>
|
||||
* If autoCommit is true this could be a real problem.
|
||||
* </p>
|
||||
* <p>
|
||||
* If the Isolation level is not READ_COMMITTED then optimistic concurrency
|
||||
* checking may not work as expected.
|
||||
* </p>
|
||||
*/
|
||||
private boolean checkDataSource(DatabaseConfig config) {
|
||||
private boolean checkDataSource(DatabaseBuilder.Settings config) {
|
||||
if (isOfflineMode(config)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
private static final System.Logger log = CoreLog.internal;
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final DatabaseConfig config;
|
||||
private final DatabaseBuilder.Settings config;
|
||||
private final String serverName;
|
||||
private final DatabasePlatform databasePlatform;
|
||||
private final TransactionManager transactionManager;
|
||||
@@ -170,7 +170,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
/**
|
||||
* Create the CallStackFactory depending if AutoTune is being used.
|
||||
*/
|
||||
private CallOriginFactory initCallStackFactory(DatabaseConfig config) {
|
||||
private CallOriginFactory initCallStackFactory(DatabaseBuilder.Settings config) {
|
||||
if (!config.getAutoTuneConfig().isActive()) {
|
||||
// use a common CallStack for performance as we don't care with no AutoTune
|
||||
return new NoopCallOriginFactory();
|
||||
@@ -224,7 +224,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseConfig config() {
|
||||
public DatabaseBuilder.Settings config() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -961,7 +961,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
}
|
||||
if (!query.isRawSql()) {
|
||||
query.setDefaultRawSqlIfRequired();
|
||||
if (query.isAutoTunable() && !autoTuneService.tuneQuery(query)) {
|
||||
if (!query.isAutoTunable() || !autoTuneService.tuneQuery(query)) {
|
||||
// use deployment FetchType.LAZY/EAGER annotations
|
||||
// to define the 'default' select clause
|
||||
query.setDefaultSelectClause();
|
||||
@@ -1273,6 +1273,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
@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) {
|
||||
@@ -1291,6 +1292,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
@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) {
|
||||
@@ -1309,6 +1311,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
@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.setPersistenceContext(new DefaultPersistenceContext());
|
||||
if (!spiQuery.isDisableReadAudit()) {
|
||||
@@ -1651,41 +1654,50 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
}, transaction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert the bean.
|
||||
*/
|
||||
@Override
|
||||
public void insert(Object bean) {
|
||||
insert(bean, null);
|
||||
persister.insert(checkEntityBean(bean), null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Object bean, @Nullable InsertOptions insertOptions) {
|
||||
persister.insert(checkEntityBean(bean), insertOptions, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert the bean with a transaction.
|
||||
*/
|
||||
@Override
|
||||
public void insert(Object bean, @Nullable Transaction transaction) {
|
||||
persister.insert(checkEntityBean(bean), transaction);
|
||||
persister.insert(checkEntityBean(bean), null, transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Object bean, InsertOptions insertOptions, Transaction transaction) {
|
||||
persister.insert(checkEntityBean(bean), insertOptions, transaction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert all beans in the collection.
|
||||
*/
|
||||
@Override
|
||||
public void insertAll(Collection<?> beans) {
|
||||
insertAll(beans, null);
|
||||
insertAll(beans, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAll(Collection<?> beans, InsertOptions options) {
|
||||
insertAll(beans, options, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert all beans in the collection with a transaction.
|
||||
*/
|
||||
@Override
|
||||
public void insertAll(@Nullable Collection<?> beans, @Nullable Transaction transaction) {
|
||||
insertAll(beans, null, transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAll(@Nullable Collection<?> beans, InsertOptions options, @Nullable Transaction transaction) {
|
||||
if (beans == null || beans.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
executeInTrans((txn) -> {
|
||||
txn.checkBatchEscalationOnCollection();
|
||||
for (Object bean : beans) {
|
||||
persister.insert(checkEntityBean(bean), txn);
|
||||
persister.insert(checkEntityBean(bean), options, txn);
|
||||
}
|
||||
return 0;
|
||||
}, transaction);
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.datasource.DataSourceAlertFactory;
|
||||
import io.ebean.datasource.DataSourceConfig;
|
||||
import io.ebean.datasource.DataSourceFactory;
|
||||
import io.ebean.datasource.DataSourcePoolListener;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.datasource.*;
|
||||
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
@@ -15,16 +12,16 @@ import javax.sql.DataSource;
|
||||
*/
|
||||
final class InitDataSource {
|
||||
|
||||
private final DatabaseConfig config;
|
||||
private final DatabaseBuilder.Settings config;
|
||||
|
||||
/**
|
||||
* Create and set the main DataSource and read-only DataSource.
|
||||
*/
|
||||
static void init(DatabaseConfig config) {
|
||||
static void init(DatabaseBuilder.Settings config) {
|
||||
new InitDataSource(config).initialise();
|
||||
}
|
||||
|
||||
InitDataSource(DatabaseConfig config) {
|
||||
InitDataSource(DatabaseBuilder.Settings config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@@ -41,19 +38,23 @@ final class InitDataSource {
|
||||
* Initialise the "main" read write DataSource from configuration.
|
||||
*/
|
||||
private DataSource initDataSource() {
|
||||
return createFromConfig(config.getDataSourceConfig(), false);
|
||||
return createFromConfig(config.getDataSourceConfig(), config.readOnlyDatabase(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the "read only" DataSource from configuration.
|
||||
*/
|
||||
private DataSource initReadOnlyDataSource() {
|
||||
DataSourceConfig roConfig = readOnlyConfig();
|
||||
return roConfig == null ? null : createFromConfig(roConfig, true);
|
||||
if (config.readOnlyDatabase()) {
|
||||
// using the same DataSource instance
|
||||
return config.getDataSource();
|
||||
}
|
||||
var roConfig = readOnlyConfig();
|
||||
return roConfig == null ? null : createFromConfig(roConfig, false, true);
|
||||
}
|
||||
|
||||
DataSourceConfig readOnlyConfig() {
|
||||
DataSourceConfig roConfig = config.getReadOnlyDataSourceConfig();
|
||||
DataSourceBuilder.Settings readOnlyConfig() {
|
||||
var roConfig = config.getReadOnlyDataSourceConfig();
|
||||
if (roConfig == null) {
|
||||
// it has explicitly been set to null, not expected but ok
|
||||
return null;
|
||||
@@ -64,11 +65,11 @@ final class InitDataSource {
|
||||
// convenient alternate place to set the read-only url
|
||||
final String readOnlyUrl = config.getDataSourceConfig().getReadOnlyUrl();
|
||||
if (urlSet(readOnlyUrl)) {
|
||||
roConfig.setUrl(readOnlyUrl);
|
||||
roConfig.url(readOnlyUrl);
|
||||
return roConfig;
|
||||
}
|
||||
if (config.isAutoReadOnlyDataSource()) {
|
||||
roConfig.setUrl(null); // blank out in case it is "none"
|
||||
roConfig.url(null); // blank out in case it is "none"
|
||||
return roConfig;
|
||||
} else {
|
||||
return null;
|
||||
@@ -79,25 +80,27 @@ final class InitDataSource {
|
||||
return url != null && !"none".equalsIgnoreCase(url) && !url.trim().isEmpty();
|
||||
}
|
||||
|
||||
private DataSource createFromConfig(DataSourceConfig dsConfig, boolean readOnly) {
|
||||
private DataSource createFromConfig(DataSourceBuilder.Settings dsConfig, boolean readOnlyDB, boolean readOnly) {
|
||||
if (dsConfig == null) {
|
||||
throw new PersistenceException("No DataSourceConfig defined for " + config.getName());
|
||||
throw new PersistenceException("No DataSourceBuilder defined for " + config.getName());
|
||||
}
|
||||
if (dsConfig.isOffline()) {
|
||||
if (config.getDatabasePlatformName() == null) {
|
||||
throw new PersistenceException("You MUST specify a DatabasePlatformName on DatabaseConfig when offline");
|
||||
}
|
||||
if (dsConfig.isOffline() && config.getDatabasePlatformName() == null) {
|
||||
throw new PersistenceException("You MUST specify a DatabasePlatformName on DatabaseConfig when offline");
|
||||
}
|
||||
|
||||
attachAlert(dsConfig);
|
||||
attachListener(dsConfig);
|
||||
|
||||
if (readOnly) {
|
||||
if (readOnlyDB) {
|
||||
dsConfig.autoCommit(true);
|
||||
dsConfig.readOnly(true);
|
||||
} else if (readOnly) {
|
||||
// setup to use AutoCommit such that we skip explicit commit
|
||||
dsConfig.setAutoCommit(true);
|
||||
dsConfig.setReadOnly(true);
|
||||
dsConfig.setDefaults(config.getDataSourceConfig());
|
||||
dsConfig.setIsolationLevel(config.getDataSourceConfig().getIsolationLevel());
|
||||
var mainSettings = config.getDataSourceConfig();
|
||||
dsConfig.autoCommit(true);
|
||||
dsConfig.readOnly(true);
|
||||
dsConfig.setDefaults(mainSettings);
|
||||
dsConfig.isolationLevel(mainSettings.getIsolationLevel());
|
||||
} else if (isPostgresAllQuotedIdentifiers()) {
|
||||
dsConfig.addProperty("quoteReturningIdentifiers", false);
|
||||
}
|
||||
@@ -108,32 +111,32 @@ final class InitDataSource {
|
||||
return config.isAllQuotedIdentifiers() && Platform.POSTGRES == config.getDatabasePlatform().platform().base();
|
||||
}
|
||||
|
||||
private DataSource create(DataSourceConfig dsConfig, boolean readOnly) {
|
||||
private DataSource create(DataSourceBuilder dsConfig, boolean readOnly) {
|
||||
String poolName = config.getName() + (readOnly ? "-ro" : "");
|
||||
return DataSourceFactory.create(poolName, dsConfig);
|
||||
return dsConfig.name(poolName).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach DataSourceAlert via service loader if present.
|
||||
*/
|
||||
private void attachAlert(DataSourceConfig dsConfig) {
|
||||
private void attachAlert(DataSourceBuilder.Settings dsConfig) {
|
||||
DataSourceAlertFactory alertFactory = config.getServiceObject(DataSourceAlertFactory.class);
|
||||
if (alertFactory == null) {
|
||||
alertFactory = ServiceUtil.service(DataSourceAlertFactory.class);
|
||||
}
|
||||
if (alertFactory != null) {
|
||||
dsConfig.setAlert(alertFactory.createAlert());
|
||||
dsConfig.alert(alertFactory.createAlert());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and attach a DataSourcePoolListener if it has been specified via properties and there is not one already attached.
|
||||
*/
|
||||
private void attachListener(DataSourceConfig dsConfig) {
|
||||
private void attachListener(DataSourceBuilder.Settings dsConfig) {
|
||||
if (dsConfig.getListener() == null) {
|
||||
String poolListener = dsConfig.getPoolListener();
|
||||
if (poolListener != null) {
|
||||
dsConfig.setListener((DataSourcePoolListener) config.getClassLoadConfig().newInstance(poolListener));
|
||||
dsConfig.listener((DataSourcePoolListener) config.getClassLoadConfig().newInstance(poolListener));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.ExpressionFactory;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.cache.*;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.ExternalTransactionManager;
|
||||
import io.ebean.config.ProfilingConfig;
|
||||
import io.ebean.config.SlowQueryListener;
|
||||
import io.ebean.config.*;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.DbHistorySupport;
|
||||
import io.ebean.event.changelog.ChangeLogListener;
|
||||
@@ -71,7 +69,7 @@ public final class InternalConfiguration {
|
||||
|
||||
private final TableModState tableModState;
|
||||
private final boolean online;
|
||||
private final DatabaseConfig config;
|
||||
private final DatabaseBuilder.Settings config;
|
||||
private final BootupClasses bootupClasses;
|
||||
private final DatabasePlatform databasePlatform;
|
||||
private final DeployInherit deployInherit;
|
||||
@@ -100,12 +98,12 @@ public final class InternalConfiguration {
|
||||
private boolean localL2Caching;
|
||||
|
||||
InternalConfiguration(boolean online, ClusterManager clusterManager, SpiBackgroundExecutor backgroundExecutor,
|
||||
DatabaseConfig config, BootupClasses bootupClasses) {
|
||||
DatabaseBuilder.Settings config, BootupClasses bootupClasses) {
|
||||
|
||||
this.online = online;
|
||||
this.config = config;
|
||||
this.jacksonCorePresent = config.getClassLoadConfig().isJacksonCorePresent();
|
||||
this.clockService = new ClockService(config.getClock());
|
||||
this.clockService = new ClockService(config.settings().getClock());
|
||||
this.tableModState = new TableModState();
|
||||
this.logManager = initLogManager();
|
||||
this.docStoreFactory = initDocStoreFactory(service(DocStoreFactory.class));
|
||||
@@ -175,7 +173,7 @@ public final class InternalConfiguration {
|
||||
/**
|
||||
* Create and return the ExpressionFactory based on configuration and database platform.
|
||||
*/
|
||||
private ExpressionFactory initExpressionFactory(DatabaseConfig config) {
|
||||
private ExpressionFactory initExpressionFactory(DatabaseBuilder.Settings config) {
|
||||
boolean nativeIlike = config.isExpressionNativeIlike() && databasePlatform.supportsNativeIlike();
|
||||
return new DefaultExpressionFactory(config.isExpressionEqualsWithNullAsNoop(), nativeIlike);
|
||||
}
|
||||
@@ -333,7 +331,7 @@ public final class InternalConfiguration {
|
||||
return config.getDatabasePlatform();
|
||||
}
|
||||
|
||||
public DatabaseConfig getConfig() {
|
||||
public DatabaseBuilder.Settings getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -590,14 +588,16 @@ public final class InternalConfiguration {
|
||||
*/
|
||||
QueryPlanLogger queryPlanLogger(Platform platform) {
|
||||
switch (platform.base()) {
|
||||
case POSTGRES:
|
||||
return new QueryPlanLoggerPostgres();
|
||||
case SQLSERVER:
|
||||
return new QueryPlanLoggerSqlServer();
|
||||
case ORACLE:
|
||||
return new QueryPlanLoggerOracle();
|
||||
case POSTGRES:
|
||||
return new QueryPlanLoggerExplain("explain (analyze, buffers) ");
|
||||
case YUGABYTE:
|
||||
return new QueryPlanLoggerExplain("explain (analyze, buffers, dist) ");
|
||||
default:
|
||||
return new QueryPlanLoggerExplain();
|
||||
return new QueryPlanLoggerExplain("explain ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
private final OrmQueryEngine queryEngine;
|
||||
private final SpiQuery<T> query;
|
||||
private final BeanFindController finder;
|
||||
private final Boolean readOnly;
|
||||
private LoadContext loadContext;
|
||||
private PersistenceContext persistenceContext;
|
||||
private HashQuery cacheKey;
|
||||
@@ -52,7 +51,6 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
this.finder = beanDescriptor.beanFinder();
|
||||
this.queryEngine = queryEngine;
|
||||
this.query = query;
|
||||
this.readOnly = query.isReadOnly();
|
||||
this.persistenceContext = query.persistenceContext();
|
||||
}
|
||||
|
||||
@@ -135,13 +133,6 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
return loadContext.secondaryQueriesMinBatchSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Normal, sharedInstance, ReadOnly state of this query.
|
||||
*/
|
||||
public Boolean isReadOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BeanDescriptor for the associated bean.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.ebean.InsertOptions;
|
||||
import io.ebean.ValuePair;
|
||||
import io.ebean.annotation.DocStoreMode;
|
||||
import io.ebean.bean.EntityBean;
|
||||
@@ -124,6 +125,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
* Many-to-many intersection table changes that are held for later batch processing.
|
||||
*/
|
||||
private List<SaveMany> saveMany;
|
||||
private InsertOptions insertOptions;
|
||||
|
||||
public PersistRequestBean(SpiEbeanServer server, T bean, Object parentBean, BeanManager<T> mgr, SpiTransaction t,
|
||||
PersistExecute persistExecute, PersistRequest.Type type, int flags) {
|
||||
@@ -380,6 +382,14 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
return intercept.dirtyPropertyNames();
|
||||
}
|
||||
|
||||
public boolean isChangedProperty(int propertyIndex) {
|
||||
if (dirtyProperties == null) {
|
||||
return intercept.isChangedProperty(propertyIndex);
|
||||
} else {
|
||||
return dirtyProperties[propertyIndex];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the dirty properties on this request.
|
||||
*/
|
||||
@@ -865,8 +875,8 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
}
|
||||
setNotifyCache();
|
||||
boolean isChangeLog = beanDescriptor.isChangeLog();
|
||||
if (type == Type.UPDATE && (isChangeLog || notifyCache || docStoreMode == DocStoreMode.UPDATE)) {
|
||||
// get the dirty properties for update notification to the doc store
|
||||
if (type == Type.UPDATE) {
|
||||
// get the dirty properties for notify cache & orphanRemoval of vanilla collection detection
|
||||
dirtyProperties = intercept.dirtyProperties();
|
||||
}
|
||||
if (isChangeLog) {
|
||||
@@ -1408,4 +1418,12 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
private void setGeneratedId() {
|
||||
beanDescriptor.setGeneratedId(entityBean, transaction);
|
||||
}
|
||||
|
||||
public void setInsertOptions(InsertOptions insertOptions) {
|
||||
this.insertOptions = insertOptions;
|
||||
}
|
||||
|
||||
public InsertOptions insertOptions() {
|
||||
return insertOptions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
|
||||
import io.ebean.CallableSql;
|
||||
import io.ebean.MergeOptions;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.SqlUpdate;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.Update;
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.*;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
import io.ebeaninternal.api.SpiSqlUpdate;
|
||||
@@ -31,9 +27,9 @@ public interface Persister {
|
||||
void update(EntityBean entityBean, Transaction t);
|
||||
|
||||
/**
|
||||
* Force an Insert using the given bean.
|
||||
* Perform an Insert using the given bean.
|
||||
*/
|
||||
void insert(EntityBean entityBean, Transaction t);
|
||||
void insert(EntityBean entityBean, @Nullable InsertOptions insertOptions, @Nullable Transaction t);
|
||||
|
||||
/**
|
||||
* Insert or update the bean depending on its state.
|
||||
@@ -44,7 +40,6 @@ public interface Persister {
|
||||
* Delete a bean given it's type and id value.
|
||||
* <p>
|
||||
* This will also cascade delete one level of children.
|
||||
* </p>
|
||||
*/
|
||||
int delete(Class<?> beanType, Object id, Transaction transaction, boolean permanent);
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package io.ebeaninternal.server.core.bootup;
|
||||
|
||||
import io.avaje.classpath.scanner.ClassPathScanner;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.ClassPathScanners;
|
||||
|
||||
@@ -24,11 +24,11 @@ public class BootupClassPathSearch {
|
||||
* Search the classPath for the classes we are interested in returning
|
||||
* them as BootupClasses.
|
||||
*/
|
||||
public static BootupClasses search(DatabaseConfig config) {
|
||||
public static BootupClasses search(DatabaseBuilder.Settings config) {
|
||||
return new BootupClassPathSearch(config).getBootupClasses();
|
||||
}
|
||||
|
||||
private BootupClassPathSearch(DatabaseConfig config) {
|
||||
private BootupClassPathSearch(DatabaseBuilder.Settings config) {
|
||||
// find packages defined in ebean.mf resources
|
||||
Set<String> mfPackages = ManifestReader.create(config.getClassLoadConfig().getClassLoader())
|
||||
.read("META-INF/ebean.mf")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebeaninternal.server.core.bootup;
|
||||
|
||||
import io.ebean.annotation.DocStore;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.config.IdGenerator;
|
||||
import io.ebean.config.ScalarTypeConverter;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
@@ -91,7 +91,7 @@ public class BootupClasses implements Predicate<Class<?>> {
|
||||
/**
|
||||
* Run any ServerConfigStartup listeners.
|
||||
*/
|
||||
public void runServerConfigStartup(DatabaseConfig config) {
|
||||
public void runServerConfigStartup(DatabaseBuilder config) {
|
||||
for (Class<?> cls : serverConfigStartupCandidates) {
|
||||
try {
|
||||
ServerConfigStartup newInstance = (ServerConfigStartup) cls.getDeclaredConstructor().newInstance();
|
||||
@@ -172,7 +172,7 @@ public class BootupClasses implements Predicate<Class<?>> {
|
||||
add(startupInstances, serverConfigStartupInstances, serverConfigStartupCandidates);
|
||||
}
|
||||
|
||||
public void addChangeLogInstances(DatabaseConfig config) {
|
||||
public void addChangeLogInstances(DatabaseBuilder.Settings config) {
|
||||
readAuditPrepare = config.getReadAuditPrepare();
|
||||
readAuditLogger = config.getReadAuditLogger();
|
||||
changeLogPrepare = config.getChangeLogPrepare();
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollectionAdd;
|
||||
import io.ebean.bean.BeanCollectionLoader;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.json.SpiJsonWriter;
|
||||
import io.ebeaninternal.server.query.CQueryCollectionAdd;
|
||||
|
||||
@@ -34,7 +31,7 @@ public interface BeanCollectionHelp<T> extends CQueryCollectionAdd<T> {
|
||||
* For Map's this needs to take the mapKey.
|
||||
* </p>
|
||||
*/
|
||||
BeanCollectionAdd getBeanCollectionAdd(Object bc, String mapKey);
|
||||
BeanCollectionAdd collectionAdd(Object bc, String mapKey);
|
||||
|
||||
/**
|
||||
* Create an empty collection of the correct type without a parent bean.
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.ebean.*;
|
||||
import io.ebean.annotation.DocStoreMode;
|
||||
import io.ebean.bean.*;
|
||||
import io.ebean.cache.QueryCacheEntry;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.config.EncryptKey;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
import io.ebean.config.dbplatform.PlatformIdGenerator;
|
||||
@@ -237,7 +237,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
this.owner = owner;
|
||||
this.multiValueSupported = owner.isMultiValueSupported();
|
||||
this.entityType = deploy.getEntityType();
|
||||
this.properties = deploy.getProperties();
|
||||
this.properties = deploy.propertyNames();
|
||||
this.name = InternString.intern(deploy.getName());
|
||||
this.baseTableAlias = "t0";
|
||||
this.fullName = InternString.intern(deploy.getFullName());
|
||||
@@ -278,7 +278,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
this.partitionMeta = deploy.getPartitionMeta();
|
||||
this.tablespaceMeta = deploy.getTablespaceMeta();
|
||||
this.storageEngine = deploy.getStorageEngine();
|
||||
this.autoTunable = beanFinder == null && (entityType == EntityType.ORM || entityType == EntityType.VIEW);
|
||||
this.autoTunable = entityType == EntityType.ORM || entityType == EntityType.VIEW;
|
||||
// helper object used to derive lists of properties
|
||||
DeployBeanPropertyLists listHelper = new DeployBeanPropertyLists(owner, this, deploy);
|
||||
this.softDeleteProperty = listHelper.getSoftDeleteProperty();
|
||||
@@ -423,7 +423,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the DatabaseConfig.
|
||||
*/
|
||||
public DatabaseConfig config() {
|
||||
public DatabaseBuilder.Settings config() {
|
||||
return owner.config();
|
||||
}
|
||||
|
||||
|
||||
+18
-19
@@ -1,6 +1,7 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.BackgroundExecutor;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.Model;
|
||||
import io.ebean.RawSqlBuilder;
|
||||
import io.ebean.annotation.ConstraintMode;
|
||||
@@ -78,7 +79,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
private final NamingConvention namingConvention;
|
||||
private final DeployCreateProperties createProperties;
|
||||
private final BeanManagerFactory beanManagerFactory;
|
||||
private final DatabaseConfig config;
|
||||
private final DatabaseBuilder.Settings config;
|
||||
private final ChangeLogListener changeLogListener;
|
||||
private final ChangeLogRegister changeLogRegister;
|
||||
private final ChangeLogPrepare changeLogPrepare;
|
||||
@@ -195,19 +196,19 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
/**
|
||||
* Return the AsOfViewSuffix based on the DbHistorySupport.
|
||||
*/
|
||||
private String asOfViewSuffix(DatabasePlatform databasePlatform, DatabaseConfig serverConfig) {
|
||||
private String asOfViewSuffix(DatabasePlatform databasePlatform, DatabaseBuilder.Settings config) {
|
||||
DbHistorySupport historySupport = databasePlatform.historySupport();
|
||||
// with historySupport returns a simple view suffix or the sql2011 as of timestamp suffix
|
||||
return (historySupport == null) ? serverConfig.getAsOfViewSuffix() : historySupport.getAsOfViewSuffix(serverConfig.getAsOfViewSuffix());
|
||||
return (historySupport == null) ? config.getAsOfViewSuffix() : historySupport.getAsOfViewSuffix(config.getAsOfViewSuffix());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the versions between timestamp suffix based on the DbHistorySupport.
|
||||
*/
|
||||
private String versionsBetweenSuffix(DatabasePlatform databasePlatform, DatabaseConfig serverConfig) {
|
||||
private String versionsBetweenSuffix(DatabasePlatform databasePlatform, DatabaseBuilder.Settings config) {
|
||||
DbHistorySupport historySupport = databasePlatform.historySupport();
|
||||
// with historySupport returns a simple view suffix or the sql2011 versions between timestamp suffix
|
||||
return (historySupport == null) ? serverConfig.getAsOfViewSuffix() : historySupport.getVersionsBetweenSuffix(serverConfig.getAsOfViewSuffix());
|
||||
return (historySupport == null) ? config.getAsOfViewSuffix() : historySupport.getVersionsBetweenSuffix(config.getAsOfViewSuffix());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -216,7 +217,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseConfig config() {
|
||||
public DatabaseBuilder.Settings config() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -443,11 +444,10 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
// build map of tables to view entities dependent on those tables
|
||||
// for the purpose of invalidating appropriate query caches
|
||||
String[] dependentTables = desc.dependentTables();
|
||||
if (dependentTables != null && dependentTables.length > 0) {
|
||||
if (dependentTables != null) {
|
||||
for (String depTable : dependentTables) {
|
||||
depTable = depTable.toLowerCase();
|
||||
List<BeanDescriptor<?>> list = tableToViewDescMap.computeIfAbsent(depTable, k -> new ArrayList<>(1));
|
||||
list.add(desc);
|
||||
tableToViewDescMap.computeIfAbsent(depTable, k -> new ArrayList<>(1)).add(desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -578,7 +578,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
}
|
||||
}
|
||||
|
||||
private <T> String errNothingRegistered() {
|
||||
private String errNothingRegistered() {
|
||||
return "There are no registered entities. If using query beans, that generates EbeanEntityRegister.java into " +
|
||||
"generated sources and is service loaded. If using module-info.java, then probably missing 'provides io.ebean.config.EntityClassRegister with EbeanEntityRegister' clause.";
|
||||
}
|
||||
@@ -1186,7 +1186,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
setConcurrencyMode(desc);
|
||||
}
|
||||
// generate the byte code
|
||||
createByteCode(desc);
|
||||
setAccessors(desc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1255,13 +1255,13 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
return databasePlatform.createSequenceIdGenerator(backgroundExecutor, dataSource, stepSize, seqName);
|
||||
}
|
||||
|
||||
private void createByteCode(DeployBeanDescriptor<?> deploy) {
|
||||
private void setAccessors(DeployBeanDescriptor<?> deploy) {
|
||||
// check to see if the bean supports EntityBean interface
|
||||
// generate a subclass if required
|
||||
setEntityBeanClass(deploy);
|
||||
confirmEnhanced(deploy);
|
||||
// use Code generation or Standard reflection to support
|
||||
// getter and setter methods
|
||||
setBeanReflect(deploy);
|
||||
setPropertyAccessors(deploy);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1288,15 +1288,14 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
* and getting of properties. It is generally faster to use code generation
|
||||
* rather than reflection to do this.
|
||||
*/
|
||||
private void setBeanReflect(DeployBeanDescriptor<?> desc) {
|
||||
private void setPropertyAccessors(DeployBeanDescriptor<?> desc) {
|
||||
// Set the BeanReflectGetter and BeanReflectSetter that typically
|
||||
// use generated code. NB: Due to Bug 166 so now doing this for
|
||||
// abstract classes as well.
|
||||
BeanPropertiesReader reflectProps = new BeanPropertiesReader(desc.getBeanType());
|
||||
desc.setProperties(reflectProps.getProperties());
|
||||
BeanPropertiesReader reflectProps = new BeanPropertiesReader(desc.propertyNames());
|
||||
for (DeployBeanProperty prop : desc.propertiesAll()) {
|
||||
String propName = prop.getName();
|
||||
Integer pos = reflectProps.getPropertyIndex(propName);
|
||||
Integer pos = reflectProps.propertyIndex(propName);
|
||||
if (pos == null) {
|
||||
if (isPersistentField(prop)) {
|
||||
throw new IllegalStateException(
|
||||
@@ -1368,7 +1367,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
/**
|
||||
* Test the bean type to see if it implements EntityBean interface already.
|
||||
*/
|
||||
private void setEntityBeanClass(DeployBeanDescriptor<?> desc) {
|
||||
private void confirmEnhanced(DeployBeanDescriptor<?> desc) {
|
||||
Class<?> beanClass = desc.getBeanType();
|
||||
if (!hasEntityBeanInterface(beanClass)) {
|
||||
String msg = "Bean " + beanClass + " is not enhanced? Check packages specified in ebean.mf. If you are running in IDEA or " +
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.config.EncryptKey;
|
||||
import io.ebean.config.NamingConvention;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
@@ -25,7 +25,7 @@ public interface BeanDescriptorMap {
|
||||
/**
|
||||
* Return the DatabaseConfig.
|
||||
*/
|
||||
DatabaseConfig config();
|
||||
DatabaseBuilder.Settings config();
|
||||
|
||||
/**
|
||||
* Return the Cache Manager.
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.annotation.PostSoftDelete;
|
||||
import io.ebean.annotation.PreSoftDelete;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.event.BeanPersistAdapter;
|
||||
import io.ebean.event.BeanPersistRequest;
|
||||
import io.ebean.event.BeanPostConstructListener;
|
||||
@@ -34,7 +34,7 @@ final class BeanLifecycleAdapterFactory {
|
||||
|
||||
private final boolean postConstructPresent;
|
||||
|
||||
BeanLifecycleAdapterFactory(DatabaseConfig config) {
|
||||
BeanLifecycleAdapterFactory(DatabaseBuilder.Settings config) {
|
||||
this.postConstructPresent = config.getClassLoadConfig().isJavaxPostConstructPresent();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollectionAdd;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.common.BeanList;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.json.SpiJsonWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,19 +19,11 @@ public class BeanListHelp<T> extends BaseCollectionHelp<T> {
|
||||
super(many);
|
||||
}
|
||||
|
||||
BeanListHelp() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BeanCollectionAdd getBeanCollectionAdd(Object bc, String mapKey) {
|
||||
public final BeanCollectionAdd collectionAdd(Object bc, String mapKey) {
|
||||
if (bc instanceof BeanList<?>) {
|
||||
BeanList<?> bl = (BeanList<?>) bc;
|
||||
if (bl.actualList() == null) {
|
||||
bl.setActualList(new ArrayList<>());
|
||||
}
|
||||
return bl;
|
||||
|
||||
return bl.collectionAdd();
|
||||
} else {
|
||||
throw new RuntimeException("Unhandled type " + bc);
|
||||
}
|
||||
@@ -67,20 +55,20 @@ public class BeanListHelp<T> extends BaseCollectionHelp<T> {
|
||||
return beanList;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public final void refresh(BeanCollection<?> bc, EntityBean parentBean) {
|
||||
BeanList<?> newBeanList = (BeanList<?>) bc;
|
||||
BeanList<T> newBeanList = (BeanList<T>) bc;
|
||||
List<?> currentList = (List<?>) many.getValue(parentBean);
|
||||
newBeanList.setModifyListening(many.modifyListenMode());
|
||||
if (currentList == null) {
|
||||
// the currentList is null? Not really expecting this...
|
||||
many.setValue(parentBean, newBeanList);
|
||||
|
||||
} else if (currentList instanceof BeanList<?>) {
|
||||
} else if (currentList instanceof BeanList) {
|
||||
// normally this case, replace just the underlying list
|
||||
BeanList<?> currentBeanList = (BeanList<?>) currentList;
|
||||
currentBeanList.setActualList(newBeanList.actualList());
|
||||
currentBeanList.setModifyListening(many.modifyListenMode());
|
||||
BeanList<T> currentBeanList = (BeanList<T>) currentList;
|
||||
currentBeanList.refresh(many.modifyListenMode(), newBeanList);
|
||||
|
||||
} else {
|
||||
// replace the entire list with the BeanList
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollectionAdd;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.common.BeanMap;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.json.SpiJsonWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@@ -37,20 +33,14 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public final BeanCollectionAdd getBeanCollectionAdd(Object bc, String mapKey) {
|
||||
public final BeanCollectionAdd collectionAdd(Object bc, String mapKey) {
|
||||
if (mapKey == null) {
|
||||
mapKey = many.mapKey();
|
||||
}
|
||||
BeanProperty beanProp = targetDescriptor.beanProperty(mapKey);
|
||||
if (bc instanceof BeanMap<?, ?>) {
|
||||
BeanMap<Object, Object> bm = (BeanMap<Object, Object>) bc;
|
||||
Map<Object, Object> actualMap = bm.actualMap();
|
||||
if (actualMap == null) {
|
||||
actualMap = new LinkedHashMap<>();
|
||||
bm.setActualMap(actualMap);
|
||||
}
|
||||
return new Adder(beanProp, actualMap);
|
||||
|
||||
return new Adder(beanProp, bm.collectionAdd());
|
||||
} else {
|
||||
throw new RuntimeException("Unhandled type " + bc);
|
||||
}
|
||||
@@ -126,8 +116,7 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
} else if (current instanceof BeanMap<?, ?>) {
|
||||
// normally this case, replace just the underlying list
|
||||
BeanMap<?, ?> currentBeanMap = (BeanMap<?, ?>) current;
|
||||
currentBeanMap.setActualMap(newBeanMap.actualMap());
|
||||
currentBeanMap.setModifyListening(many.modifyListenMode());
|
||||
currentBeanMap.refresh(many.modifyListenMode(), newBeanMap);
|
||||
|
||||
} else {
|
||||
// replace the entire set
|
||||
|
||||
@@ -655,7 +655,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
|
||||
private BeanCollectionAdd beanCollectionAdd(Object bc) {
|
||||
return help.getBeanCollectionAdd(bc, null);
|
||||
return help.collectionAdd(bc, null);
|
||||
}
|
||||
|
||||
public Object parentId(EntityBean parentBean) {
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollectionAdd;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.common.BeanSet;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.api.json.SpiJsonWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -26,21 +22,11 @@ public class BeanSetHelp<T> extends BaseCollectionHelp<T> {
|
||||
super(many);
|
||||
}
|
||||
|
||||
/**
|
||||
* For a query that returns a set.
|
||||
*/
|
||||
BeanSetHelp() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BeanCollectionAdd getBeanCollectionAdd(Object bc, String mapKey) {
|
||||
public final BeanCollectionAdd collectionAdd(Object bc, String mapKey) {
|
||||
if (bc instanceof BeanSet<?>) {
|
||||
BeanSet<?> beanSet = (BeanSet<?>) bc;
|
||||
if (beanSet.actualSet() == null) {
|
||||
beanSet.setActualSet(new LinkedHashSet<>());
|
||||
}
|
||||
return beanSet;
|
||||
return beanSet.collectionAdd();
|
||||
} else {
|
||||
throw new RuntimeException("Unhandled type " + bc);
|
||||
}
|
||||
@@ -72,9 +58,10 @@ public class BeanSetHelp<T> extends BaseCollectionHelp<T> {
|
||||
return beanSet;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public final void refresh(BeanCollection<?> bc, EntityBean parentBean) {
|
||||
BeanSet<?> newBeanSet = (BeanSet<?>) bc;
|
||||
BeanSet<T> newBeanSet = (BeanSet<T>) bc;
|
||||
Set<?> current = (Set<?>) many.getValue(parentBean);
|
||||
newBeanSet.setModifyListening(many.modifyListenMode());
|
||||
if (current == null) {
|
||||
@@ -83,9 +70,8 @@ public class BeanSetHelp<T> extends BaseCollectionHelp<T> {
|
||||
|
||||
} else if (current instanceof BeanSet<?>) {
|
||||
// normally this case, replace just the underlying list
|
||||
BeanSet<?> currentBeanSet = (BeanSet<?>) current;
|
||||
currentBeanSet.setActualSet(newBeanSet.actualSet());
|
||||
currentBeanSet.setModifyListening(many.modifyListenMode());
|
||||
BeanSet<T> currentBeanSet = (BeanSet<T>) current;
|
||||
currentBeanSet.refresh(many.modifyListenMode(), newBeanSet);
|
||||
|
||||
} else {
|
||||
// replace the entire set
|
||||
|
||||
@@ -148,4 +148,10 @@ public interface DbSqlContext {
|
||||
* Add extra joins *IF* required to support inheritance discriminator in projection.
|
||||
*/
|
||||
void flushExtraJoins();
|
||||
|
||||
/**
|
||||
* Return true if the last join was added and false means the join was suppressed
|
||||
* as it was already added to the query.
|
||||
*/
|
||||
boolean joinAdded();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.common.BeanMap;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
final class ElementHelpMap implements ElementHelp {
|
||||
|
||||
@@ -15,7 +14,7 @@ final class ElementHelpMap implements ElementHelp {
|
||||
|
||||
private static class Collector implements ElementCollector {
|
||||
|
||||
private final Map<Object, Object> map = new LinkedHashMap<>();
|
||||
private final LinkedHashMap<Object, Object> map = new LinkedHashMap<>();
|
||||
|
||||
@Override
|
||||
public void addElement(Object element) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.common.BeanSet;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
final class ElementHelpSet implements ElementHelp {
|
||||
|
||||
@@ -15,7 +14,7 @@ final class ElementHelpSet implements ElementHelp {
|
||||
|
||||
private static class Collector implements ElementCollector {
|
||||
|
||||
private final Set<Object> set = new LinkedHashSet<>();
|
||||
private final LinkedHashSet<Object> set = new LinkedHashSet<>();
|
||||
|
||||
@Override
|
||||
public void addElement(Object element) {
|
||||
|
||||
+3
-5
@@ -1,10 +1,8 @@
|
||||
package io.ebeaninternal.server.deploy.generatedproperty;
|
||||
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.config.ClassLoadConfig;
|
||||
import io.ebean.config.CurrentUserProvider;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.IdGenerator;
|
||||
import io.ebean.config.*;
|
||||
import io.ebean.config.dbplatform.PlatformIdGenerator;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanProperty;
|
||||
|
||||
@@ -29,7 +27,7 @@ public final class GeneratedPropertyFactory {
|
||||
private final ClassLoadConfig classLoadConfig;
|
||||
private final Map<String, PlatformIdGenerator> idGeneratorMap = new HashMap<>();
|
||||
|
||||
public GeneratedPropertyFactory(boolean offlineMode, DatabaseConfig config, List<IdGenerator> idGenerators) {
|
||||
public GeneratedPropertyFactory(boolean offlineMode, DatabaseBuilder.Settings config, List<IdGenerator> idGenerators) {
|
||||
this.classLoadConfig = config.getClassLoadConfig();
|
||||
this.insertFactory = new InsertTimestampFactory(classLoadConfig);
|
||||
this.updateFactory = new UpdateTimestampFactory(classLoadConfig);
|
||||
|
||||
+26
-28
@@ -4,7 +4,7 @@ import io.ebean.annotation.Cache;
|
||||
import io.ebean.annotation.DocStore;
|
||||
import io.ebean.annotation.DocStoreMode;
|
||||
import io.ebean.annotation.Identity;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.config.TableName;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
import io.ebean.config.dbplatform.PlatformIdGenerator;
|
||||
@@ -24,6 +24,8 @@ import io.ebeaninternal.server.rawsql.SpiRawSql;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -45,9 +47,7 @@ public class DeployBeanDescriptor<T> {
|
||||
|
||||
private static final PropOrder PROP_ORDER = new PropOrder();
|
||||
|
||||
private static final String I_SCALAOBJECT = "scala.ScalaObject";
|
||||
|
||||
private final DatabaseConfig config;
|
||||
private final DatabaseBuilder.Settings config;
|
||||
private final BeanDescriptorManager manager;
|
||||
/**
|
||||
* Map of BeanProperty Linked so as to preserve order.
|
||||
@@ -133,16 +133,36 @@ public class DeployBeanDescriptor<T> {
|
||||
/**
|
||||
* Construct the BeanDescriptor.
|
||||
*/
|
||||
public DeployBeanDescriptor(BeanDescriptorManager manager, Class<T> beanType, DatabaseConfig config) {
|
||||
public DeployBeanDescriptor(BeanDescriptorManager manager, Class<T> beanType, DatabaseBuilder.Settings config) {
|
||||
this.manager = manager;
|
||||
this.config = config;
|
||||
this.beanType = beanType;
|
||||
}
|
||||
|
||||
private String[] readPropertyNames() {
|
||||
try {
|
||||
Field field = beanType.getField("_ebean_props");
|
||||
return (String[]) field.get(null);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Error getting _ebean_props field on type " + beanType, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPropertyNames(String[] properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public String[] propertyNames() {
|
||||
if (properties == null) {
|
||||
properties = readPropertyNames();
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the IdClass to use.
|
||||
*/
|
||||
public void setIdClass(Class idClass) {
|
||||
public void setIdClass(Class<?> idClass) {
|
||||
this.idClass = idClass;
|
||||
}
|
||||
|
||||
@@ -260,7 +280,6 @@ public class DeployBeanDescriptor<T> {
|
||||
* Read the top level doc store deployment information.
|
||||
*/
|
||||
public void readDocStore(DocStore docStore) {
|
||||
|
||||
this.docStore = docStore;
|
||||
docStoreMapped = true;
|
||||
docStoreQueueId = docStore.queueId();
|
||||
@@ -276,23 +295,10 @@ public class DeployBeanDescriptor<T> {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isScalaObject() {
|
||||
Class<?>[] interfaces = beanType.getInterfaces();
|
||||
for (Class<?> anInterface : interfaces) {
|
||||
String iname = anInterface.getName();
|
||||
if (I_SCALAOBJECT.equals(iname)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public DeployBeanTable createDeployBeanTable() {
|
||||
|
||||
DeployBeanTable beanTable = new DeployBeanTable(getBeanType());
|
||||
beanTable.setBaseTable(baseTable);
|
||||
beanTable.setIdProperty(idProperty());
|
||||
|
||||
return beanTable;
|
||||
}
|
||||
|
||||
@@ -360,14 +366,6 @@ public class DeployBeanDescriptor<T> {
|
||||
this.identityMode.setIdType(type);
|
||||
}
|
||||
|
||||
public String[] getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(String[] props) {
|
||||
this.properties = props;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class type this BeanDescriptor describes.
|
||||
*/
|
||||
|
||||
+2
-2
@@ -213,9 +213,9 @@ final class AnnotationAssocManys extends AnnotationAssoc {
|
||||
|
||||
int sortOrder = 0;
|
||||
if (!prop.getManyType().isMap()) {
|
||||
elementDescriptor.setProperties(new String[]{"value"});
|
||||
elementDescriptor.setPropertyNames(new String[]{"value"});
|
||||
} else {
|
||||
elementDescriptor.setProperties(new String[]{"key", "value"});
|
||||
elementDescriptor.setPropertyNames(new String[]{"key", "value"});
|
||||
String dbKeyColumn = "mkey";
|
||||
MapKeyColumn mapKeyColumn = get(prop, MapKeyColumn.class);
|
||||
if (mapKeyColumn != null) {
|
||||
|
||||
@@ -99,6 +99,10 @@ final class AnnotationFields extends AnnotationParser {
|
||||
if (formula != null) {
|
||||
prop.setSqlFormula(processFormula(formula.select()), processFormula(formula.join()));
|
||||
}
|
||||
DbComment comment = get(prop, DbComment.class);
|
||||
if (comment != null) {
|
||||
prop.setDbComment(comment.value());
|
||||
}
|
||||
initWhoProperties(prop);
|
||||
initDbMigration(prop);
|
||||
}
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ public final class DeployCreateProperties {
|
||||
return new DeployBeanProperty(desc, propertyType, field.getGenericType());
|
||||
}
|
||||
// check for Collection type (list, set or map)
|
||||
ManyType manyType = determineManyType.getManyType(propertyType);
|
||||
ManyType manyType = determineManyType.manyType(propertyType);
|
||||
if (manyType != null) {
|
||||
// List, Set or Map based object
|
||||
Class<?> targetType = determineTargetType(field);
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
package io.ebeaninternal.server.deploy.parse;
|
||||
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebean.annotation.*;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.EncryptDeploy;
|
||||
import io.ebean.config.EncryptDeployManager;
|
||||
import io.ebean.config.EncryptKeyManager;
|
||||
import io.ebean.config.Encryptor;
|
||||
import io.ebean.config.NamingConvention;
|
||||
import io.ebean.config.TableName;
|
||||
import io.ebean.config.*;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
import io.ebean.config.dbplatform.DbPlatformType;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
@@ -49,7 +44,7 @@ public final class DeployUtil {
|
||||
private final Encryptor bytesEncryptor;
|
||||
private final boolean useValidationNotNull;
|
||||
|
||||
public DeployUtil(TypeManager typeMgr, DatabaseConfig config) {
|
||||
public DeployUtil(TypeManager typeMgr, DatabaseBuilder.Settings config) {
|
||||
this.typeManager = typeMgr;
|
||||
this.namingConvention = config.getNamingConvention();
|
||||
this.dbPlatform = config.getDatabasePlatform();
|
||||
|
||||
+3
-3
@@ -11,14 +11,14 @@ import java.util.Set;
|
||||
*/
|
||||
final class DetermineManyType {
|
||||
|
||||
ManyType getManyType(Class<?> type) {
|
||||
ManyType manyType(Class<?> type) {
|
||||
if (type.equals(List.class)) {
|
||||
return ManyType.LIST;
|
||||
}
|
||||
if (type.equals(Set.class)) {
|
||||
if (type.equals(Set.class) || type.getCanonicalName().equals("java.util.SequencedSet")) {
|
||||
return ManyType.SET;
|
||||
}
|
||||
if (type.equals(Map.class)) {
|
||||
if (type.equals(Map.class) || type.getCanonicalName().equals("java.util.SequencedMap")) {
|
||||
return ManyType.MAP;
|
||||
}
|
||||
return null;
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import io.ebean.annotation.Aggregation;
|
||||
import io.ebean.annotation.Formula;
|
||||
import io.ebean.annotation.Where;
|
||||
import io.ebean.config.ClassLoadConfig;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedPropertyFactory;
|
||||
import io.ebeaninternal.server.deploy.meta.DeployBeanProperty;
|
||||
|
||||
@@ -31,7 +31,7 @@ final class ReadAnnotationConfig {
|
||||
private final ReadValidationAnnotations jakartaValidation;
|
||||
private final Set<Class<?>> metaAnnotations = new HashSet<>();
|
||||
|
||||
ReadAnnotationConfig(GeneratedPropertyFactory generatedPropFactory, String asOfViewSuffix, String versionsBetweenSuffix, DatabaseConfig config) {
|
||||
ReadAnnotationConfig(GeneratedPropertyFactory generatedPropFactory, String asOfViewSuffix, String versionsBetweenSuffix, DatabaseBuilder.Settings config) {
|
||||
this.generatedPropFactory = generatedPropFactory;
|
||||
this.asOfViewSuffix = asOfViewSuffix;
|
||||
this.versionsBetweenSuffix = versionsBetweenSuffix;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.server.deploy.parse;
|
||||
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.DatabaseBuilder;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptorManager;
|
||||
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedPropertyFactory;
|
||||
|
||||
@@ -12,7 +12,7 @@ public final class ReadAnnotations {
|
||||
|
||||
private final ReadAnnotationConfig readConfig;
|
||||
|
||||
public ReadAnnotations(GeneratedPropertyFactory generatedPropFactory, String asOfViewSuffix, String versionsBetweenSuffix, DatabaseConfig config) {
|
||||
public ReadAnnotations(GeneratedPropertyFactory generatedPropFactory, String asOfViewSuffix, String versionsBetweenSuffix, DatabaseBuilder.Settings config) {
|
||||
this.readConfig = new ReadAnnotationConfig(generatedPropFactory, asOfViewSuffix, versionsBetweenSuffix, config);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ final class BetweenPropertyExpression extends NonPrepareExpression {
|
||||
|
||||
@Override
|
||||
public void addSql(SpiExpressionRequest request) {
|
||||
request.append(" ?").append(BETWEEN).property(name(lowProperty)).append(" and ").property(name(highProperty));
|
||||
request.append("?").append(BETWEEN).property(name(lowProperty)).append(" and ").property(name(highProperty));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
// Generated from /home/rob/github/ebean-dir/ebean/src/test/resources/EQL.g4 by ANTLR 4.8
|
||||
// Generated from /Users/robinbygrave/Documents/github/ebean/ebean/ebean-test/src/test/resources/EQL.g4 by ANTLR 4.13.1
|
||||
package io.ebeaninternal.server.grammer.antlr;
|
||||
|
||||
import org.antlr.v4.runtime.ParserRuleContext;
|
||||
@@ -10,6 +10,7 @@ import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
* which can be extended to create a listener which only needs to handle a subset
|
||||
* of the available methods.
|
||||
*/
|
||||
@SuppressWarnings("CheckReturnValue")
|
||||
public class EQLBaseListener implements EQLListener {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user