mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c21a76fa5b | ||
|
|
a2690fdccd | ||
|
|
4039c20462 | ||
|
|
6d43028fba | ||
|
|
efcee7e739 | ||
|
|
523fe6ae54 | ||
|
|
8ec031bfde | ||
|
|
cd938fd659 | ||
|
|
837e296451 | ||
|
|
52b0bd7b7d | ||
|
|
a8cad4f3d9 | ||
|
|
e4cb81cbba | ||
|
|
08cd0aa4b7 | ||
|
|
b565a5843e | ||
|
|
79c96c9ec1 | ||
|
|
b703b683d8 | ||
|
|
456eb3aca9 | ||
|
|
54c35300d4 | ||
|
|
dfc5963e35 | ||
|
|
36777d5a3d | ||
|
|
12b028fc43 | ||
|
|
72b2f30f2d | ||
|
|
1de74ac366 | ||
|
|
07cb243db3 | ||
|
|
9a02618b67 | ||
|
|
801cb6fa73 | ||
|
|
1c8a416de0 | ||
|
|
c30a8c79a2 | ||
|
|
35cb4356c5 | ||
|
|
a73c985315 | ||
|
|
b5fbfbf1b6 | ||
|
|
4471607b2d | ||
|
|
e4c4b0b43d | ||
|
|
d7ffc4bbb5 | ||
|
|
0bb2f104a4 | ||
|
|
ac3ca8113d | ||
|
|
4ec46e3008 | ||
|
|
e9ab0f34f3 | ||
|
|
8c47ba89d1 | ||
|
|
a9575048b4 | ||
|
|
82fd6dc65f | ||
|
|
5b4ff2627c | ||
|
|
2aa92d63fd | ||
|
|
658b5b7e06 | ||
|
|
4e3cd83e36 | ||
|
|
1af3d0bcf3 | ||
|
|
01a0cee3c2 | ||
|
|
f26feec3d9 | ||
|
|
6055a33dc8 | ||
|
|
230d18e48f | ||
|
|
e00e490e73 | ||
|
|
dd95081e63 | ||
|
|
03bd31677a | ||
|
|
4619c56b09 | ||
|
|
c3dc57f0fb | ||
|
|
50ba20289b | ||
|
|
6b73072982 | ||
|
|
6e340bd149 | ||
|
|
65f551650f | ||
|
|
3be3741db6 | ||
|
|
610afd3717 | ||
|
|
4084822d2c | ||
|
|
a2c82263ee | ||
|
|
30f3d542b3 | ||
|
|
56cb2c69aa | ||
|
|
bd1dd43cbf | ||
|
|
5caae29df9 | ||
|
|
9713b607b5 | ||
|
|
0e46558cae | ||
|
|
2386f1034b | ||
|
|
ddf9f5c508 | ||
|
|
559867294f | ||
|
|
bf0c8d8dab | ||
|
|
7077e92cb0 | ||
|
|
035c5570c3 | ||
|
|
0be0fd1e05 | ||
|
|
bdfd380687 | ||
|
|
d1a4c73cd6 | ||
|
|
7133c81fc5 | ||
|
|
c6b4de39e8 | ||
|
|
94f367af70 | ||
|
|
dc6c393300 | ||
|
|
239f3a0a54 | ||
|
|
d3e78ab54e | ||
|
|
c6483535bd | ||
|
|
95bb2a5d56 | ||
|
|
23649ed840 | ||
|
|
3ee4034a76 | ||
|
|
21d377546e | ||
|
|
8c9dccc6a3 | ||
|
|
6fdf681993 | ||
|
|
7e8f413578 | ||
|
|
6705e5a962 | ||
|
|
d9126a936d | ||
|
|
4ee024b1ce | ||
|
|
19491d5ae6 | ||
|
|
db816594c5 | ||
|
|
fa73b7791f | ||
|
|
c61da5b0e5 | ||
|
|
49d724ad65 | ||
|
|
3ee2410a79 | ||
|
|
c2ddc70565 | ||
|
|
2f66e07c25 | ||
|
|
0807569ee2 | ||
|
|
206dec1bf8 | ||
|
|
0e852f5bb5 | ||
|
|
a272fb4e02 | ||
|
|
cbdc6e09aa | ||
|
|
211087f636 | ||
|
|
dca824b431 | ||
|
|
6bcc8eb0f2 | ||
|
|
844df4d5c9 | ||
|
|
6360d5fe1c | ||
|
|
e57a074b68 | ||
|
|
052632239e | ||
|
|
16aa4caceb | ||
|
|
83d84f6079 | ||
|
|
23c278d878 | ||
|
|
7074b0de71 | ||
|
|
2a9b025e88 | ||
|
|
16b3a0b1c1 | ||
|
|
e0c4f73600 | ||
|
|
6eb1947a6e | ||
|
|
2f793c29dc | ||
|
|
326fc221bf | ||
|
|
d49018363c | ||
|
|
2a2a0ad1f4 | ||
|
|
463b03ef7c | ||
|
|
80d39775ba | ||
|
|
92cdd25ca9 | ||
|
|
53680ba53b | ||
|
|
aa85c5fa3b | ||
|
|
a1ce6f8a81 | ||
|
|
7480904792 | ||
|
|
b12cfafc21 | ||
|
|
f07727651e | ||
|
|
6090eaa167 | ||
|
|
40eada4e80 | ||
|
|
2d375b3596 | ||
|
|
d864e2c723 | ||
|
|
e50c372562 | ||
|
|
e2cb033119 | ||
|
|
9620c57f19 | ||
|
|
07cc0fcbb6 | ||
|
|
6d1beb5c03 | ||
|
|
1667107422 | ||
|
|
de5cf1df2c | ||
|
|
a83114ced2 | ||
|
|
d6983422bf | ||
|
|
6d4b3ad84e | ||
|
|
a3df7919b5 | ||
|
|
6f1aa39cc9 | ||
|
|
f18c24c1d1 | ||
|
|
068401c29c | ||
|
|
6fbbd8b107 | ||
|
|
6379bd9e5d | ||
|
|
94d58dfa7c | ||
|
|
035fb80959 | ||
|
|
3b97f77083 | ||
|
|
a7d47202e6 | ||
|
|
199a9d3118 | ||
|
|
5df3ac4b04 | ||
|
|
782f77b688 | ||
|
|
1d570a233e | ||
|
|
4a6b58bd9b | ||
|
|
d64073bef0 | ||
|
|
6d8a9236f8 | ||
|
|
1665b4f2fa |
@@ -17,14 +17,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'zulu'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'zulu'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: oracle-actions/setup-java@v1
|
||||
with:
|
||||
website: jdk.java.net
|
||||
release: ${{ matrix.java_version }}
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -17,14 +17,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'zulu'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'zulu'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -17,14 +17,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -20,14 +20,14 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: ${{ matrix.java_version }}
|
||||
distribution: 'adopt'
|
||||
- name: Maven cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: maven-cache
|
||||
with:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-clickhouse</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-clickhouse</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-cockroach</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-db2</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-db2</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-h2</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-hana</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-hana</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-mariadb</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mariadb</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-mysql</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mysql</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-nuodb</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-nuodb</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-oracle</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-oracle</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-postgres</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-sqlite</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlite</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-sqlserver</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-yugabyte</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean (all platforms)</name>
|
||||
@@ -16,31 +16,31 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-joda-time</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-jsonnode</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-mapper</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -53,13 +53,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>composites</artifactId>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
|
||||
@@ -690,7 +690,7 @@ public final class InterceptReadWrite implements EntityBeanIntercept {
|
||||
if (beanLoader == null) {
|
||||
final Database database = DB.byName(ebeanServerName);
|
||||
if (database == null) {
|
||||
throw new PersistenceException("Database [" + ebeanServerName + "] was not found?");
|
||||
throw new PersistenceException(ebeanServerName == null ? "No registered default server" : "Database [" + ebeanServerName + "] is not registered");
|
||||
}
|
||||
// For stand alone reference bean or after deserialisation lazy load
|
||||
// using the ebeanServer. Synchronise only on the bean.
|
||||
|
||||
@@ -123,10 +123,10 @@ public class DatabaseConfig {
|
||||
private boolean loadModuleInfo = true;
|
||||
|
||||
/**
|
||||
* List of interesting classes such as entities, embedded, ScalarTypes,
|
||||
* Listeners, Finders, Controllers etc.
|
||||
* Interesting classes such as entities, embedded, ScalarTypes,
|
||||
* Listeners, Finders, Controllers, AttributeConverters etc.
|
||||
*/
|
||||
private List<Class<?>> classes = new ArrayList<>();
|
||||
private Set<Class<?>> classes = new HashSet<>();
|
||||
|
||||
/**
|
||||
* The packages that are searched for interesting classes. Only used when
|
||||
@@ -2320,8 +2320,7 @@ public class DatabaseConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Programmatically add classes (typically entities) that this server should
|
||||
* use.
|
||||
* Programmatically add classes (typically entities) that this server should use.
|
||||
* <p>
|
||||
* The class can be an Entity, Embedded type, ScalarType, BeanPersistListener,
|
||||
* BeanFinder or BeanPersistController.
|
||||
@@ -2331,8 +2330,7 @@ public class DatabaseConfig {
|
||||
* <p>
|
||||
* Alternatively the classes can be added via {@link #setClasses(List)}.
|
||||
*
|
||||
* @param cls the entity type (or other type) that should be registered by this
|
||||
* database.
|
||||
* @param cls the entity type (or other type) that should be registered by this database.
|
||||
*/
|
||||
public void addClass(Class<?> cls) {
|
||||
classes.add(cls);
|
||||
@@ -2341,7 +2339,7 @@ public class DatabaseConfig {
|
||||
/**
|
||||
* Register all the classes (typically entity classes).
|
||||
*/
|
||||
public void addAll(List<Class<?>> classList) {
|
||||
public void addAll(Collection<Class<?>> classList) {
|
||||
if (classList != null && !classList.isEmpty()) {
|
||||
classes.addAll(classList);
|
||||
}
|
||||
@@ -2383,15 +2381,26 @@ public class DatabaseConfig {
|
||||
* <p>
|
||||
* Alternatively the classes can contain added via {@link #addClass(Class)}.
|
||||
*/
|
||||
public void setClasses(List<Class<?>> classes) {
|
||||
this.classes = classes;
|
||||
public void setClasses(Collection<Class<?>> classes) {
|
||||
this.classes = new HashSet<>(classes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the classes registered for this database. Typically this includes
|
||||
* Return the classes registered for this database. Typically, this includes
|
||||
* entities and perhaps listeners.
|
||||
*/
|
||||
public List<Class<?>> getClasses() {
|
||||
public Set<Class<?>> classes() {
|
||||
return classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to classes().
|
||||
* <p>
|
||||
* Sorry if returning Set rather than List breaks code but it feels safer to
|
||||
* do that than a subtle change to return a shallow copy which you will not detect.
|
||||
*/
|
||||
@Deprecated
|
||||
public Set<Class<?>> getClasses() {
|
||||
return classes;
|
||||
}
|
||||
|
||||
@@ -2760,8 +2769,6 @@ public class DatabaseConfig {
|
||||
this.classLoadConfig = classLoadConfig;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load settings from application.properties, application.yaml and other sources.
|
||||
* <p>
|
||||
@@ -2906,7 +2913,7 @@ public class DatabaseConfig {
|
||||
serverCachePlugin = p.createInstance(ServerCachePlugin.class, "serverCachePlugin", serverCachePlugin);
|
||||
|
||||
String packagesProp = p.get("search.packages", p.get("packages", null));
|
||||
packages = getSearchList(packagesProp, packages);
|
||||
packages = searchList(packagesProp, packages);
|
||||
|
||||
skipCacheAfterWrite = p.getBoolean("skipCacheAfterWrite", skipCacheAfterWrite);
|
||||
updateAllPropertiesInBatch = p.getBoolean("updateAllPropertiesInBatch", updateAllPropertiesInBatch);
|
||||
@@ -2982,10 +2989,10 @@ public class DatabaseConfig {
|
||||
tenantCatalogProvider = p.createInstance(TenantCatalogProvider.class, "tenant.catalogProvider", tenantCatalogProvider);
|
||||
tenantSchemaProvider = p.createInstance(TenantSchemaProvider.class, "tenant.schemaProvider", tenantSchemaProvider);
|
||||
tenantPartitionColumn = p.get("tenant.partitionColumn", tenantPartitionColumn);
|
||||
classes = getClasses(p);
|
||||
classes = readClasses(p);
|
||||
|
||||
String mappingsProp = p.get("mappingLocations", null);
|
||||
mappingLocations = getSearchList(mappingsProp, mappingLocations);
|
||||
mappingLocations = searchList(mappingsProp, mappingLocations);
|
||||
}
|
||||
|
||||
private NamingConvention createNamingConvention(PropertiesWrapper properties, NamingConvention namingConvention) {
|
||||
@@ -2999,13 +3006,13 @@ public class DatabaseConfig {
|
||||
* @param properties the properties
|
||||
* @return the classes
|
||||
*/
|
||||
private List<Class<?>> getClasses(PropertiesWrapper properties) {
|
||||
private Set<Class<?>> readClasses(PropertiesWrapper properties) {
|
||||
String classNames = properties.get("classes", null);
|
||||
if (classNames == null) {
|
||||
return classes;
|
||||
}
|
||||
|
||||
List<Class<?>> classList = new ArrayList<>();
|
||||
Set<Class<?>> classList = new HashSet<>();
|
||||
String[] split = StringHelper.splitNames(classNames);
|
||||
for (String cn : split) {
|
||||
if (!"class".equalsIgnoreCase(cn)) {
|
||||
@@ -3020,7 +3027,7 @@ public class DatabaseConfig {
|
||||
return classList;
|
||||
}
|
||||
|
||||
private List<String> getSearchList(String searchNames, List<String> defaultValue) {
|
||||
private List<String> searchList(String searchNames, List<String> defaultValue) {
|
||||
if (searchNames != null) {
|
||||
String[] entries = StringHelper.splitNames(searchNames);
|
||||
List<String> hitList = new ArrayList<>(entries.length);
|
||||
@@ -3399,8 +3406,16 @@ public class DatabaseConfig {
|
||||
* When false we either register entity classes via application code or use classpath
|
||||
* scanning to find and register entity classes.
|
||||
*/
|
||||
public boolean isLoadModuleInfo() {
|
||||
return loadModuleInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to isLoadModuleInfo().
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isAutoLoadModuleInfo() {
|
||||
return loadModuleInfo && classes.isEmpty();
|
||||
return loadModuleInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,10 +3,6 @@ package io.ebean.config;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.ebean.annotation.MutationDetection;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.config.JsonConfig;
|
||||
import io.ebean.config.MatchingNamingConvention;
|
||||
import io.ebean.config.PlatformConfig;
|
||||
import io.ebean.config.dbplatform.IdType;
|
||||
import io.ebean.datasource.DataSourceConfig;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
@@ -93,6 +89,7 @@ class DatabaseConfigTest {
|
||||
assertTrue(config.isDbOffline());
|
||||
assertTrue(config.isAutoReadOnlyDataSource());
|
||||
assertTrue(config.isAutoLoadModuleInfo());
|
||||
assertTrue(config.isLoadModuleInfo());
|
||||
assertTrue(config.skipDataSourceCheck());
|
||||
|
||||
assertTrue(config.isIdGeneratorAutomatic());
|
||||
@@ -165,6 +162,7 @@ class DatabaseConfigTest {
|
||||
assertEquals(MutationDetection.HASH, config.getJsonMutationDetection());
|
||||
assertTrue(config.getPlatformConfig().isCaseSensitiveCollation());
|
||||
assertTrue(config.isAutoLoadModuleInfo());
|
||||
assertTrue(config.isLoadModuleInfo());
|
||||
|
||||
assertFalse(config.isQueryPlanEnable());
|
||||
assertEquals(Long.MAX_VALUE, config.getQueryPlanThresholdMicros());
|
||||
@@ -175,6 +173,7 @@ class DatabaseConfigTest {
|
||||
|
||||
config.setLoadModuleInfo(false);
|
||||
assertFalse(config.isAutoLoadModuleInfo());
|
||||
assertFalse(config.isLoadModuleInfo());
|
||||
config.setAutoPersistUpdates(true);
|
||||
assertTrue(config.isAutoPersistUpdates());
|
||||
config.setSkipDataSourceCheck(true);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+35
-29
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
@@ -89,106 +89,112 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-joda-time</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-jsonnode</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-mapper</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-xml</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-spring-txn</artifactId>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- platforms -->
|
||||
@@ -196,67 +202,67 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-clickhouse</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-db2</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-h2</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-hana</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-mariadb</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-mysql</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-nuodb</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-oracle</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgres</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-sqlite</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-sqlserver</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
+7
-7
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core</artifactId>
|
||||
@@ -22,7 +22,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -46,13 +46,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -143,21 +143,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
/**
|
||||
* Request for loading Associated Many Beans.
|
||||
@@ -22,26 +23,29 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
private final LoadManyBuffer loadContext;
|
||||
private final boolean onlyIds;
|
||||
private final boolean loadCache;
|
||||
private final BeanCollection<?> originCollection;
|
||||
private boolean originIncluded;
|
||||
|
||||
/**
|
||||
* Construct for lazy loading.
|
||||
*/
|
||||
public LoadManyRequest(LoadManyBuffer loadContext, boolean onlyIds, boolean loadCache) {
|
||||
this(loadContext, null, true, onlyIds, loadCache);
|
||||
public LoadManyRequest(LoadManyBuffer loadContext, boolean onlyIds, boolean loadCache, BeanCollection<?> originCollection) {
|
||||
super(null, true);
|
||||
this.loadContext = loadContext;
|
||||
this.onlyIds = onlyIds;
|
||||
this.loadCache = loadCache;
|
||||
this.originCollection = originCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct for secondary query.
|
||||
*/
|
||||
public LoadManyRequest(LoadManyBuffer loadContext, OrmQueryRequest<?> parentRequest) {
|
||||
this(loadContext, parentRequest, false, false, false);
|
||||
}
|
||||
|
||||
private LoadManyRequest(LoadManyBuffer loadContext, OrmQueryRequest<?> parentRequest, boolean lazy, boolean onlyIds, boolean loadCache) {
|
||||
super(parentRequest, lazy);
|
||||
super(parentRequest, false);
|
||||
this.loadContext = loadContext;
|
||||
this.onlyIds = onlyIds;
|
||||
this.loadCache = loadCache;
|
||||
this.onlyIds = false;
|
||||
this.loadCache = false;
|
||||
this.originCollection = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,10 +63,18 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
for (int i = 0; i < loadContext.size(); i++) {
|
||||
BeanCollection<?> bc = loadContext.get(i);
|
||||
if (bc != null) {
|
||||
if (lazy && !originIncluded && bc == originCollection) {
|
||||
originIncluded = true;
|
||||
}
|
||||
idList.add(many.parentId(bc.getOwnerBean()));
|
||||
bc.setLoader(server); // don't use the load buffer again
|
||||
}
|
||||
}
|
||||
if (originCollection != null && !originIncluded) {
|
||||
CoreLog.log.log(INFO, "Batch lazy loading including origin collection - size:{0}", idList.size());
|
||||
idList.add(many.parentId(originCollection.getOwnerBean()));
|
||||
originCollection.setLoader(server); // don't use the load buffer again
|
||||
}
|
||||
if (many.targetDescriptor().isPadInExpression()) {
|
||||
BindPadding.padIds(idList);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ import javax.persistence.PersistenceException;
|
||||
import java.net.URL;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
@@ -121,7 +121,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
configProvider.apply(config);
|
||||
}
|
||||
}
|
||||
if (config.isAutoLoadModuleInfo()) {
|
||||
if (config.isLoadModuleInfo()) {
|
||||
// auto register entity classes
|
||||
boolean found = false;
|
||||
for (EntityClassRegister loader : ServiceLoader.load(EntityClassRegister.class)) {
|
||||
@@ -177,10 +177,10 @@ public final class DefaultContainer implements SpiContainer {
|
||||
* Get the class based entities, scalarTypes, Listeners etc.
|
||||
*/
|
||||
private BootupClasses bootupClasses1(DatabaseConfig config) {
|
||||
List<Class<?>> entityClasses = config.getClasses();
|
||||
if (config.isDisableClasspathSearch() || (entityClasses != null && !entityClasses.isEmpty())) {
|
||||
Set<Class<?>> classes = config.classes();
|
||||
if (config.isDisableClasspathSearch() || (classes != null && !classes.isEmpty())) {
|
||||
// use classes we explicitly added via configuration
|
||||
return new BootupClasses(entityClasses);
|
||||
return new BootupClasses(classes);
|
||||
}
|
||||
return BootupClassPathSearch.search(config);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
@@ -79,9 +80,9 @@ public class BootupClasses implements Predicate<Class<?>> {
|
||||
public BootupClasses() {
|
||||
}
|
||||
|
||||
public BootupClasses(List<Class<?>> list) {
|
||||
if (list != null) {
|
||||
for (Class<?> cls : list) {
|
||||
public BootupClasses(Set<Class<?>> classes) {
|
||||
if (classes != null) {
|
||||
for (Class<?> cls : classes) {
|
||||
test(cls);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-8
@@ -9,8 +9,7 @@ import io.ebeaninternal.server.deploy.ManyType;
|
||||
import io.ebeaninternal.server.deploy.meta.*;
|
||||
import io.ebeaninternal.server.type.TypeManager;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.Transient;
|
||||
import javax.persistence.*;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
@@ -105,20 +104,18 @@ public final class DeployCreateProperties {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private DeployBeanProperty createManyType(DeployBeanDescriptor<?> desc, Class<?> targetType, ManyType manyType) {
|
||||
try {
|
||||
ScalarType<?> scalarType = typeManager.type(targetType);
|
||||
if (scalarType != null) {
|
||||
return new DeployBeanPropertySimpleCollection(desc, targetType, manyType);
|
||||
return new DeployBeanPropertySimpleCollection<>(desc, targetType, manyType);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
CoreLog.internal.log(DEBUG, "expected non-scalar type {0}", e.getMessage());
|
||||
}
|
||||
return new DeployBeanPropertyAssocMany(desc, targetType, manyType);
|
||||
return new DeployBeanPropertyAssocMany<>(desc, targetType, manyType);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private DeployBeanProperty createProp(DeployBeanDescriptor<?> desc, Field field) {
|
||||
Class<?> propertyType = field.getType();
|
||||
if (isSpecialScalarType(field)) {
|
||||
@@ -149,9 +146,11 @@ public final class DeployCreateProperties {
|
||||
// return with no ScalarType (still support JSON features)
|
||||
return new DeployBeanProperty(desc, propertyType, null, null);
|
||||
}
|
||||
if (AnnotationUtil.has(field, Convert.class)) {
|
||||
throw new IllegalStateException("No AttributeConverter registered for type " + propertyType + " at " + desc.getFullName() + "." + field.getName());
|
||||
}
|
||||
try {
|
||||
return new DeployBeanPropertyAssocOne(desc, propertyType);
|
||||
|
||||
return new DeployBeanPropertyAssocOne<>(desc, propertyType);
|
||||
} catch (Exception e) {
|
||||
CoreLog.log.log(ERROR, "Error with " + desc + " field:" + field.getName(), e);
|
||||
return null;
|
||||
|
||||
@@ -212,7 +212,7 @@ final class DLoadManyContext extends DLoadBaseContext implements LoadManyContext
|
||||
}
|
||||
}
|
||||
|
||||
context.parent.getEbeanServer().loadMany(new LoadManyRequest(this, onlyIds, useCache));
|
||||
context.parent.getEbeanServer().loadMany(new LoadManyRequest(this, onlyIds, useCache, bc));
|
||||
// clear the buffer as all entries have been loaded
|
||||
clear();
|
||||
} finally {
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static io.ebeaninternal.server.persist.DmlUtil.isNullOrZero;
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
|
||||
/**
|
||||
* Saves the details for a OneToMany or ManyToMany relationship (entity beans).
|
||||
@@ -309,11 +310,11 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
EntityBean otherBean = (EntityBean) other;
|
||||
// the object from the 'other' side of the ManyToMany
|
||||
if (deletions != null && deletions.remove(otherBean)) {
|
||||
String m = "Inserting and Deleting same object? " + otherBean;
|
||||
String msg = "Inserting and Deleting same object? " + otherBean;
|
||||
if (transaction.isLogSummary()) {
|
||||
transaction.logSummary(m);
|
||||
transaction.logSummary(msg);
|
||||
}
|
||||
CoreLog.log.log(System.Logger.Level.WARNING, m);
|
||||
CoreLog.log.log(WARNING, msg);
|
||||
} else {
|
||||
if (!many.hasImportedId(otherBean)) {
|
||||
throw new PersistenceException("ManyToMany bean does not have an Id value? " + otherBean);
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.server.core.OrmQueryRequest;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryLimitRequest;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryProperties;
|
||||
import io.ebeaninternal.server.rawsql.SpiRawSql;
|
||||
import io.ebeaninternal.server.util.BindParamsParser;
|
||||
|
||||
@@ -56,7 +57,19 @@ final class CQueryBuilderRawSql {
|
||||
|
||||
private String buildMainQuery(String orderBy, OrmQueryRequest<?> request, CQueryPredicates predicates, SpiRawSql.Sql sql) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(sql.getPreFrom());
|
||||
OrmQueryProperties ormQueryProperties = request.query().getDetail().getChunk(null, false);
|
||||
if (ormQueryProperties.hasSelectClause()) {
|
||||
boolean first = true;
|
||||
for (String selectProperty : ormQueryProperties.getIncluded()) {
|
||||
if (!first) {
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(selectProperty);
|
||||
first = false;
|
||||
}
|
||||
} else {
|
||||
sb.append(sql.getPreFrom());
|
||||
}
|
||||
sb.append(" ");
|
||||
|
||||
String s = sql.getPreWhere();
|
||||
|
||||
@@ -591,10 +591,17 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
|
||||
*/
|
||||
@Override
|
||||
public final void setSelectId() {
|
||||
// clear select and fetch joins
|
||||
detail.clear();
|
||||
select(beanDescriptor.idSelect());
|
||||
singleAttribute = true;
|
||||
if (rawSql != null) {
|
||||
String column = rawSql.mapToColumn(beanDescriptor.idSelect());
|
||||
if (column != null) {
|
||||
select(column);
|
||||
}
|
||||
} else {
|
||||
// clear select and fetch joins
|
||||
detail.clear();
|
||||
select(beanDescriptor.idSelect());
|
||||
singleAttribute = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,4 +60,8 @@ public final class DRawSql implements SpiRawSql {
|
||||
return columnMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String mapToColumn(String property) {
|
||||
return columnMapping.mapToColumn(property);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,7 @@ import io.ebean.util.CamelCaseHelper;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Internal service API for Raw Sql.
|
||||
@@ -31,6 +25,7 @@ public interface SpiRawSql extends RawSql {
|
||||
|
||||
SpiRawSql.ColumnMapping getColumnMapping();
|
||||
|
||||
String mapToColumn(String property);
|
||||
|
||||
/**
|
||||
* Represents the sql part of the query. For parsed RawSql the sql is broken
|
||||
@@ -363,7 +358,6 @@ public interface SpiRawSql extends RawSql {
|
||||
* </p>
|
||||
*/
|
||||
public void tableAliasMapping(String tableAlias, String path) {
|
||||
|
||||
String startMatch = tableAlias + ".";
|
||||
for (Map.Entry<String, Column> entry : dbColumnMap.entrySet()) {
|
||||
if (entry.getKey().startsWith(startMatch)) {
|
||||
@@ -372,6 +366,11 @@ public interface SpiRawSql extends RawSql {
|
||||
}
|
||||
}
|
||||
|
||||
public String mapToColumn(String property) {
|
||||
final var column = propertyColumnMap.get(property);
|
||||
return column == null ? null : column.getDbColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* A Column of the RawSql that is mapped to a bean property (or ignored).
|
||||
*/
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public class BeanDescriptor_registerTest {
|
||||
config.setDdlExtra(false);
|
||||
config.setRegister(false);
|
||||
config.setDefaultServer(false);
|
||||
config.getClasses().add(EBasic.class);
|
||||
config.addClass(EBasic.class);
|
||||
|
||||
SpiEbeanServer ebeanServer = (SpiEbeanServer)DatabaseFactory.create(config);
|
||||
try {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-csv-reader</artifactId>
|
||||
@@ -14,21 +14,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean ddl generation</name>
|
||||
@@ -28,14 +28,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean external mapping api</name>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<scm>
|
||||
@@ -21,7 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JAVAX-DEPENDENCY-START -->
|
||||
@@ -68,21 +68,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-jackson-jsonnode</artifactId>
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-kotlin</artifactId>
|
||||
@@ -28,7 +28,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean postgis</name>
|
||||
@@ -22,14 +22,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- provided scope -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean querybean</name>
|
||||
@@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -63,21 +63,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -103,11 +103,11 @@
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<version>2.34</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.ebean.tile:enhancement:13.13.1</tile>
|
||||
<tile>io.ebean.tile:enhancement:13.13.2</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
package io.ebean.typequery;
|
||||
|
||||
import io.avaje.lang.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Base type for associated beans.
|
||||
*
|
||||
* @param <T> the entity bean type (normal entity bean type e.g. Customer)
|
||||
* @param <R> the specific root query bean type (e.g. QCustomer)
|
||||
*/
|
||||
public abstract class TQAssoc<T, R> extends TQProperty<R, Object> {
|
||||
|
||||
/**
|
||||
* Construct with a property name and root instance.
|
||||
*
|
||||
* @param name the name of the property
|
||||
* @param root the root query bean instance
|
||||
*/
|
||||
public TQAssoc(String name, R root) {
|
||||
this(name, root, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct with additional path prefix.
|
||||
*/
|
||||
public TQAssoc(String name, R root, String prefix) {
|
||||
super(name, root, prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is equal to by ID property.
|
||||
*/
|
||||
public final R eq(T other) {
|
||||
expr().eq(_name, other);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is EQUAL TO if value is non-null and otherwise no expression is added to the query.
|
||||
* <p>
|
||||
* This is effectively a helper method that allows a query to be built in fluid style where some predicates are
|
||||
* effectively optional. We can use <code>eqIfPresent()</code> rather than having a separate if block.
|
||||
*/
|
||||
public final R eqIfPresent(@Nullable T other) {
|
||||
expr().eqIfPresent(_name, other);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is equal to by ID property.
|
||||
*/
|
||||
public final R equalTo(T other) {
|
||||
return eq(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is not equal to by ID property.
|
||||
*/
|
||||
public final R ne(T other) {
|
||||
expr().ne(_name, other);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is not equal to by ID property.
|
||||
*/
|
||||
public final R notEqualTo(T other) {
|
||||
return ne(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is in a list of values.
|
||||
*
|
||||
* @param values the list of values for the predicate
|
||||
* @return the root query bean instance
|
||||
*/
|
||||
@SafeVarargs
|
||||
public final R in(T... values) {
|
||||
expr().in(_name, (Object[]) values);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is in a list of values.
|
||||
*
|
||||
* @param values the list of values for the predicate
|
||||
* @return the root query bean instance
|
||||
*/
|
||||
public final R in(Collection<T> values) {
|
||||
expr().in(_name, values);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* In where null or empty values means that no predicate is added to the query.
|
||||
* <p>
|
||||
* That is, only add the IN predicate if the values are not null or empty.
|
||||
* <p>
|
||||
* Without this we typically need to code an <code>if</code> block to only add
|
||||
* the IN predicate if the collection is not empty like:
|
||||
* </p>
|
||||
*
|
||||
* <h3>Without inOrEmpty()</h3>
|
||||
* <pre>{@code
|
||||
*
|
||||
* List<String> names = Arrays.asList("foo", "bar");
|
||||
*
|
||||
* QCustomer query = new QCustomer()
|
||||
* .registered.before(LocalDate.now())
|
||||
*
|
||||
* // conditionally add the IN expression to the query
|
||||
* if (names != null && !names.isEmpty()) {
|
||||
* query.name.in(names)
|
||||
* }
|
||||
*
|
||||
* query.findList();
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
* <h3>Using inOrEmpty()</h3>
|
||||
* <pre>{@code
|
||||
*
|
||||
* List<String> names = Arrays.asList("foo", "bar");
|
||||
*
|
||||
* new QCustomer()
|
||||
* .registered.before(LocalDate.now())
|
||||
* .name.inOrEmpty(names)
|
||||
* .findList();
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
public final R inOrEmpty(Collection<T> values) {
|
||||
expr().inOrEmpty(_name, values);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is NOT in a list of values.
|
||||
*
|
||||
* @param values the list of values for the predicate
|
||||
* @return the root query bean instance
|
||||
*/
|
||||
public final R notIn(Collection<T> values) {
|
||||
expr().notIn(_name, values);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is NOT in a list of values.
|
||||
*
|
||||
* @param values the list of values for the predicate
|
||||
* @return the root query bean instance
|
||||
*/
|
||||
@SafeVarargs
|
||||
public final R notIn(T... values) {
|
||||
expr().notIn(_name, (Object[]) values);
|
||||
return _root;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.ebean.typequery;
|
||||
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.ExpressionList;
|
||||
import io.ebean.FetchConfig;
|
||||
import io.ebean.FetchGroup;
|
||||
@@ -8,18 +7,18 @@ import io.ebeaninternal.api.SpiQueryFetch;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryDetail;
|
||||
import io.ebeaninternal.server.querydefn.SpiFetchGroup;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Base type for associated beans.
|
||||
* Base type for associated beans that are not embeddable.
|
||||
*
|
||||
* @param <T> the entity bean type (normal entity bean type e.g. Customer)
|
||||
* @param <R> the specific root query bean type (e.g. QCustomer)
|
||||
* @param <QB> the query bean type
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract class TQAssocBean<T, R> extends TQProperty<R, Object> {
|
||||
public abstract class TQAssocBean<T, R, QB> extends TQAssoc<T, R> {
|
||||
|
||||
private static final FetchConfig FETCH_DEFAULT = FetchConfig.ofDefault();
|
||||
private static final FetchConfig FETCH_QUERY = FetchConfig.ofQuery();
|
||||
@@ -110,38 +109,37 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R, Object> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Eagerly fetch this association fetching some of the properties.
|
||||
* Eagerly fetch this association loading the specified properties.
|
||||
*/
|
||||
@SafeVarargs
|
||||
protected final R fetchProperties(TQProperty<?, ?>... props) {
|
||||
return fetchWithProperties(FETCH_DEFAULT, props);
|
||||
@SafeVarargs @SuppressWarnings("varargs")
|
||||
public final R fetch(TQProperty<QB,?>... properties) {
|
||||
return fetchWithProperties(FETCH_DEFAULT, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Eagerly fetch query this association fetching some of the properties.
|
||||
* Eagerly fetch this association using a 'query join' loading the specified properties.
|
||||
*/
|
||||
@SafeVarargs
|
||||
protected final R fetchQueryProperties(TQProperty<?, ?>... props) {
|
||||
return fetchWithProperties(FETCH_QUERY, props);
|
||||
@SafeVarargs @SuppressWarnings("varargs")
|
||||
public final R fetchQuery(TQProperty<QB,?>... properties) {
|
||||
return fetchWithProperties(FETCH_QUERY, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Eagerly fetch this association using L2 bean cache.
|
||||
* Eagerly fetch this association using L2 cache.
|
||||
*/
|
||||
@SafeVarargs
|
||||
protected final R fetchCacheProperties(TQProperty<?, ?>... props) {
|
||||
return fetchWithProperties(FETCH_CACHE, props);
|
||||
@SafeVarargs @SuppressWarnings("varargs")
|
||||
public final R fetchCache(TQProperty<QB,?>... properties) {
|
||||
return fetchWithProperties(FETCH_CACHE, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Eagerly fetch query this association fetching some of the properties.
|
||||
* Use lazy loading for this association loading the specified properties.
|
||||
*/
|
||||
@SafeVarargs
|
||||
protected final R fetchLazyProperties(TQProperty<?, ?>... props) {
|
||||
return fetchWithProperties(FETCH_LAZY, props);
|
||||
@SafeVarargs @SuppressWarnings("varargs")
|
||||
public final R fetchLazy(TQProperty<QB,?>... properties) {
|
||||
return fetchWithProperties(FETCH_LAZY, properties);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
private R fetchWithProperties(FetchConfig config, TQProperty<?, ?>... props) {
|
||||
spiQuery().fetchProperties(_name, properties(props), config);
|
||||
return _root;
|
||||
@@ -178,7 +176,6 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R, Object> {
|
||||
return (SpiQueryFetch) ((TQRootBean) _root).query();
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
private Set<String> properties(TQProperty<?, ?>... props) {
|
||||
Set<String> set = new LinkedHashSet<>();
|
||||
for (TQProperty<?, ?> prop : props) {
|
||||
@@ -187,135 +184,6 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R, Object> {
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is equal to by ID property.
|
||||
*/
|
||||
public final R eq(T other) {
|
||||
expr().eq(_name, other);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is EQUAL TO if value is non-null and otherwise no expression is added to the query.
|
||||
* <p>
|
||||
* This is effectively a helper method that allows a query to be built in fluid style where some predicates are
|
||||
* effectively optional. We can use <code>eqIfPresent()</code> rather than having a separate if block.
|
||||
*/
|
||||
public final R eqIfPresent(@Nullable T other) {
|
||||
expr().eqIfPresent(_name, other);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is equal to by ID property.
|
||||
*/
|
||||
public final R equalTo(T other) {
|
||||
return eq(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is not equal to by ID property.
|
||||
*/
|
||||
public final R ne(T other) {
|
||||
expr().ne(_name, other);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is not equal to by ID property.
|
||||
*/
|
||||
public final R notEqualTo(T other) {
|
||||
return ne(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is in a list of values.
|
||||
*
|
||||
* @param values the list of values for the predicate
|
||||
* @return the root query bean instance
|
||||
*/
|
||||
@SafeVarargs
|
||||
public final R in(T... values) {
|
||||
expr().in(_name, (Object[]) values);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is in a list of values.
|
||||
*
|
||||
* @param values the list of values for the predicate
|
||||
* @return the root query bean instance
|
||||
*/
|
||||
public final R in(Collection<T> values) {
|
||||
expr().in(_name, values);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* In where null or empty values means that no predicate is added to the query.
|
||||
* <p>
|
||||
* That is, only add the IN predicate if the values are not null or empty.
|
||||
* <p>
|
||||
* Without this we typically need to code an <code>if</code> block to only add
|
||||
* the IN predicate if the collection is not empty like:
|
||||
* </p>
|
||||
*
|
||||
* <h3>Without inOrEmpty()</h3>
|
||||
* <pre>{@code
|
||||
*
|
||||
* List<String> names = Arrays.asList("foo", "bar");
|
||||
*
|
||||
* QCustomer query = new QCustomer()
|
||||
* .registered.before(LocalDate.now())
|
||||
*
|
||||
* // conditionally add the IN expression to the query
|
||||
* if (names != null && !names.isEmpty()) {
|
||||
* query.name.in(names)
|
||||
* }
|
||||
*
|
||||
* query.findList();
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
* <h3>Using inOrEmpty()</h3>
|
||||
* <pre>{@code
|
||||
*
|
||||
* List<String> names = Arrays.asList("foo", "bar");
|
||||
*
|
||||
* new QCustomer()
|
||||
* .registered.before(LocalDate.now())
|
||||
* .name.inOrEmpty(names)
|
||||
* .findList();
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
public final R inOrEmpty(Collection<T> values) {
|
||||
expr().inOrEmpty(_name, values);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is NOT in a list of values.
|
||||
*
|
||||
* @param values the list of values for the predicate
|
||||
* @return the root query bean instance
|
||||
*/
|
||||
public final R notIn(Collection<T> values) {
|
||||
expr().notIn(_name, values);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is NOT in a list of values.
|
||||
*
|
||||
* @param values the list of values for the predicate
|
||||
* @return the root query bean instance
|
||||
*/
|
||||
@SafeVarargs
|
||||
public final R notIn(T... values) {
|
||||
expr().notIn(_name, (Object[]) values);
|
||||
return _root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a filter when fetching these beans.
|
||||
|
||||
@@ -2,15 +2,22 @@ package org.example.domain;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Inheritance;
|
||||
|
||||
@Inheritance
|
||||
@DiscriminatorValue("CAT")
|
||||
@Entity
|
||||
public class ACat extends Animal {
|
||||
|
||||
private String catProp;
|
||||
|
||||
public ACat(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public String getCatProp() {
|
||||
return catProp;
|
||||
}
|
||||
|
||||
public void setCatProp(String catProp) {
|
||||
this.catProp = catProp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.example.domain;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@DiscriminatorValue("SCAT")
|
||||
@Entity
|
||||
public class ASuperCat extends ACat {
|
||||
|
||||
private String superCat;
|
||||
|
||||
public ASuperCat(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public String getSuperCat() {
|
||||
return superCat;
|
||||
}
|
||||
|
||||
public void setSuperCat(String superCat) {
|
||||
this.superCat = superCat;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.querytest;
|
||||
|
||||
import org.example.domain.ACat;
|
||||
import org.example.domain.ADog;
|
||||
import org.example.domain.Animal;
|
||||
import org.example.domain.query.QACat;
|
||||
import org.example.domain.query.QASuperCat;
|
||||
import org.example.domain.query.QAnimal;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class InheritanceTest {
|
||||
|
||||
@Test
|
||||
void query_setInheritType() {
|
||||
|
||||
ACat cat = new ACat("C1");
|
||||
cat.save();
|
||||
|
||||
ACat cat2 = new ACat("C2");
|
||||
cat2.save();
|
||||
|
||||
ADog dog = new ADog("D1", "D878");
|
||||
dog.save();
|
||||
|
||||
List<Animal> animals = new QAnimal()
|
||||
.id.greaterOrEqualTo(1L)
|
||||
.setInheritType(ACat.class)
|
||||
.findList();
|
||||
|
||||
assertThat(animals).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void query_onInheritedProperty() {
|
||||
new QACat()
|
||||
.name.eq("foo")
|
||||
.catProp.eq("foo")
|
||||
.findList();
|
||||
}
|
||||
|
||||
@Test
|
||||
void query_onInheritedProperty_whenParentOnlyHasDiscriminator() {
|
||||
// the .name and .catProp properties exist on QASuperCat()
|
||||
new QASuperCat()
|
||||
.superCat.eq("foo")
|
||||
.name.eq("foo")
|
||||
.catProp.eq("foo")
|
||||
.findList();
|
||||
}
|
||||
}
|
||||
@@ -591,25 +591,7 @@ public class QCustomerTest {
|
||||
.findList();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void query_setInheritType() {
|
||||
|
||||
ACat cat = new ACat("C1");
|
||||
cat.save();
|
||||
|
||||
ACat cat2 = new ACat("C2");
|
||||
cat2.save();
|
||||
|
||||
ADog dog = new ADog("D1", "D878");
|
||||
dog.save();
|
||||
|
||||
List<Animal> animals = new QAnimal()
|
||||
.id.greaterOrEqualTo(1L)
|
||||
.setInheritType(ACat.class)
|
||||
.findList();
|
||||
|
||||
System.out.println(animals);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void select_assocManyToOne() {
|
||||
|
||||
+6
-6
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
@@ -22,35 +22,35 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
spaces_around_operators = true
|
||||
max_line_length = 130
|
||||
@@ -0,0 +1,9 @@
|
||||
*.sql
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
target/
|
||||
logs/
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2012 Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,45 @@
|
||||
[](https://maven-badges.herokuapp.com/maven-central/io.ebean/ebean-spring-txn)
|
||||
[](https://github.com/ebean-orm/ebean-spring-txn/blob/master/LICENSE)
|
||||
|
||||
ebean-spring-txn
|
||||
=====================
|
||||
|
||||
Integration with Spring managed transactions.
|
||||
|
||||
This project provides an Ebean `ExternalTransactionManager` specifically
|
||||
to integrate with Springs JDBC Transaction manager.
|
||||
|
||||
## To use
|
||||
|
||||
```java
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
|
||||
// set SpringJdbcTransactionManager ... as the external transaction manager
|
||||
config.setExternalTransactionManager(new SpringJdbcTransactionManager());
|
||||
|
||||
...
|
||||
Database database = DatabaseFactory.create(config);
|
||||
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
You can use Ebean in Spring/Spring Boot *without* this and that case Ebean
|
||||
manages the Transactions itself. With Ebean managing the transactions there
|
||||
are some benefits with more control over JDBC batch, getGeneratedKeys
|
||||
and a simpler abstraction (as Spring transactions is designed to manage
|
||||
multiple resources such as JDBC Transactions and JPA EntityManager and Ebean
|
||||
only needs to manage JDBC Transactions).
|
||||
|
||||
|
||||
## Java modules
|
||||
|
||||
Add `requires io.ebean.spring.txn` to module-info.
|
||||
|
||||
```java
|
||||
module foo {
|
||||
|
||||
requires io.ebean.spring.txn;
|
||||
...
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,117 @@
|
||||
<?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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-spring-txn</artifactId>
|
||||
<name>ebean-spring-txn</name>
|
||||
<description>Ebean support for Spring transactions</description>
|
||||
|
||||
<properties>
|
||||
<spring.framework.version>5.3.25</spring.framework.version>
|
||||
<spring.boot.version>2.7.3</spring.boot.version>
|
||||
<surefire.useModulePath>false</surefire.useModulePath>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.32</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.14.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Provided: Spring, Spring Boot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.24</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.ebean.tile:enhancement:13.14.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,20 @@
|
||||
package io.ebean.spring.txn;
|
||||
|
||||
import io.ebeaninternal.server.transaction.ExternalJdbcTransaction;
|
||||
import io.ebeaninternal.server.transaction.TransactionManager;
|
||||
import org.springframework.jdbc.datasource.ConnectionHolder;
|
||||
|
||||
final class SpringJdbcTransaction extends ExternalJdbcTransaction {
|
||||
|
||||
private final ConnectionHolder holder;
|
||||
|
||||
SpringJdbcTransaction(ConnectionHolder holder, TransactionManager manager) {
|
||||
super(true, holder.getConnection(), manager);
|
||||
this.holder = holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return holder.isSynchronizedWithTransaction();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package io.ebean.spring.txn;
|
||||
|
||||
import io.avaje.applog.AppLog;
|
||||
import io.ebean.TxScope;
|
||||
import io.ebean.config.ExternalTransactionManager;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.server.transaction.TransactionManager;
|
||||
import org.springframework.jdbc.datasource.ConnectionHolder;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
|
||||
/**
|
||||
* A Spring-aware {@link ExternalTransactionManager}.
|
||||
* <p>
|
||||
* Will look for Spring transactions and use them if they exist.
|
||||
*
|
||||
* @author E Mc Greal
|
||||
* @since 18.05.2009
|
||||
*/
|
||||
public final class SpringJdbcTransactionManager implements ExternalTransactionManager {
|
||||
|
||||
private static final System.Logger log = AppLog.getLogger(SpringJdbcTransactionManager.class);
|
||||
|
||||
private DataSource dataSource;
|
||||
private TransactionManager transactionManager;
|
||||
|
||||
/**
|
||||
* Instantiates a new spring aware transaction scope manager.
|
||||
*/
|
||||
public SpringJdbcTransactionManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise this with the Ebean internal transaction manager.
|
||||
*/
|
||||
@Override
|
||||
public void setTransactionManager(Object txnMgr) {
|
||||
// RB: At this stage not exposing TransactionManager to
|
||||
// the public API and hence the Object type and casting here
|
||||
this.transactionManager = (TransactionManager) txnMgr;
|
||||
this.dataSource = transactionManager.dataSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks for a current Spring managed transaction and wraps/returns that as a Ebean transaction.
|
||||
* <p>
|
||||
* Returns null if there is no current spring transaction (lazy loading outside a spring txn).
|
||||
*/
|
||||
@Override
|
||||
public Object getCurrentTransaction() {
|
||||
// Get the current Spring ConnectionHolder associated to the current spring managed transaction
|
||||
ConnectionHolder holder = (ConnectionHolder) TransactionSynchronizationManager.getResource(dataSource);
|
||||
if (holder == null || !holder.isSynchronizedWithTransaction()) {
|
||||
// no current Spring transaction
|
||||
SpiTransaction currentEbeanTransaction = transactionManager.inScope();
|
||||
if (currentEbeanTransaction == null || !currentEbeanTransaction.isActive()) {
|
||||
return null;
|
||||
} else {
|
||||
return currentEbeanTransaction;
|
||||
}
|
||||
}
|
||||
|
||||
SpringTxnListener springTxnLister = listener();
|
||||
if (springTxnLister != null) {
|
||||
// we have already seen this transaction
|
||||
return springTxnLister.transaction();
|
||||
} else {
|
||||
// This is a new spring transaction that we have not seen before.
|
||||
// "wrap" it in a SpringJdbcTransaction for use with Ebean
|
||||
SpringJdbcTransaction newTrans = new SpringJdbcTransaction(holder, transactionManager);
|
||||
|
||||
// Create and register a Spring TransactionSynchronization for this transaction
|
||||
springTxnLister = createListener(newTrans);
|
||||
TransactionSynchronizationManager.registerSynchronization(springTxnLister);
|
||||
return transactionManager.externalBeginTransaction(newTrans, TxScope.required());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for our specific transaction listener.
|
||||
* <p>
|
||||
* If it exists then we have already seen and "wrapped" this transaction.
|
||||
*/
|
||||
private SpringTxnListener listener() {
|
||||
if (TransactionSynchronizationManager.isSynchronizationActive()) {
|
||||
List<TransactionSynchronization> synchronizations = TransactionSynchronizationManager.getSynchronizations();
|
||||
// search for our specific listener
|
||||
for (TransactionSynchronization synchronization : synchronizations) {
|
||||
if (synchronization instanceof SpringTxnListener) {
|
||||
return (SpringTxnListener) synchronization;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a listener to enable Ebean to be notified when transactions commit and rollback.
|
||||
*/
|
||||
private SpringTxnListener createListener(SpringJdbcTransaction transaction) {
|
||||
return new SpringTxnListener(transactionManager, transaction);
|
||||
}
|
||||
|
||||
/**
|
||||
* A Spring TransactionSynchronization that we register with Spring to get notified when
|
||||
* a Spring managed transaction has been committed or rolled back.
|
||||
* <p>
|
||||
* When Ebean is notified (of the commit/rollback) it can then manage its cache, notify
|
||||
* BeanPersistListeners etc.
|
||||
*/
|
||||
private static class SpringTxnListener implements TransactionSynchronization {
|
||||
|
||||
private final TransactionManager transactionManager;
|
||||
|
||||
private final SpringJdbcTransaction transaction;
|
||||
|
||||
private SpringTxnListener(TransactionManager transactionManager, SpringJdbcTransaction t) {
|
||||
this.transactionManager = transactionManager;
|
||||
this.transaction = t;
|
||||
}
|
||||
|
||||
private SpringJdbcTransaction transaction() {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
transaction.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeCommit(boolean readOnly) {
|
||||
if (!readOnly) {
|
||||
transaction.preCommit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
switch (status) {
|
||||
case STATUS_COMMITTED:
|
||||
log.log(DEBUG, "Spring Txn [{0}] committed", transaction.getId());
|
||||
transaction.postCommit();
|
||||
break;
|
||||
|
||||
case STATUS_ROLLED_BACK:
|
||||
log.log(DEBUG, "Spring Txn [{0}] rollback", transaction.getId());
|
||||
transaction.postRollback(null);
|
||||
break;
|
||||
|
||||
default:
|
||||
// this should never happen
|
||||
throw new PersistenceException("Invalid status " + status);
|
||||
}
|
||||
|
||||
// Remove this transaction object as it is completed
|
||||
transactionManager.externalRemoveTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
module io.ebean.spring.txn {
|
||||
|
||||
exports io.ebean.spring.txn;
|
||||
|
||||
requires io.ebean.api;
|
||||
requires io.ebean.core;
|
||||
requires spring.jdbc;
|
||||
requires spring.tx;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.example;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Table(name="o_account")
|
||||
@Entity
|
||||
public class Account {
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
@OneToOne
|
||||
private User user;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.example;
|
||||
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.annotation.PersistBatch;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* A Spring FactoryBean for constructing EbeanServer instances.
|
||||
*
|
||||
* @since 18.05.2009
|
||||
* @author E Mc Greal
|
||||
*/
|
||||
public class EbeanServerFactoryBean implements InitializingBean, FactoryBean<Database> {
|
||||
|
||||
/**
|
||||
* The Ebean server configuration.
|
||||
*/
|
||||
private DatabaseConfig serverConfig;
|
||||
|
||||
/**
|
||||
* The EbeanServer instance.
|
||||
*/
|
||||
private Database ebeanServer;
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
||||
if (serverConfig == null) {
|
||||
throw new Exception("No ServerConig set. You must define a ServerConfig bean");
|
||||
}
|
||||
|
||||
serverConfig.setPersistBatch(PersistBatch.ALL);
|
||||
// Create the new EbeanServer using the configuration
|
||||
this.ebeanServer = DatabaseFactory.create(serverConfig);
|
||||
}
|
||||
|
||||
public Database getObject() throws Exception {
|
||||
return ebeanServer;
|
||||
}
|
||||
|
||||
public Class<? extends Database> getObjectType() {
|
||||
return Database.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true for EbeanServer.
|
||||
*/
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the server configuration.
|
||||
*/
|
||||
public DatabaseConfig getServerConfig() {
|
||||
return serverConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the server configuration.
|
||||
*/
|
||||
public void setServerConfig(DatabaseConfig serverConfig) {
|
||||
this.serverConfig = serverConfig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package org.example;
|
||||
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Transaction;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Unit test for Ebean Spring Module.
|
||||
*
|
||||
* @author E Mc Greal
|
||||
* @since 18.05.2009
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(locations = {"/init-database.xml"})
|
||||
public class EbeanSpringModuleTest {
|
||||
|
||||
/**
|
||||
* The Constant logger.
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(EbeanSpringModuleTest.class);
|
||||
|
||||
/**
|
||||
* The user service.
|
||||
*/
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* Create the test case.
|
||||
*/
|
||||
public EbeanSpringModuleTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test app.
|
||||
*/
|
||||
@Test
|
||||
public void testInactiveTransaction() {
|
||||
|
||||
Transaction transaction = DB.beginTransaction();
|
||||
long id;
|
||||
try {
|
||||
User user = new User();
|
||||
user.setName("save with txn 1");
|
||||
DB.save(user);
|
||||
transaction.commit();
|
||||
id = user.getOid();
|
||||
} finally {
|
||||
// don't end the transaction ...
|
||||
//transaction.end();
|
||||
}
|
||||
|
||||
DB.delete(User.class, id);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBatchInsert() {
|
||||
userService.batchInsert();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiresNew() {
|
||||
userService.requiresNew();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test app.
|
||||
*/
|
||||
@Test
|
||||
public void testSaveUser() {
|
||||
logger.info("Saving new User...");
|
||||
User user = new User();
|
||||
user.setName("ebean");
|
||||
userService.save(user);
|
||||
logger.info("Saved new User");
|
||||
assertThat(user.getOid()).isGreaterThan(0);
|
||||
|
||||
final User found = DB.find(User.class, user.getOid());
|
||||
assertThat(found).isNotNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test app.
|
||||
*/
|
||||
@Test
|
||||
public void testFindUser() {
|
||||
logger.info("Finding User with OID = 1 ...");
|
||||
User user = userService.find(1);
|
||||
|
||||
assertNotNull(user);
|
||||
assertTrue("ebean".equals(user.getName()));
|
||||
logger.info("Found User with OID = 1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonTransactional() {
|
||||
userService.nonTransactional();
|
||||
logger.info("nonTransactional done");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindNonTransactional() {
|
||||
logger.info("Finding User with OID = 1 ...");
|
||||
User user = userService.find(1);
|
||||
User user2 = userService.findNoCurrentTransaction(2);
|
||||
logger.info("nonTransactional find user1:{} user2:{}", user, user2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the user service.
|
||||
*/
|
||||
public UserService getUserService() {
|
||||
return userService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the user service.
|
||||
*/
|
||||
public void setUserService(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.example;
|
||||
|
||||
import java.util.Set;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Table(name="o_role")
|
||||
@Entity
|
||||
public class Role {
|
||||
|
||||
@Id
|
||||
Long id;
|
||||
|
||||
@ManyToMany
|
||||
private Set<User> users;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Set<User> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(Set<User> users) {
|
||||
this.users = users;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.example;
|
||||
|
||||
import io.ebean.Model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Set;
|
||||
|
||||
@Table(name="o_user")
|
||||
@Entity
|
||||
public class User extends Model {
|
||||
|
||||
@Id
|
||||
long oid;
|
||||
|
||||
private String name;
|
||||
|
||||
@ManyToMany
|
||||
private Set<Role> roles;
|
||||
|
||||
@OneToOne(mappedBy = "user")
|
||||
private Account account;
|
||||
|
||||
public String toString() {
|
||||
return "{user:" + oid + " name:" + name + "}";
|
||||
}
|
||||
|
||||
public long getOid() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public void setOid(long oid) {
|
||||
this.oid = oid;
|
||||
}
|
||||
|
||||
public Set<Role> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(Set<Role> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Account getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(Account account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.example;
|
||||
|
||||
/**
|
||||
* The Interface UserService.
|
||||
*/
|
||||
public interface UserService {
|
||||
|
||||
void save(User user);
|
||||
|
||||
User find(long id);
|
||||
|
||||
User findNoCurrentTransaction(long id);
|
||||
|
||||
void nonTransactional();
|
||||
|
||||
void batchInsert();
|
||||
|
||||
void requiresNew();
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package org.example;
|
||||
|
||||
import io.ebean.Database;
|
||||
import io.ebean.Transaction;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The Class UserServiceImpl.
|
||||
*
|
||||
* @author E Mc Greal
|
||||
* @since 18.05.2009
|
||||
*/
|
||||
public class UserServiceImpl implements UserService, ApplicationContextAware {
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* The ebean server.
|
||||
*/
|
||||
@Autowired
|
||||
private Database ebeanServer;
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
||||
public void save(User user) {
|
||||
ebeanServer.save(user);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true, propagation = Propagation.REQUIRED)
|
||||
public User find(long id) {
|
||||
return ebeanServer.find(User.class, id);
|
||||
}
|
||||
|
||||
public void nonTransactional() {
|
||||
ebeanServer.currentTransaction();
|
||||
}
|
||||
|
||||
public User findNoCurrentTransaction(long id) {
|
||||
return ebeanServer.find(User.class, id);
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public void batchInsert() {
|
||||
|
||||
List<User> users = new ArrayList<>();
|
||||
for (int i = 0; i < 25; i++) {
|
||||
User user = new User();
|
||||
user.setName("user" + i);
|
||||
users.add(user);
|
||||
}
|
||||
|
||||
System.out.println("---------before batch-------");
|
||||
|
||||
Transaction tx = ebeanServer.currentTransaction();
|
||||
tx.setBatchSize(20);
|
||||
ebeanServer.saveAll(users);
|
||||
|
||||
System.out.println("---------after batch-------");
|
||||
|
||||
applicationContext.getBean(UserService.class).requiresNew();
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public void requiresNew() {
|
||||
User user = new User();
|
||||
user.setName("user_x0");
|
||||
user.insert();
|
||||
//ebeanServer.save(user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the ebean server.
|
||||
*/
|
||||
public Database getEbeanServer() {
|
||||
return ebeanServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ebean server.
|
||||
*/
|
||||
public void setEbeanServer(Database ebeanServer) {
|
||||
this.ebeanServer = ebeanServer;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
||||
|
||||
<!-- Default abstract Ebean Server configuration -->
|
||||
<bean id="defaultEbeanServerConfig" class="io.ebean.config.DatabaseConfig" abstract="true">
|
||||
<property name="externalTransactionManager">
|
||||
<bean class="io.ebean.spring.txn.SpringJdbcTransactionManager"/>
|
||||
</property>
|
||||
<property name="namingConvention">
|
||||
<bean class="io.ebean.config.UnderscoreNamingConvention"/>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
||||
|
||||
<import resource="classpath:default-ebean-server.xml"/>
|
||||
|
||||
<!-- Transaktionen via Annotation use Springs @Transactional -->
|
||||
<tx:annotation-driven transaction-manager="transactionManager" />
|
||||
<context:annotation-config />
|
||||
|
||||
<bean id="dataSource" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
|
||||
<constructor-arg>
|
||||
<bean class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
|
||||
<property name="driverClass" value="org.h2.Driver" />
|
||||
<property name="url"
|
||||
value="jdbc:h2:mem:ebean-testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false" />
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<!-- Transaction Manager -->
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
<bean id="serverConfig" parent="defaultEbeanServerConfig">
|
||||
<property name="name" value="test"/>
|
||||
<property name="classes">
|
||||
<list>
|
||||
<value>org.example.User</value>
|
||||
<value>org.example.Role</value>
|
||||
<value>org.example.Account</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
|
||||
<property name="ddlGenerate" value="true"/>
|
||||
<property name="ddlRun" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- Ebean server -->
|
||||
<bean id="ebeanServer" class="org.example.EbeanServerFactoryBean">
|
||||
<property name="serverConfig" ref="serverConfig"/>
|
||||
</bean>
|
||||
|
||||
<bean id="userService" class="org.example.UserServiceImpl">
|
||||
<property name="ebeanServer" ref="ebeanServer"/>
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -0,0 +1,29 @@
|
||||
<configuration scan="true" scanPeriod="10 seconds">
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</root>
|
||||
|
||||
<logger name="io.ebean" level="INFO"/>
|
||||
|
||||
<!-- sql and transaction logging -->
|
||||
<logger name="io.ebean.SQL" level="TRACE"/>
|
||||
<logger name="io.ebean.TXN" level="TRACE"/>
|
||||
<logger name="io.ebean.SUM" level="TRACE"/>
|
||||
<logger name="io.ebean.DDL" level="TRACE"/>
|
||||
|
||||
<!-- l2 cache logging -->
|
||||
<logger name="io.ebean.cache.QUERY" level="TRACE"/>
|
||||
<logger name="io.ebean.cache.BEAN" level="TRACE"/>
|
||||
<logger name="io.ebean.cache.COLL" level="TRACE"/>
|
||||
<logger name="io.ebean.cache.NATKEY" level="TRACE"/>
|
||||
|
||||
<!-- elasticSearch query logging -->
|
||||
<!--<logger name="io.ebean.ELA" level="TRACE"/>-->
|
||||
|
||||
</configuration>
|
||||
+8
-8
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean test</name>
|
||||
@@ -28,20 +28,20 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -118,28 +118,28 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-joda-time</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-jsonnode</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-mapper</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -111,8 +111,8 @@ public class PlatformNoGeneratedKeysTest {
|
||||
config.setRegister(false);
|
||||
config.setDdlGenerate(true);
|
||||
config.setDdlRun(true);
|
||||
config.getClasses().add(EBasicVer.class);
|
||||
config.getClasses().add(BasicDraftableBean.class);
|
||||
config.addClass(EBasicVer.class);
|
||||
config.addClass(BasicDraftableBean.class);
|
||||
config.loadFromProperties(); // trigger auto config for H2 1.x
|
||||
|
||||
return DatabaseFactory.create(config);
|
||||
|
||||
@@ -3,9 +3,9 @@ package io.ebean.xtest.config;
|
||||
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.xtest.ForPlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.xtest.ForPlatform;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
@@ -36,7 +36,7 @@ public class ServerConfigSqlServerTest {
|
||||
|
||||
config.setDefaultServer(false);
|
||||
config.setRegister(false);
|
||||
config.getClasses().add(EBasicVer.class);
|
||||
config.addClass(EBasicVer.class);
|
||||
|
||||
Database sqlServer = DatabaseFactory.create(config);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ServerConfigSqlServerTest {
|
||||
config.setDdlGenerate(true);
|
||||
config.setDdlRun(true);
|
||||
config.loadFromProperties(props);
|
||||
config.getClasses().add(EBasicVer.class);
|
||||
config.addClass(EBasicVer.class);
|
||||
|
||||
Database sqlServer = DatabaseFactory.create(config);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ServerConfigSqlServerTest {
|
||||
config.setName(name); // match dataSource
|
||||
config.setDatabasePlatformName("sqlserver16");
|
||||
config.loadFromProperties(props);
|
||||
config.getClasses().add(EBasicVer.class);
|
||||
config.addClass(EBasicVer.class);
|
||||
|
||||
Database sqlServer = DatabaseFactory.create(config);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.ebean.xtest.event;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
@@ -8,6 +7,7 @@ import io.ebean.common.BeanList;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.event.BeanFindController;
|
||||
import io.ebean.event.BeanQueryRequest;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.example.ModUuidGenerator;
|
||||
import org.tests.model.basic.EBasic;
|
||||
@@ -37,8 +37,8 @@ public class BeanFindControllerTest extends BaseTestCase {
|
||||
config.setRegister(false);
|
||||
config.setDefaultServer(false);
|
||||
config.add(new ModUuidGenerator());
|
||||
config.getClasses().add(EBasic.class);
|
||||
config.getClasses().add(ECustomId.class);
|
||||
config.addClass(EBasic.class);
|
||||
config.addClass(ECustomId.class);
|
||||
|
||||
EBasicFindController findController = new EBasicFindController();
|
||||
config.getFindControllers().add(findController);
|
||||
@@ -180,9 +180,9 @@ public class BeanFindControllerTest extends BaseTestCase {
|
||||
config.setRegister(false);
|
||||
config.setDefaultServer(false);
|
||||
config.add(new ModUuidGenerator());
|
||||
config.getClasses().add(FindControllerMain.class);
|
||||
config.getClasses().add(SoftRefA.class);
|
||||
config.getClasses().add(SoftRefB.class);
|
||||
config.addClass(FindControllerMain.class);
|
||||
config.addClass(SoftRefA.class);
|
||||
config.addClass(SoftRefB.class);
|
||||
|
||||
config.getFindControllers().add(new TestBeanFindController());
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ package io.ebean.xtest.event;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.ValuePair;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.event.BeanDeleteIdRequest;
|
||||
import io.ebean.event.BeanPersistAdapter;
|
||||
@@ -14,7 +13,9 @@ import org.tests.model.basic.EBasicVer;
|
||||
import org.tests.model.basic.UTDetail;
|
||||
import org.tests.model.basic.UTMaster;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -148,9 +149,9 @@ public class BeanPersistControllerTest {
|
||||
|
||||
config.setRegister(false);
|
||||
config.setDefaultServer(false);
|
||||
config.getClasses().add(EBasicVer.class);
|
||||
config.getClasses().add(UTMaster.class);
|
||||
config.getClasses().add(UTDetail.class);
|
||||
config.addClass(EBasicVer.class);
|
||||
config.addClass(UTMaster.class);
|
||||
config.addClass(UTDetail.class);
|
||||
|
||||
config.add(persistAdapter);
|
||||
return DatabaseFactory.create(config);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package io.ebean.xtest.event;
|
||||
|
||||
|
||||
import io.ebean.*;
|
||||
import io.ebean.BeanState;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.event.BeanPostLoad;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
@@ -55,7 +58,7 @@ public class BeanPostLoadTest extends BaseTestCase {
|
||||
|
||||
config.setRegister(false);
|
||||
config.setDefaultServer(false);
|
||||
config.getClasses().add(EBasicVer.class);
|
||||
config.addClass(EBasicVer.class);
|
||||
|
||||
config.add(postLoad);
|
||||
|
||||
|
||||
+9
-6
@@ -1,10 +1,13 @@
|
||||
package io.ebean.xtest.internal.server.transaction;
|
||||
|
||||
import io.ebean.*;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.xtest.ForPlatform;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.DatabaseFactory;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.xtest.ForPlatform;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.EBasicVer;
|
||||
@@ -139,9 +142,9 @@ public class DefaultTransactionThreadLocalTest extends BaseTestCase {
|
||||
|
||||
config.setRegister(false);
|
||||
config.setDefaultServer(false);
|
||||
config.getClasses().add(EBasicVer.class);
|
||||
config.getClasses().add(UTMaster.class);
|
||||
config.getClasses().add(UTDetail.class);
|
||||
config.addClass(EBasicVer.class);
|
||||
config.addClass(UTMaster.class);
|
||||
config.addClass(UTDetail.class);
|
||||
|
||||
return DatabaseFactory.create(config);
|
||||
}
|
||||
|
||||
@@ -130,9 +130,9 @@ class MultiTenantPartitionTest extends BaseTestCase {
|
||||
config.setCurrentTenantProvider(new CurrentTenant());
|
||||
config.setTenantMode(TenantMode.PARTITION);
|
||||
|
||||
config.getClasses().add(MtTenant.class);
|
||||
config.getClasses().add(MtContent.class);
|
||||
config.getClasses().add(MtNone.class);
|
||||
config.addClass(MtTenant.class);
|
||||
config.addClass(MtContent.class);
|
||||
config.addClass(MtNone.class);
|
||||
|
||||
return DatabaseFactory.create(config);
|
||||
}
|
||||
|
||||
+9
-7
@@ -1,8 +1,8 @@
|
||||
package org.tests.model.elementcollection;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.test.LoggedSql;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
@@ -50,15 +50,17 @@ class TestElementCollectionBasicSet extends BaseTestCase {
|
||||
|
||||
Set<String> phoneNumbers0 = found.get(0).getPhoneNumbers();
|
||||
Set<String> phoneNumbers1 = found.get(1).getPhoneNumbers();
|
||||
phoneNumbers0.size();
|
||||
|
||||
assertThat(phoneNumbers0).containsExactlyInAnyOrder("021 1234", "021 4321");
|
||||
assertThat(phoneNumbers1).containsExactlyInAnyOrder("09 1234", "09 4321", "09 9876");
|
||||
|
||||
sql = LoggedSql.collect();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql).hasSize(1);
|
||||
assertSql(sql.get(0)).contains("select t0.id, t0.name, t0.version from ecs_person t0 where");
|
||||
assertSql(sql.get(1)).contains("select t0.ecs_person_id, t0.phone from ecs_person_phone t0 where");
|
||||
|
||||
phoneNumbers0.size(); // invoke lazy loading
|
||||
sql = LoggedSql.collect();
|
||||
assertThat(sql).hasSize(1);
|
||||
assertThat(phoneNumbers0).containsExactlyInAnyOrder("021 1234", "021 4321");
|
||||
assertThat(phoneNumbers1).containsExactlyInAnyOrder("09 1234", "09 4321", "09 9876");
|
||||
assertSql(sql.get(0)).contains("select t0.ecs_person_id, t0.phone from ecs_person_phone t0 where");
|
||||
|
||||
List<EcsPerson> found2 =
|
||||
DB.find(EcsPerson.class)
|
||||
|
||||
+10
-1
@@ -1,7 +1,8 @@
|
||||
package org.tests.model.elementcollection;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.test.LoggedSql;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -32,6 +33,7 @@ public class TestElementCollectionCascade extends BaseTestCase {
|
||||
|
||||
Map<String, Set<String>> childVals = new LinkedHashMap<>();
|
||||
|
||||
LoggedSql.start();
|
||||
final EcsmParent foundParent = DB.find(EcsmParent.class, parent.getId());
|
||||
final List<EcsmChild> children1 = foundParent.getChildren();
|
||||
for (EcsmChild ecsmOne : children1) {
|
||||
@@ -39,6 +41,13 @@ public class TestElementCollectionCascade extends BaseTestCase {
|
||||
values.size();
|
||||
childVals.put(ecsmOne.getName(), values);
|
||||
}
|
||||
List<String> sql = LoggedSql.stop();
|
||||
assertThat(sql).hasSize(3);
|
||||
assertThat(sql.get(0)).contains("select t0.id, t0.name, t0.version from ecsm_parent t0 where t0.id = ?");
|
||||
if (!isPostgresCompatible()) {
|
||||
assertThat(sql.get(1)).contains("select t0.ecsm_parent_id, t0.one_id, t0.name, t0.version from ecsm_child t0 where (t0.ecsm_parent_id) in (?)");
|
||||
assertThat(sql.get(2)).contains("select t0.host_id, t0.value from ecsm_values t0 where (t0.host_id) in (?,?)");
|
||||
}
|
||||
|
||||
Set<String> vals0 = childVals.get("c0");
|
||||
assertThat(vals0).hasSize(22);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.tests.rawsql;
|
||||
|
||||
import io.ebean.*;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.xtest.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.test.LoggedSql;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.xtest.IgnorePlatform;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
@@ -21,7 +21,6 @@ public class TestRawSqlOrmQuery extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
RawSql rawSql = RawSqlBuilder.parse("select r.id, r.name from o_customer r ")
|
||||
@@ -42,10 +41,37 @@ public class TestRawSqlOrmQuery extends BaseTestCase {
|
||||
LoggedSql.start();
|
||||
assertThat(query.findCount()).isEqualTo(list.size());
|
||||
List<String>sql = LoggedSql.stop();
|
||||
assertThat(sql.get(0)).startsWith("select count(*) from ( select r.id, r.name from o_customer r");
|
||||
assertThat(sql.get(0)).startsWith("select count(*) from ( select r.id from o_customer r");
|
||||
assertThat(sql.get(0)).doesNotContain("order by");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindCount_when_idPropertyNotMapped() {
|
||||
ResetBasicData.reset();
|
||||
|
||||
// mapping does not include the id column & property
|
||||
RawSql rawSql = RawSqlBuilder.parse("select r.name, r.status from o_customer r ")
|
||||
.columnMapping("r.name", "name")
|
||||
.columnMapping("r.status", "status")
|
||||
.create();
|
||||
|
||||
Query<Customer> query = DB.find(Customer.class);
|
||||
query.setRawSql(rawSql);
|
||||
query.where().ilike("name", "r%").orderBy("name");
|
||||
|
||||
LoggedSql.start();
|
||||
List<Customer> list = query.findList();
|
||||
assertNotNull(list);
|
||||
|
||||
// check also select count(*)
|
||||
assertThat(query.findCount()).isEqualTo(list.size());
|
||||
List<String>sql = LoggedSql.stop();
|
||||
assertThat(sql.get(0)).startsWith("select r.name, r.status from o_customer r where lower(r.name) like ?");
|
||||
assertThat(sql.get(0)).contains(" order by r.name");
|
||||
assertThat(sql.get(1)).startsWith("select count(*) from ( select r.name, r.status from o_customer r where lower(r.name) like ?");
|
||||
assertThat(sql.get(1)).doesNotContain("order by");
|
||||
}
|
||||
|
||||
@Test
|
||||
@IgnorePlatform({Platform.MYSQL, Platform.MARIADB, Platform.SQLSERVER})
|
||||
public void test_upperCaseSql() {
|
||||
@@ -158,7 +184,7 @@ public class TestRawSqlOrmQuery extends BaseTestCase {
|
||||
LoggedSql.start();
|
||||
query.findCount();
|
||||
List<String>sql = LoggedSql.stop();
|
||||
assertThat(sql.get(0)).startsWith("select count(*) from ( select o.id, o.order_date, o.ship_date from o_order o");
|
||||
assertThat(sql.get(0)).startsWith("select count(*) from ( select o.id from o_order o");
|
||||
assertThat(sql.get(0)).doesNotContain("order by");
|
||||
}
|
||||
|
||||
@@ -193,7 +219,7 @@ public class TestRawSqlOrmQuery extends BaseTestCase {
|
||||
LoggedSql.start();
|
||||
query.findCount();
|
||||
List<String>sql = LoggedSql.stop();
|
||||
assertThat(sql.get(0)).startsWith("select count(*) from ( select o.id, o.order_date, o.ship_date from o_order o");
|
||||
assertThat(sql.get(0)).startsWith("select count(*) from ( select o.id from o_order o");
|
||||
assertThat(sql.get(0)).doesNotContain("order by");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.tests.rawsql;
|
||||
|
||||
import io.ebean.DB;
|
||||
import io.ebean.FetchGroup;
|
||||
import io.ebean.RawSql;
|
||||
import io.ebean.RawSqlBuilder;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.tests.rawsql.transport.QuerySumResponse;
|
||||
import org.tests.rawsql.transport.SampleReport;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TestRawSqlQuerySelect extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testRawSQL() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
RawSql rawSql = RawSqlBuilder.parse("select id, name, anniversary, city from (select c.id, c.name, c.anniversary, a.city from o_customer c left join o_address a ON a.id = c.billing_address_id order by c.id) w").create();
|
||||
String sumSql = "COUNT(1)::BIGINT AS count, SUM(id)::DOUBLE PRECISION AS sum";
|
||||
|
||||
var query = DB.find(SampleReport.class);
|
||||
query.setRawSql(rawSql);
|
||||
query.setMaxRows(10);
|
||||
List<SampleReport> list = query.findList();
|
||||
Assertions.assertNotNull(list);
|
||||
Assertions.assertTrue(!list.isEmpty() && list.size() < 11);
|
||||
|
||||
var countSum = DB.find(SampleReport.class)
|
||||
.setRawSql(rawSql)
|
||||
//.select(sumSql)
|
||||
.select(FetchGroup.of(SampleReport.class, sumSql))
|
||||
.setMaxRows(10)
|
||||
.asDto(QuerySumResponse.class)
|
||||
.findOne();
|
||||
Assertions.assertInstanceOf(QuerySumResponse.class, countSum);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.tests.rawsql.transport;
|
||||
|
||||
public class QuerySumResponse {
|
||||
private long count;
|
||||
private Double sum;
|
||||
|
||||
public QuerySumResponse() {
|
||||
}
|
||||
|
||||
public QuerySumResponse(long count, Double sum) {
|
||||
this.count = count;
|
||||
this.sum = sum;
|
||||
}
|
||||
|
||||
public long getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Double getSum() {
|
||||
return sum;
|
||||
}
|
||||
|
||||
public void setSum(Double sum) {
|
||||
this.sum = sum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.tests.rawsql.transport;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import java.sql.Date;
|
||||
|
||||
@Entity
|
||||
public class SampleReport {
|
||||
Long id;
|
||||
String name;
|
||||
Date anniversary;
|
||||
String city;
|
||||
}
|
||||
+13
-13
@@ -1,24 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## adjust pom dependencies
|
||||
find . -type f -name 'pom.xml' -exec sed -i'' -e 's|<!-- JAKARTA-DEPENDENCY-START -->|<!-- JAKARTA-DEPENDENCY-START ___|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i'' -e 's|<!-- JAKARTA-DEPENDENCY-END -->|____ JAKARTA-DEPENDENCY-END -->|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i'' -e 's|<!-- JAVAX-DEPENDENCY-START ___|<!-- JAVAX-DEPENDENCY-START -->|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i'' -e 's|____ JAVAX-DEPENDENCY-END -->|<!-- JAVAX-DEPENDENCY-END -->|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<!-- JAKARTA-DEPENDENCY-START -->|<!-- JAKARTA-DEPENDENCY-START ___|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<!-- JAKARTA-DEPENDENCY-END -->|____ JAKARTA-DEPENDENCY-END -->|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<!-- JAVAX-DEPENDENCY-START ___|<!-- JAVAX-DEPENDENCY-START -->|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|____ JAVAX-DEPENDENCY-END -->|<!-- JAVAX-DEPENDENCY-END -->|g' {} +
|
||||
|
||||
sed -i'' -e 's|artifactId>jakarta-persistence-api|artifactId>persistence-api|g' ebean-api/pom.xml ebean-bom/pom.xml
|
||||
sed -i '' -e 's|artifactId>jakarta-persistence-api|artifactId>persistence-api|g' ebean-api/pom.xml ebean-bom/pom.xml
|
||||
|
||||
## adjust module-info
|
||||
sed -i'' -e 's| jakarta\.persistence\.api| persistence\.api|g' ebean-api/src/main/java/module-info.java
|
||||
sed -i'' -e 's| jakarta\.servlet;| javax\.servlet\.api;|g' ebean-api/src/main/java/module-info.java
|
||||
sed -i '' -e 's| jakarta\.persistence\.api| persistence\.api|g' ebean-api/src/main/java/module-info.java
|
||||
sed -i '' -e 's| jakarta\.servlet;| javax\.servlet\.api;|g' ebean-api/src/main/java/module-info.java
|
||||
|
||||
find . -type f -name 'module-info.java' -exec sed -i'' -e 's|jakarta\.xml\.bind|java\.xml\.bind|g' {} +
|
||||
find . -type f -name 'module-info.java' -exec sed -i '' -e 's|jakarta\.xml\.bind|java\.xml\.bind|g' {} +
|
||||
|
||||
## adjust code
|
||||
find ebean-api/src/main/java/io/ebean/event -type f -name '*.java' -exec sed -i'' -e 's|jakarta\.servlet|javax\.servlet|g' {} +
|
||||
find ebean-api/src/main/java/io/ebean/event -type f -name '*.java' -exec sed -i '' -e 's|jakarta\.servlet|javax\.servlet|g' {} +
|
||||
|
||||
find . -type f -name '*.java' -exec sed -i'' -e 's|jakarta\.persistence\.|javax\.persistence\.|g' {} +
|
||||
find . -type f -name '*.kt' -exec sed -i'' -e 's|jakarta\.persistence\.|javax\.persistence\.|g' {} +
|
||||
find . -type f -name '*.java' -exec sed -i'' -e 's|jakarta\.xml\.bind|javax\.xml\.bind|g' {} +
|
||||
find . -type f -name '*.kt' -exec sed -i'' -e 's|jakarta\.xml\.bind|javax\.xml\.bind|g' {} +
|
||||
find . -type f -name '*.java' -exec sed -i '' -e 's|jakarta\.persistence\.|javax\.persistence\.|g' {} +
|
||||
find . -type f -name '*.kt' -exec sed -i '' -e 's|jakarta\.persistence\.|javax\.persistence\.|g' {} +
|
||||
find . -type f -name '*.java' -exec sed -i '' -e 's|jakarta\.xml\.bind|javax\.xml\.bind|g' {} +
|
||||
find . -type f -name '*.kt' -exec sed -i '' -e 's|jakarta\.xml\.bind|javax\.xml\.bind|g' {} +
|
||||
|
||||
|
||||
+13
-13
@@ -1,24 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## adjust pom dependencies
|
||||
find . -type f -name 'pom.xml' -exec sed -i'' -e 's|<!-- JAVAX-DEPENDENCY-START -->|<!-- JAVAX-DEPENDENCY-START ___|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i'' -e 's|<!-- JAVAX-DEPENDENCY-END -->|____ JAVAX-DEPENDENCY-END -->|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i'' -e 's|<!-- JAKARTA-DEPENDENCY-START ___|<!-- JAKARTA-DEPENDENCY-START -->|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i'' -e 's|____ JAKARTA-DEPENDENCY-END -->|<!-- JAKARTA-DEPENDENCY-END -->|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<!-- JAVAX-DEPENDENCY-START -->|<!-- JAVAX-DEPENDENCY-START ___|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<!-- JAVAX-DEPENDENCY-END -->|____ JAVAX-DEPENDENCY-END -->|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<!-- JAKARTA-DEPENDENCY-START ___|<!-- JAKARTA-DEPENDENCY-START -->|g' {} +
|
||||
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|____ JAKARTA-DEPENDENCY-END -->|<!-- JAKARTA-DEPENDENCY-END -->|g' {} +
|
||||
|
||||
sed -i'' -e 's|artifactId>persistence-api|artifactId>jakarta-persistence-api|g' ebean-api/pom.xml ebean-bom/pom.xml
|
||||
sed -i '' -e 's|artifactId>persistence-api|artifactId>jakarta-persistence-api|g' ebean-api/pom.xml ebean-bom/pom.xml
|
||||
|
||||
## adjust module-info
|
||||
sed -i'' -e 's| persistence\.api| jakarta\.persistence\.api|g' ebean-api/src/main/java/module-info.java
|
||||
sed -i'' -e 's| javax\.servlet\.api| jakarta\.servlet|g' ebean-api/src/main/java/module-info.java
|
||||
sed -i '' -e 's| persistence\.api| jakarta\.persistence\.api|g' ebean-api/src/main/java/module-info.java
|
||||
sed -i '' -e 's| javax\.servlet\.api| jakarta\.servlet|g' ebean-api/src/main/java/module-info.java
|
||||
|
||||
find . -type f -name 'module-info.java' -exec sed -i'' -e 's|java\.xml\.bind|jakarta\.xml\.bind|g' {} +
|
||||
find . -type f -name 'module-info.java' -exec sed -i '' -e 's|java\.xml\.bind|jakarta\.xml\.bind|g' {} +
|
||||
|
||||
## adjust code
|
||||
find ebean-api/src/main/java/io/ebean/event -type f -name '*.java' -exec sed -i'' -e 's|javax\.servlet|jakarta\.servlet|g' {} +
|
||||
find ebean-api/src/main/java/io/ebean/event -type f -name '*.java' -exec sed -i '' -e 's|javax\.servlet|jakarta\.servlet|g' {} +
|
||||
|
||||
find . -type f -name '*.java' -exec sed -i'' -e 's|javax\.persistence\.|jakarta\.persistence\.|g' {} +
|
||||
find . -type f -name '*.kt' -exec sed -i'' -e 's|javax\.persistence\.|jakarta\.persistence\.|g' {} +
|
||||
find . -type f -name '*.java' -exec sed -i'' -e 's|javax\.xml\.bind|jakarta\.xml\.bind|g' {} +
|
||||
find . -type f -name '*.kt' -exec sed -i'' -e 's|javax\.xml\.bind|jakarta\.xml\.bind|g' {} +
|
||||
find . -type f -name '*.java' -exec sed -i '' -e 's|javax\.persistence\.|jakarta\.persistence\.|g' {} +
|
||||
find . -type f -name '*.kt' -exec sed -i '' -e 's|javax\.persistence\.|jakarta\.persistence\.|g' {} +
|
||||
find . -type f -name '*.java' -exec sed -i '' -e 's|javax\.xml\.bind|jakarta\.xml\.bind|g' {} +
|
||||
find . -type f -name '*.kt' -exec sed -i '' -e 's|javax\.xml\.bind|jakarta\.xml\.bind|g' {} +
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
</parent>
|
||||
|
||||
<name>kotlin querybean generator</name>
|
||||
@@ -12,7 +12,7 @@
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
|
||||
<properties>
|
||||
<kotlin.version>1.6.20</kotlin.version>
|
||||
<kotlin.version>1.8.10</kotlin.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -64,14 +64,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.13.2</version>
|
||||
<version>13.15.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -100,37 +100,17 @@
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-kapt</id>
|
||||
<goals>
|
||||
<goal>test-kapt</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirs>
|
||||
<sourceDir>src/test/kotlin</sourceDir>
|
||||
</sourceDirs>
|
||||
<annotationProcessorPaths>
|
||||
<annotationProcessorPath>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>13.13.0</version>
|
||||
</annotationProcessorPath>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirs>
|
||||
<source>src/main/java</source>
|
||||
<source>target/generated-sources/kapt/test</source>
|
||||
<source>target/generated-sources/kaptKotlin/test</source>
|
||||
</sourceDirs>
|
||||
</configuration>
|
||||
<!-- <configuration>-->
|
||||
<!-- <sourceDirs>-->
|
||||
<!-- <source>src/main/java</source>-->
|
||||
<!-- </sourceDirs>-->
|
||||
<!-- </configuration>-->
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
|
||||
@@ -7,6 +7,7 @@ interface Constants {
|
||||
String GENERATED = "io.ebean.typequery.Generated";
|
||||
|
||||
String MAPPED_SUPERCLASS = "javax.persistence.MappedSuperclass";
|
||||
String DISCRIMINATOR_VALUE = "javax.persistence.DiscriminatorValue";
|
||||
String INHERITANCE = "javax.persistence.Inheritance";
|
||||
String ENTITY = "javax.persistence.Entity";
|
||||
String EMBEDDABLE = "javax.persistence.Embeddable";
|
||||
@@ -19,6 +20,7 @@ interface Constants {
|
||||
String DBNAME = "io.ebean.annotation.DbName";
|
||||
|
||||
String TQROOTBEAN = "io.ebean.typequery.TQRootBean";
|
||||
String TQASSOC = "io.ebean.typequery.TQAssoc";
|
||||
String TQASSOCBEAN = "io.ebean.typequery.TQAssocBean";
|
||||
String TQPROPERTY = "io.ebean.typequery.TQProperty";
|
||||
String TYPEQUERYBEAN = "io.ebean.typequery.TypeQueryBean";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user