mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Compare commits
49
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e3d39ac1a | ||
|
|
ce19837649 | ||
|
|
11e20edb59 | ||
|
|
88b6a60feb | ||
|
|
43dac07d5b | ||
|
|
04434215d0 | ||
|
|
52e6c0c625 | ||
|
|
745fbe883e | ||
|
|
283e0b66fa | ||
|
|
523deb20f4 | ||
|
|
23d52ca192 | ||
|
|
d20d276d56 | ||
|
|
5b92ac6e02 | ||
|
|
6392f90f32 | ||
|
|
bb8f3831b8 | ||
|
|
4bb43814b7 | ||
|
|
95c1554642 | ||
|
|
2cd59c5166 | ||
|
|
afdb1df7ce | ||
|
|
fa6fdf124d | ||
|
|
1e044f03ed | ||
|
|
7989fcd6ce | ||
|
|
a5256df6f2 | ||
|
|
fa11dac2b2 | ||
|
|
c40ca2fad7 | ||
|
|
5b9359f509 | ||
|
|
403556d8b2 | ||
|
|
06ad2edfc1 | ||
|
|
16e2489ba0 | ||
|
|
162b3449e8 | ||
|
|
8c3ed6996e | ||
|
|
583c5f74eb | ||
|
|
ab047996d2 | ||
|
|
239f87bb5d | ||
|
|
5be3b7717c | ||
|
|
e29d83a379 | ||
|
|
8301fd5e74 | ||
|
|
3e3647816d | ||
|
|
9aa7ae79e2 | ||
|
|
168c940b79 | ||
|
|
1ee18a1823 | ||
|
|
c02ab7340c | ||
|
|
c67773505d | ||
|
|
9c354919e5 | ||
|
|
c8be59fd95 | ||
|
|
d1a40b4739 | ||
|
|
bb9cfe9d0f | ||
|
|
ede2ad4d54 | ||
|
|
1060503fe1 |
@@ -36,5 +36,5 @@ jobs:
|
||||
# - name: Maven single test
|
||||
# run: mvn --batch-mode clean verify -Dtest="io.ebeaninternal.server.core.DefaultServer_getReferenceTest" -DfailIfNoTests=false
|
||||
- name: Build with Maven
|
||||
run: mvn clean package
|
||||
run: mvn -T 8 clean test
|
||||
|
||||
|
||||
@@ -35,4 +35,4 @@ jobs:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: db2
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-db2.properties
|
||||
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-db2.properties
|
||||
|
||||
@@ -37,5 +37,5 @@ jobs:
|
||||
- name: Maven version
|
||||
run: mvn --version
|
||||
- name: H2Database
|
||||
run: mvn clean package
|
||||
run: mvn -T 8 clean package
|
||||
|
||||
|
||||
@@ -35,5 +35,5 @@ jobs:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: Build with Maven
|
||||
run: mvn package
|
||||
run: mvn -T 8 test
|
||||
|
||||
|
||||
@@ -39,5 +39,5 @@ jobs:
|
||||
- name: Maven version
|
||||
run: mvn --version
|
||||
- name: Build with Maven
|
||||
run: mvn package
|
||||
run: mvn -T 8 test
|
||||
|
||||
|
||||
@@ -35,4 +35,4 @@ jobs:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: mariadb 10.6
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-mariadb.properties
|
||||
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-mariadb.properties
|
||||
|
||||
@@ -35,4 +35,4 @@ jobs:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: mysql
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-mysql.properties
|
||||
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-mysql.properties
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
name: Oracle18
|
||||
name: Oracle
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -35,4 +35,4 @@ jobs:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: oracle
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-oracle.properties
|
||||
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-oracle.properties
|
||||
@@ -35,4 +35,4 @@ jobs:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: postgres
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-postgres.properties
|
||||
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-postgres.properties
|
||||
|
||||
@@ -35,4 +35,4 @@ jobs:
|
||||
~/.m2
|
||||
key: build-${{ env.cache-name }}
|
||||
- name: sqlserver 2017
|
||||
run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver17.properties
|
||||
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-sqlserver17.properties
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/postgres.yml)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/mysql.yml)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/mariadb.yml)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/oracle.yml)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/sqlserver.yml)
|
||||
[](https://github.com/ebean-orm/ebean/actions/workflows/yugabyte.yml)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-clickhouse</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-clickhouse</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-cockroach</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-db2</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-db2</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-h2</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-hana</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-hana</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-mariadb</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mariadb</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-mysql</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mysql</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-nuodb</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-nuodb</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-oracle</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-oracle</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-postgres</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-sqlite</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlite</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-sqlserver</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-yugabyte</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean (all platforms)</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>composites</artifactId>
|
||||
|
||||
+22
-3
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
@@ -27,7 +27,7 @@
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-config</artifactId>
|
||||
<version>2.0</version>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
@@ -37,7 +37,7 @@
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>avaje-lang</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -103,4 +103,23 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>**/ebean-maven-version.txt</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
<excludes>
|
||||
<exclude>**/ebean-maven-version.txt</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.Optional;
|
||||
* </p>
|
||||
* <pre>{@code
|
||||
*
|
||||
* @Component
|
||||
* public class CustomerFinder extends BeanFinder<Long,Customer> {
|
||||
*
|
||||
* @Inject
|
||||
@@ -26,29 +27,37 @@ import java.util.Optional;
|
||||
*
|
||||
* @param <I> The ID type
|
||||
* @param <T> The Bean type
|
||||
*
|
||||
* @see BeanRepository
|
||||
*/
|
||||
@NonNullApi
|
||||
public abstract class BeanFinder<I,T> {
|
||||
|
||||
/**
|
||||
* Migrate to using database rather than server.
|
||||
*/
|
||||
@Deprecated
|
||||
protected final Database server;
|
||||
protected final Database database;
|
||||
protected final Class<T> type;
|
||||
|
||||
/**
|
||||
* Create with the given bean type and Database instance.
|
||||
*
|
||||
* @param type The bean type
|
||||
* @param server The Database instance typically created via Spring factory or equivalent.
|
||||
* @param database The Database instance typically created via Spring factory or equivalent.
|
||||
*/
|
||||
protected BeanFinder(Class<T> type, Database server) {
|
||||
protected BeanFinder(Class<T> type, Database database) {
|
||||
this.type = type;
|
||||
this.server = server;
|
||||
this.database = database;
|
||||
this.server = database;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Database to use.
|
||||
*/
|
||||
public Database db() {
|
||||
return server;
|
||||
return database;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,10 +79,10 @@ public abstract class BeanFinder<I,T> {
|
||||
* <p>
|
||||
* This is equivalent to {@link DB#byName(String)}
|
||||
*
|
||||
* @param server The name of the Database. If this is null then the default Database is returned.
|
||||
* @param name The name of the Database. If this is null then the default Database is returned.
|
||||
*/
|
||||
public Database db(String server) {
|
||||
return DB.byName(server);
|
||||
public Database db(String name) {
|
||||
return DB.byName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,11 +6,15 @@ import io.ebean.bean.EntityBean;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Provides finder functionality for use with "Dependency Injection style" use of Ebean.
|
||||
* Provides find and persist functionality for use with "Dependency Injection style" use of Ebean.
|
||||
* <p>
|
||||
* Extend the BeanRepository with additional finder and persisting methods as needed by the
|
||||
* application. The intention is to keep all the related logic together, for example, all the
|
||||
* persisting and finding logic for Customer would be in CustomerRepository.
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* @Repository
|
||||
* @Component
|
||||
* public class CustomerRepository extends BeanRepository<Long,Customer> {
|
||||
*
|
||||
* @Inject
|
||||
@@ -50,10 +54,10 @@ public abstract class BeanRepository<I, T> extends BeanFinder<I, T> {
|
||||
* }</pre>
|
||||
*
|
||||
* @param type The bean type
|
||||
* @param server The Database instance typically created via Spring factory or equivalent
|
||||
* @param database The Database instance typically created via Spring factory or equivalent
|
||||
*/
|
||||
protected BeanRepository(Class<T> type, Database server) {
|
||||
super(type, server);
|
||||
protected BeanRepository(Class<T> type, Database database) {
|
||||
super(type, database);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,8 +126,8 @@ public abstract class BeanRepository<I, T> extends BeanFinder<I, T> {
|
||||
/**
|
||||
* Save all the beans in the collection.
|
||||
*/
|
||||
public int saveAll(Collection<T> bean) {
|
||||
return db().saveAll(bean);
|
||||
public int saveAll(Collection<T> beans) {
|
||||
return db().saveAll(beans);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,8 +3,7 @@ package io.ebean;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.*;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
@@ -29,9 +28,11 @@ public final class EbeanVersion {
|
||||
|
||||
private static void readVersion() {
|
||||
try {
|
||||
try (InputStream in = ClassLoader.getSystemResourceAsStream("META-INF/maven/io.ebean/ebean-api/pom.properties")) {
|
||||
try (InputStream in = ClassLoader.getSystemResourceAsStream("META-INF/ebean-maven-version.txt")) {
|
||||
if (in != null) {
|
||||
version = readVersion(in);
|
||||
try (LineNumberReader reader = new LineNumberReader(new InputStreamReader(in))) {
|
||||
version = reader.readLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("ebean version: {}", version);
|
||||
@@ -88,7 +89,7 @@ public final class EbeanVersion {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ebean version (read from /META-INF/maven/io.ebean/ebean/pom.properties)
|
||||
* Returns the ebean version (read from META-INF/ebean-maven-version.txt)
|
||||
*/
|
||||
public static String getVersion() {
|
||||
return version;
|
||||
|
||||
@@ -383,6 +383,15 @@ public interface ExpressionList<T> {
|
||||
*/
|
||||
<A> List<A> findSingleAttributeList();
|
||||
|
||||
/**
|
||||
* Executes the query returning a set of values for a single property.
|
||||
*
|
||||
* This can be used to cache sets.
|
||||
*
|
||||
* @return a HashSet of values for the selegted property
|
||||
*/
|
||||
<A> Set<A> findSingleAttributeSet();
|
||||
|
||||
/**
|
||||
* Execute a query returning a single value of a single property/column.
|
||||
* <pre>{@code
|
||||
|
||||
@@ -368,6 +368,11 @@ public interface ExtendedServer {
|
||||
*/
|
||||
<A, T> List<A> findSingleAttributeList(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
* Execute the query returning a hashset of values for a single property.
|
||||
*/
|
||||
<A, T> Set<A> findSingleAttributeSet(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
* Execute the query returning at most one entity bean or null (if no matching
|
||||
* bean is found).
|
||||
|
||||
@@ -8,6 +8,9 @@ import java.util.List;
|
||||
* Intended to be used as a base class for 'Finder' implementations that can then
|
||||
* be injected or used as public static fields on the associated entity bean.
|
||||
* <p>
|
||||
* When using dependency injection {@link BeanRepository} and {@link BeanFinder}
|
||||
* are expected to be used rather than this Finder.
|
||||
* <p>
|
||||
* These 'finders' are a place to organise all the finder methods for that bean type
|
||||
* and specific finder methods are expected to be added (find by unique properties etc).
|
||||
* </p>
|
||||
@@ -54,6 +57,8 @@ import java.util.List;
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
* @see BeanRepository
|
||||
* @see BeanFinder
|
||||
*/
|
||||
@NonNullApi
|
||||
public class Finder<I, T> {
|
||||
|
||||
@@ -925,6 +925,11 @@ public interface Query<T> extends CancelableQuery {
|
||||
*/
|
||||
<A> List<A> findSingleAttributeList();
|
||||
|
||||
/**
|
||||
* Execute the query returning a hashset of values for a single property.
|
||||
*/
|
||||
<A> Set<A> findSingleAttributeSet();
|
||||
|
||||
/**
|
||||
* Execute a query returning a single value of a single property/column.
|
||||
* <p>
|
||||
|
||||
@@ -802,20 +802,6 @@ public class DatabasePlatform {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if partitions exist for the given table.
|
||||
*/
|
||||
public boolean tablePartitionsExist(Connection connection, String table) throws SQLException {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the SQL to create an initial partition for the given table.
|
||||
*/
|
||||
public String tablePartitionInit(String tableName, PartitionMode mode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes the like string for this DB-Platform
|
||||
*/
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
${project.version}
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
|
||||
<name>ebean autotune</name>
|
||||
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.ebean.tile:enhancement:13.6.0</tile>
|
||||
<tile>io.ebean.tile:enhancement:13.6.5</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
+1
@@ -143,6 +143,7 @@ public class BaseQueryTuner {
|
||||
switch (type) {
|
||||
case COUNT:
|
||||
case ATTRIBUTE:
|
||||
case ATTRIBUTE_SET:
|
||||
case ID_LIST:
|
||||
case UPDATE:
|
||||
case DELETE:
|
||||
|
||||
+15
-15
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
@@ -71,88 +71,88 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-xml</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -16,25 +16,24 @@ import java.sql.SQLException;
|
||||
* <p>
|
||||
* Scalar in the sense that the types are not compound types. Scalar types only
|
||||
* map to a single database column.
|
||||
* </p>
|
||||
* <p>
|
||||
* These types fall into two categories. Types that are mapped natively to JDBC
|
||||
* types and the rest. Types that map to native JDBC types do not require any
|
||||
* data type conversion to be persisted to the database. These are java types
|
||||
* that map via java.sql.Types.
|
||||
* </p>
|
||||
* <p>
|
||||
* Types that are not native to JDBC require some conversion. These include some
|
||||
* common java types such as java.util.Date, java.util.Calendar,
|
||||
* java.math.BigInteger.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note that Booleans may be native for some databases and require conversion on
|
||||
* other databases.
|
||||
* </p>
|
||||
*/
|
||||
public interface ScalarType<T> extends StringParser, StringFormatter, ScalarDataReader<T> {
|
||||
|
||||
/**
|
||||
* Return true for types that do mutation detection based on json content.
|
||||
*/
|
||||
default boolean isJsonMapper() {
|
||||
return false;
|
||||
}
|
||||
@@ -43,38 +42,40 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
* Return true if this is a binary type and can not support parse() and format() from/to string.
|
||||
* This allows Ebean to optimise marshalling types to string.
|
||||
*/
|
||||
boolean isBinaryType();
|
||||
default boolean isBinaryType() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a mutable scalar type (like hstore).
|
||||
*/
|
||||
boolean isMutable();
|
||||
default boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* For mutable scalarType's return true if the value is dirty.
|
||||
* Non-dirty properties may be excluded from updates.
|
||||
*/
|
||||
boolean isDirty(Object value);
|
||||
default boolean isDirty(Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default DB column length for this type.
|
||||
* <p>
|
||||
* If a BeanProperty has no explicit length defined then this length should
|
||||
* be assigned.
|
||||
* </p>
|
||||
* <p>
|
||||
* This is primarily to support defining a length on Enum types (to
|
||||
* supplement defining the length on the BeanProperty directly).
|
||||
* </p>
|
||||
*/
|
||||
int getLength();
|
||||
default int getLength() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the type is native to JDBC.
|
||||
* <p>
|
||||
* If it is native to JDBC then its values/instances do not need to be
|
||||
* converted to and from an associated JDBC type.
|
||||
* </p>
|
||||
*/
|
||||
boolean isJdbcNative();
|
||||
|
||||
@@ -83,16 +84,13 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
* <p>
|
||||
* This type should be consistent with the toJdbcType() method in converting
|
||||
* the type to the appropriate type for binding to preparedStatements.
|
||||
* </p>
|
||||
*/
|
||||
int getJdbcType();
|
||||
|
||||
/**
|
||||
* Return the type that matches the bean property type.
|
||||
* <p>
|
||||
* This represents the 'logical' type rather than the JDBC type this maps
|
||||
* to.
|
||||
* </p>
|
||||
* This represents the 'logical' type rather than the JDBC type this maps to.
|
||||
*/
|
||||
Class<T> getType();
|
||||
|
||||
@@ -104,7 +102,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
T read(DataReader reader) throws SQLException;
|
||||
|
||||
/**
|
||||
* Ignore the reading of this value. Typically this means moving the index
|
||||
* Ignore the reading of this value. Typically, this means moving the index
|
||||
* position in the ResultSet.
|
||||
*/
|
||||
void loadIgnore(DataReader reader);
|
||||
@@ -114,20 +112,16 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
* <p>
|
||||
* value may need to be converted from the logical bean property type to the
|
||||
* JDBC type.
|
||||
* </p>
|
||||
*/
|
||||
void bind(DataBinder binder, T value) throws SQLException;
|
||||
|
||||
/**
|
||||
* Convert the value as necessary to the JDBC type.
|
||||
* <p>
|
||||
* Note that this should also match the type as per the getJdbcType()
|
||||
* method.
|
||||
* </p>
|
||||
* Note that this should also match the type as per the getJdbcType() method.
|
||||
* <p>
|
||||
* This is typically used when the matching type is used in a where clause
|
||||
* and we use this to ensure it is an appropriate jdbc type.
|
||||
* </p>
|
||||
*/
|
||||
Object toJdbcType(Object value);
|
||||
|
||||
@@ -135,19 +129,14 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
* Convert the value as necessary to the logical Bean type.
|
||||
* <p>
|
||||
* The type as per the bean property.
|
||||
* </p>
|
||||
* <p>
|
||||
* This is used to automatically convert id values (typically from a string
|
||||
* to a int, long or UUID).
|
||||
* </p>
|
||||
*/
|
||||
T toBeanType(Object value);
|
||||
|
||||
/**
|
||||
* Convert the type into a string representation.
|
||||
* <p>
|
||||
* Reciprocal of parse().
|
||||
* </p>
|
||||
*/
|
||||
String formatValue(T value);
|
||||
|
||||
@@ -155,10 +144,8 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
* Convert the type into a string representation.
|
||||
* <p>
|
||||
* This assumes the value is of the correct type.
|
||||
* </p>
|
||||
* <p>
|
||||
* This is so that ScalarType also implements the StringFormatter interface.
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
String format(Object value);
|
||||
@@ -167,10 +154,6 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
* Convert the string value to the appropriate java object.
|
||||
* <p>
|
||||
* Mostly used to support CSV, JSON and XML parsing.
|
||||
* </p>
|
||||
* <p>
|
||||
* Reciprocal of formatValue().
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
T parse(String value);
|
||||
@@ -183,29 +166,32 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
/**
|
||||
* Return true if the type can accept long systemTimeMillis input.
|
||||
* <p>
|
||||
* This is used to determine if is is sensible to use the
|
||||
* This is used to determine if it is sensible to use the
|
||||
* {@link #convertFromMillis(long)} method.
|
||||
* </p>
|
||||
* <p>
|
||||
* This includes the Date, Calendar, sql Date, Time, Timestamp, JODA types
|
||||
* as well as Long, BigDecimal and String (although it generally is not
|
||||
* expected to parse systemTimeMillis to a String or BigDecimal).
|
||||
* </p>
|
||||
*/
|
||||
boolean isDateTimeCapable();
|
||||
default boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the value into a long version value.
|
||||
*/
|
||||
long asVersion(T value);
|
||||
default long asVersion(T value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the systemTimeMillis into the appropriate java object.
|
||||
* <p>
|
||||
* For non dateTime types this will throw an exception.
|
||||
* </p>
|
||||
*/
|
||||
T convertFromMillis(long dateTime);
|
||||
default T convertFromMillis(long dateTime) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value from binary input.
|
||||
@@ -215,7 +201,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
/**
|
||||
* Write the value to binary output.
|
||||
*/
|
||||
void writeData(DataOutput dataOutput, T v) throws IOException;
|
||||
void writeData(DataOutput dataOutput, T value) throws IOException;
|
||||
|
||||
/**
|
||||
* Read the value from JsonParser.
|
||||
|
||||
+8
-8
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core</artifactId>
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>ebean-parent-13.6.3</tag>
|
||||
<tag>ebean-parent-13.6.5</tag>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
@@ -41,19 +41,19 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -144,21 +144,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -92,6 +92,11 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
|
||||
*/
|
||||
ATTRIBUTE(FIND_ATTRIBUTE, "findAttribute", false, false),
|
||||
|
||||
/**
|
||||
* Find single attribute set.
|
||||
*/
|
||||
ATTRIBUTE_SET(FIND_ATTRIBUTE_SET, "findAttributeSet", false, false),
|
||||
|
||||
/**
|
||||
* Find rowCount.
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,7 @@ public interface TxnProfileEventCodes {
|
||||
String FIND_ID_LIST = "fi";
|
||||
String FIND_EXISTS = "ex";
|
||||
String FIND_ATTRIBUTE = "fa";
|
||||
String FIND_ATTRIBUTE_SET = "fas";
|
||||
String FIND_COUNT = "fc";
|
||||
String FIND_SUBQUERY = "fs";
|
||||
|
||||
|
||||
@@ -1193,7 +1193,23 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
}
|
||||
try {
|
||||
request.initTransIfRequired();
|
||||
return request.findSingleAttributeList();
|
||||
return request.findSingleAttributeCollection(new ArrayList<>());
|
||||
} finally {
|
||||
request.endTransIfRequired();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <A, T> Set<A> findSingleAttributeSet(Query<T> query, Transaction transaction) {
|
||||
SpiOrmQueryRequest<T> request = createQueryRequest(Type.ATTRIBUTE_SET, query, transaction);
|
||||
Object result = request.getFromQueryCache();
|
||||
if (result != null) {
|
||||
return (Set<A>) result;
|
||||
}
|
||||
try {
|
||||
request.initTransIfRequired();
|
||||
return request.findSingleAttributeCollection(new LinkedHashSet<>());
|
||||
} finally {
|
||||
request.endTransIfRequired();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.ebean.bean.BeanCollection;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -29,9 +30,9 @@ public interface OrmQueryEngine {
|
||||
<T> BeanCollection<T> findMany(OrmQueryRequest<T> request);
|
||||
|
||||
/**
|
||||
* Execute the findSingleAttributeList query.
|
||||
* Execute the findSingleAttributeCollection query.
|
||||
*/
|
||||
<A> List<A> findSingleAttributeList(OrmQueryRequest<?> request);
|
||||
<A extends Collection<?>> A findSingleAttributeCollection(OrmQueryRequest<?> request, A collection);
|
||||
|
||||
/**
|
||||
* Execute the findVersions query.
|
||||
|
||||
@@ -431,8 +431,8 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> List<A> findSingleAttributeList() {
|
||||
return queryEngine.findSingleAttributeList(this);
|
||||
public <A extends Collection<?>> A findSingleAttributeCollection(A collection) {
|
||||
return queryEngine.findSingleAttributeCollection(this, collection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,8 +77,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
*/
|
||||
private List<BeanPropertyAssocMany<?>> updatedManys;
|
||||
/**
|
||||
* Need to get and store the updated properties because the persist listener is notified
|
||||
* later on a different thread and the bean has been reset at that point.
|
||||
* Store the updated properties to notify persist listener.
|
||||
*/
|
||||
private Set<String> updatedProperties;
|
||||
/**
|
||||
@@ -122,7 +121,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
*/
|
||||
private boolean complete;
|
||||
/**
|
||||
* Many to many intersection table changes that are held for later batch processing.
|
||||
* Many-to-many intersection table changes that are held for later batch processing.
|
||||
*/
|
||||
private List<SaveMany> saveMany;
|
||||
|
||||
@@ -148,9 +147,10 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
// 'stateless update' - set loaded properties as dirty
|
||||
intercept.setNewBeanForUpdate();
|
||||
statelessUpdate = true;
|
||||
} else if (!intercept.isDirty()) {
|
||||
// check if any mutable scalar properties are dirty
|
||||
beanDescriptor.checkAnyMutableProperties(intercept);
|
||||
}
|
||||
// Mark Mutable scalar properties (like Hstore) as dirty where necessary
|
||||
beanDescriptor.checkMutableProperties(intercept);
|
||||
}
|
||||
this.concurrencyMode = beanDescriptor.concurrencyMode(intercept);
|
||||
this.publish = Flags.isPublish(flags);
|
||||
@@ -726,10 +726,6 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
executeInsert();
|
||||
return -1;
|
||||
case UPDATE:
|
||||
if (beanPersistListener != null) {
|
||||
// store the updated properties for sending later
|
||||
updatedProperties = updatedProperties();
|
||||
}
|
||||
executeUpdate();
|
||||
return -1;
|
||||
case DELETE_SOFT:
|
||||
@@ -1208,6 +1204,11 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
private void executeUpdate() {
|
||||
setTenantId();
|
||||
if (controller == null || controller.preUpdate(this)) {
|
||||
// check dirty state for all mutable scalar properties (like DbJson, Hstore)
|
||||
beanDescriptor.checkAllMutableProperties(intercept);
|
||||
if (beanPersistListener != null) {
|
||||
updatedProperties = updatedProperties();
|
||||
}
|
||||
postControllerPrepareUpdate();
|
||||
beanManager.getBeanPersister().update(this);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import io.ebeanservice.docstore.api.DocQueryRequest;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -122,7 +123,7 @@ public interface SpiOrmQueryRequest<T> extends BeanQueryRequest<T>, DocQueryRequ
|
||||
/**
|
||||
* Execute the findSingleAttributeList query.
|
||||
*/
|
||||
<A> List<A> findSingleAttributeList();
|
||||
<A extends Collection<?>> A findSingleAttributeCollection(A collection);
|
||||
|
||||
/**
|
||||
* Execute returning the ResultSet.
|
||||
|
||||
@@ -13,11 +13,10 @@ public interface DataTimeZone {
|
||||
Calendar getTimeZone();
|
||||
|
||||
/**
|
||||
* Return the Calendar to use for Timezone information when reading/writing date.
|
||||
* A 'date' only value has normally no timezone information, but some platforms (like MySQL)
|
||||
* reqire this.
|
||||
* Return the Calendar to use for Timezone information when reading/writing a time component (date only/time only).
|
||||
* A time component has normally no timezone information, but some platforms (like MySQL) reqire this.
|
||||
*/
|
||||
default Calendar getDateTimeZone() {
|
||||
default Calendar getTimeComponentTimeZone() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public class MySqlDataTimeZone implements DataTimeZone {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Calendar getDateTimeZone() {
|
||||
public Calendar getTimeComponentTimeZone() {
|
||||
return zone;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3140,9 +3140,9 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for mutable scalar types and mark as dirty if necessary.
|
||||
* Check all mutable scalar types and mark as dirty if necessary.
|
||||
*/
|
||||
public void checkMutableProperties(EntityBeanIntercept ebi) {
|
||||
public void checkAllMutableProperties(EntityBeanIntercept ebi) {
|
||||
for (BeanProperty beanProperty : propertiesMutable) {
|
||||
int propertyIndex = beanProperty.propertyIndex();
|
||||
if (ebi.isLoadedProperty(propertyIndex)) {
|
||||
@@ -3156,6 +3156,23 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if any mutable properties are dirty.
|
||||
*/
|
||||
public boolean checkAnyMutableProperties(EntityBeanIntercept ebi) {
|
||||
for (BeanProperty beanProperty : propertiesMutable) {
|
||||
int propertyIndex = beanProperty.propertyIndex();
|
||||
if (ebi.isLoadedProperty(propertyIndex)) {
|
||||
Object value = beanProperty.getValue(ebi.getOwner());
|
||||
if (beanProperty.checkMutable(value, ebi.isDirtyProperty(propertyIndex), ebi)) {
|
||||
ebi.markPropertyAsChanged(propertyIndex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ConcurrencyMode concurrencyMode(EntityBeanIntercept ebi) {
|
||||
if (!hasVersionProperty(ebi)) {
|
||||
return ConcurrencyMode.NONE;
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.core.type.DataReader;
|
||||
import io.ebeaninternal.api.SpiQuery;
|
||||
import io.ebeaninternal.server.query.STreePropertyAssocMany;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -70,11 +69,6 @@ public interface DbReadContext {
|
||||
*/
|
||||
void register(BeanPropertyAssocMany<?> many, BeanCollection<?> bc);
|
||||
|
||||
/**
|
||||
* Return the property that is associated with the many. There can only be
|
||||
* one. This can be null.
|
||||
*/
|
||||
STreePropertyAssocMany getManyProperty();
|
||||
|
||||
/**
|
||||
* Set back the bean that has just been loaded with its id.
|
||||
|
||||
@@ -46,20 +46,29 @@ final class DtoMetaBuilder {
|
||||
}
|
||||
|
||||
static String propertyName(String methodName) {
|
||||
final String name = methodName.substring(3);
|
||||
return Character.toLowerCase(name.charAt(0)) + name.substring(1);
|
||||
if (isTraditionalSetterMethod(methodName)) {
|
||||
final String name = methodName.substring(3);
|
||||
return Character.toLowerCase(name.charAt(0)) + name.substring(1);
|
||||
} else {
|
||||
// accessor style setter method
|
||||
return methodName;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isTraditionalSetterMethod(String methodName) {
|
||||
return methodName.startsWith("set") && methodName.length() > 3 && Character.isUpperCase(methodName.charAt(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* Include a public "setter" method - 1 argument, returns void.
|
||||
*/
|
||||
static boolean includeMethod(Method method) {
|
||||
String name = method.getName();
|
||||
final int modifiers = method.getModifiers();
|
||||
return Modifier.isPublic(modifiers)
|
||||
&& !Modifier.isStatic(modifiers)
|
||||
&& Void.TYPE.equals(method.getReturnType())
|
||||
&& method.getParameterTypes().length == 1
|
||||
&& method.getName().startsWith("set") && method.getName().length() > 3;
|
||||
&& (!name.equals("wait") && !name.equals("equals"));
|
||||
}
|
||||
|
||||
private void readConstructors() {
|
||||
|
||||
@@ -467,6 +467,11 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
return query.findSingleAttributeList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> Set<A> findSingleAttributeSet() {
|
||||
return query.findSingleAttributeSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists() {
|
||||
return query.exists();
|
||||
|
||||
@@ -464,6 +464,11 @@ final class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expr
|
||||
return exprList.findSingleAttributeList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> Set<A> findSingleAttributeSet() {
|
||||
return exprList.findSingleAttributeSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PagedList<T> findPagedList() {
|
||||
return exprList.findPagedList();
|
||||
|
||||
@@ -126,7 +126,7 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
// performance optimisation for large collections
|
||||
targetDescriptor.preAllocateIds(collection.size());
|
||||
}
|
||||
if (!insertedParent && many.isOrphanRemoval() && request.isForcedUpdate()) {
|
||||
if (forcedUpdateOrphanRemoval()) {
|
||||
// collect the Id's (to exclude from deleteManyDetails)
|
||||
List<Object> detailIds = collectIds(collection, targetDescriptor, isMap);
|
||||
// deleting missing children - children not in our collected detailIds
|
||||
@@ -140,6 +140,10 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
transaction.depth(-1);
|
||||
}
|
||||
|
||||
private boolean forcedUpdateOrphanRemoval() {
|
||||
return !insertedParent && many.isOrphanRemoval() && request.isForcedUpdate();
|
||||
}
|
||||
|
||||
private void saveAllBeans(final BeanProperty orderColumn) {
|
||||
Object mapKeyValue = null;
|
||||
boolean skipSavingThisBean;
|
||||
@@ -340,7 +344,7 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
return;
|
||||
}
|
||||
if (!(value instanceof BeanCollection<?>)) {
|
||||
if (!insertedParent && cascade && isChangedProperty()) {
|
||||
if (!forcedUpdateOrphanRemoval() && (!insertedParent && cascade && isChangedProperty())) {
|
||||
persister.addToFlushQueue(many.deleteByParentId(request.beanId(), null), transaction, 0);
|
||||
insertAllChildren = true;
|
||||
}
|
||||
|
||||
@@ -605,14 +605,6 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
return logWhereSql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the property that is associated with the many. There can only be one
|
||||
* per SqlSelect. This can be null.
|
||||
*/
|
||||
@Override
|
||||
public STreePropertyAssocMany getManyProperty() {
|
||||
return manyProperty;
|
||||
}
|
||||
|
||||
public String getBindLog() {
|
||||
return bindLog;
|
||||
|
||||
@@ -24,11 +24,7 @@ import org.slf4j.Logger;
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Handles the Object Relational fetching.
|
||||
@@ -91,16 +87,16 @@ public final class CQueryEngine {
|
||||
/**
|
||||
* Build and execute the findSingleAttributeList query.
|
||||
*/
|
||||
public <A> List<A> findSingleAttributeList(OrmQueryRequest<?> request) {
|
||||
public <A extends Collection<?>> A findSingleAttributeList(OrmQueryRequest<?> request, A collection) {
|
||||
CQueryFetchSingleAttribute rcQuery = queryBuilder.buildFetchAttributeQuery(request);
|
||||
request.setCancelableQuery(rcQuery);
|
||||
return findAttributeList(request, rcQuery);
|
||||
return findAttributeCollection(request, rcQuery, collection);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <A> List<A> findAttributeList(OrmQueryRequest<?> request, CQueryFetchSingleAttribute rcQuery) {
|
||||
private <A extends Collection<?>> A findAttributeCollection(OrmQueryRequest<?> request, CQueryFetchSingleAttribute rcQuery, A collection) {
|
||||
try {
|
||||
List<A> list = (List<A>) rcQuery.findList();
|
||||
rcQuery.findCollection(collection);
|
||||
if (request.logSql()) {
|
||||
logGeneratedSql(request, rcQuery.getGeneratedSql(), rcQuery.getBindLog(), rcQuery.micros());
|
||||
}
|
||||
@@ -109,13 +105,21 @@ public final class CQueryEngine {
|
||||
}
|
||||
if (request.isQueryCachePut()) {
|
||||
request.addDependentTables(rcQuery.getDependentTables());
|
||||
list = Collections.unmodifiableList(list);
|
||||
request.putToQueryCache(list);
|
||||
if (Boolean.FALSE.equals(request.query().isReadOnly())) {
|
||||
list = new ArrayList<>(list);
|
||||
if (collection instanceof List) {
|
||||
collection = (A) Collections.unmodifiableList((List<?>) collection);
|
||||
request.putToQueryCache(collection);
|
||||
if (Boolean.FALSE.equals(request.query().isReadOnly())) {
|
||||
collection = (A) new ArrayList<>(collection);
|
||||
}
|
||||
} else if (collection instanceof Set) {
|
||||
collection = (A) Collections.unmodifiableSet((Set<?>) collection);
|
||||
request.putToQueryCache(collection);
|
||||
if (Boolean.FALSE.equals(request.query().isReadOnly())) {
|
||||
collection = (A) new LinkedHashSet<>(collection);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
return collection;
|
||||
} catch (SQLException e) {
|
||||
throw translate(request, rcQuery.getBindLog(), rcQuery.getGeneratedSql(), e);
|
||||
}
|
||||
@@ -144,7 +148,7 @@ public final class CQueryEngine {
|
||||
public <A> List<A> findIds(OrmQueryRequest<?> request) {
|
||||
CQueryFetchSingleAttribute rcQuery = queryBuilder.buildFetchIdsQuery(request);
|
||||
request.setCancelableQuery(rcQuery);
|
||||
return findAttributeList(request, rcQuery);
|
||||
return findAttributeCollection(request, rcQuery, new ArrayList<>());
|
||||
}
|
||||
|
||||
private <T> void logGeneratedSql(OrmQueryRequest<T> request, String sql, String bindLog, long micros) {
|
||||
|
||||
+2
-3
@@ -16,6 +16,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -76,11 +77,10 @@ final class CQueryFetchSingleAttribute implements SpiProfileTransactionEvent, Ca
|
||||
/**
|
||||
* Execute the query returning the row count.
|
||||
*/
|
||||
List<Object> findList() throws SQLException {
|
||||
void findCollection(Collection result) throws SQLException {
|
||||
long startNano = System.nanoTime();
|
||||
try {
|
||||
prepareExecute();
|
||||
List<Object> result = new ArrayList<>();
|
||||
while (dataReader.next()) {
|
||||
Object value = reader.read(dataReader);
|
||||
if (containsCounts) {
|
||||
@@ -95,7 +95,6 @@ final class CQueryFetchSingleAttribute implements SpiProfileTransactionEvent, Ca
|
||||
queryPlan.captureBindForQueryPlan(predicates, executionTimeMicros);
|
||||
}
|
||||
getTransaction().profileEvent(this);
|
||||
return result;
|
||||
} finally {
|
||||
close();
|
||||
}
|
||||
|
||||
@@ -286,6 +286,11 @@ final class DefaultFetchGroupQuery<T> implements SpiFetchGroupQuery<T>, SpiQuery
|
||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> Set<A> findSingleAttributeSet() {
|
||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> A findSingleAttribute() {
|
||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||
|
||||
@@ -17,6 +17,7 @@ import javax.persistence.PersistenceException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Main Finder implementation.
|
||||
@@ -97,9 +98,9 @@ public final class DefaultOrmQueryEngine implements OrmQueryEngine {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> List<A> findSingleAttributeList(OrmQueryRequest<?> request) {
|
||||
public <A extends Collection<?>> A findSingleAttributeCollection(OrmQueryRequest<?> request, A collection) {
|
||||
flushJdbcBatchOnQuery(request);
|
||||
return queryEngine.findSingleAttributeList(request);
|
||||
return queryEngine.findSingleAttributeList(request, collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,6 +36,7 @@ class SqlTreeLoadBean implements SqlTreeLoad {
|
||||
private final SpiQuery.TemporalMode temporalMode;
|
||||
private final boolean temporalVersions;
|
||||
final IdBinder lazyLoadParentIdBinder;
|
||||
private final STreePropertyAssocMany loadingChildProperty;
|
||||
|
||||
SqlTreeLoadBean(SqlTreeNodeBean node) {
|
||||
this.lazyLoadParent = node.lazyLoadParent;
|
||||
@@ -55,6 +56,16 @@ class SqlTreeLoadBean implements SqlTreeLoad {
|
||||
this.properties = node.properties;
|
||||
this.pathMap = node.pathMap;
|
||||
this.children = node.createLoadChildren();
|
||||
this.loadingChildProperty = loadingChildProperty();
|
||||
}
|
||||
|
||||
private STreePropertyAssocMany loadingChildProperty() {
|
||||
for (SqlTreeLoad child : children) {
|
||||
if (child instanceof SqlTreeLoadManyRoot) {
|
||||
return ((SqlTreeLoadManyRoot) child).manyProp();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean isRoot() {
|
||||
@@ -280,10 +291,9 @@ class SqlTreeLoadBean implements SqlTreeLoad {
|
||||
* included in the actual query.
|
||||
*/
|
||||
private void createListProxies() {
|
||||
STreePropertyAssocMany fetchedMany = ctx.getManyProperty();
|
||||
boolean forceNewReference = queryMode == Mode.REFRESH_BEAN;
|
||||
for (STreePropertyAssocMany many : localDesc.propsMany()) {
|
||||
if (many != fetchedMany) {
|
||||
if (many != loadingChildProperty) {
|
||||
if (readOnlyNoIntercept) {
|
||||
many.createEmptyReference(localBean);
|
||||
} else {
|
||||
|
||||
@@ -14,6 +14,10 @@ final class SqlTreeLoadManyRoot extends SqlTreeLoadBean {
|
||||
this.manyProp = node.manyProp;
|
||||
}
|
||||
|
||||
STreePropertyAssocMany manyProp() {
|
||||
return manyProp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityBean load(DbReadContext cquery, EntityBean parentBean, EntityBean contextParent) throws SQLException {
|
||||
// pass in null for parentBean because added to a collection rather than set to the parentBean
|
||||
|
||||
@@ -1498,6 +1498,10 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
|
||||
return (List<A>) server.findSingleAttributeList(this, transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <A> Set<A> findSingleAttributeSet() {
|
||||
return (Set<A>) server.findSingleAttributeSet(this, transaction);
|
||||
}
|
||||
@Override
|
||||
public final <A> A findSingleAttribute() {
|
||||
List<A> list = findSingleAttributeList();
|
||||
|
||||
@@ -158,7 +158,7 @@ public class DataBind implements DataBinder {
|
||||
|
||||
@Override
|
||||
public final void setDate(java.sql.Date v) throws SQLException {
|
||||
Calendar timeZone = dataTimeZone.getDateTimeZone();
|
||||
Calendar timeZone = dataTimeZone.getTimeComponentTimeZone();
|
||||
if (timeZone != null) {
|
||||
pstmt.setDate(++pos, v, timeZone);
|
||||
} else {
|
||||
@@ -178,7 +178,7 @@ public class DataBind implements DataBinder {
|
||||
|
||||
@Override
|
||||
public final void setTime(Time v) throws SQLException {
|
||||
Calendar timeZone = dataTimeZone.getTimeZone();
|
||||
Calendar timeZone = dataTimeZone.getTimeComponentTimeZone();
|
||||
if (timeZone != null) {
|
||||
pstmt.setTime(++pos, v, timeZone);
|
||||
} else {
|
||||
|
||||
@@ -353,6 +353,9 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
Type genericType = prop.getGenericType();
|
||||
boolean hasJacksonAnnotations = objectMapperPresent && checkJacksonAnnotations(prop);
|
||||
|
||||
if (type.equals(String.class)) {
|
||||
return ScalarTypeJsonString.typeFor(postgres, dbType);
|
||||
}
|
||||
if (type.equals(List.class)) {
|
||||
DocPropertyType docType = getDocType(genericType);
|
||||
if (!hasJacksonAnnotations && isValueTypeSimple(genericType)) {
|
||||
|
||||
@@ -107,7 +107,7 @@ public class RsetDataReader implements DataReader {
|
||||
|
||||
@Override
|
||||
public final Date getDate() throws SQLException {
|
||||
Calendar cal = dataTimeZone.getDateTimeZone();
|
||||
Calendar cal = dataTimeZone.getTimeComponentTimeZone();
|
||||
if (cal != null) {
|
||||
return rset.getDate(pos(), cal);
|
||||
} else {
|
||||
@@ -156,7 +156,7 @@ public class RsetDataReader implements DataReader {
|
||||
|
||||
@Override
|
||||
public final Time getTime() throws SQLException {
|
||||
Calendar cal = dataTimeZone.getTimeZone();
|
||||
Calendar cal = dataTimeZone.getTimeComponentTimeZone();
|
||||
if (cal != null) {
|
||||
return rset.getTime(pos(), cal);
|
||||
} else {
|
||||
|
||||
@@ -18,41 +18,6 @@ abstract class ScalarTypeBase<T> implements ScalarType<T> {
|
||||
this.jdbcType = jdbcType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long asVersion(T value) {
|
||||
throw new RuntimeException("not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBinaryType() {
|
||||
// override for binary/byte based types
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default implementation of mutable false.
|
||||
*/
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default to true.
|
||||
*/
|
||||
@Override
|
||||
public boolean isDirty(Object value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Just return 0.
|
||||
*/
|
||||
@Override
|
||||
public int getLength() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJdbcNative() {
|
||||
return jdbcNative;
|
||||
|
||||
@@ -88,16 +88,6 @@ abstract class ScalarTypeBaseVarchar<T> extends ScalarTypeBase<T> {
|
||||
return format(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convertFromMillis(long systemTimeMillis) {
|
||||
throw new TextException("Not Supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String format(Object value) {
|
||||
|
||||
@@ -234,7 +234,6 @@ public final class ScalarTypeBoolean {
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
// typically this will return 1
|
||||
return Math.max(trueValue.length(), falseValue.length());
|
||||
}
|
||||
|
||||
@@ -329,16 +328,6 @@ public final class ScalarTypeBoolean {
|
||||
return Boolean.valueOf(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean convertFromMillis(long systemTimeMillis) {
|
||||
throw new TextException("Not Supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
|
||||
@@ -85,16 +85,6 @@ final class ScalarTypeByte extends ScalarTypeBase<Byte> {
|
||||
throw new TextException("Not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Byte convertFromMillis(long systemTimeMillis) {
|
||||
throw new TextException("Not Supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Byte readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
|
||||
@@ -59,16 +59,6 @@ public abstract class ScalarTypeBytesBase extends ScalarTypeBase<byte[]> {
|
||||
throw new TextException("Not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] convertFromMillis(long systemTimeMillis) {
|
||||
throw new TextException("Not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
|
||||
@@ -26,26 +26,11 @@ public final class ScalarTypeBytesEncrypted implements ScalarType<byte[]> {
|
||||
this.dataEncryptSupport = dataEncryptSupport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long asVersion(byte[] value) {
|
||||
throw new RuntimeException("not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBinaryType() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDirty(Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(DataBinder binder, byte[] value) throws SQLException {
|
||||
value = dataEncryptSupport.encrypt(value);
|
||||
|
||||
@@ -93,16 +93,6 @@ class ScalarTypeDuration extends ScalarTypeBase<Duration> {
|
||||
return Duration.parse(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration convertFromMillis(long systemTimeMillis) {
|
||||
throw new TextException("Not Supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration jsonRead(JsonParser parser) throws IOException {
|
||||
return Duration.parse(parser.getValueAsString());
|
||||
|
||||
@@ -30,11 +30,6 @@ public final class ScalarTypeEncryptedWrapper<T> implements ScalarType<T>, Local
|
||||
return dataEncryptSupport.encryptObject(formatValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long asVersion(T value) {
|
||||
throw new RuntimeException("not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBinaryType() {
|
||||
return wrapped.isBinaryType();
|
||||
|
||||
@@ -229,16 +229,6 @@ final class ScalarTypeEnumStandard {
|
||||
return Enum.valueOf(enumType, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convertFromMillis(long systemTimeMillis) {
|
||||
throw new TextException("Not Supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object jsonRead(JsonParser parser) throws IOException {
|
||||
if (parser.getCodec() != null) {
|
||||
|
||||
@@ -39,16 +39,6 @@ class ScalarTypeEnumWithMapping extends ScalarTypeEnumStandard.EnumBase implemen
|
||||
return enumType == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long asVersion(Object value) {
|
||||
throw new RuntimeException("not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBinaryType() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the IN values for DB constraint construction.
|
||||
*/
|
||||
|
||||
@@ -129,16 +129,6 @@ final class ScalarTypeFile extends ScalarTypeBase<File> {
|
||||
throw new TextException("Not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public File convertFromMillis(long systemTimeMillis) {
|
||||
throw new TextException("Not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File readData(DataInput dataInput) throws IOException {
|
||||
// skip reading large file
|
||||
|
||||
@@ -80,16 +80,6 @@ abstract class ScalarTypeJsonCollection<T> extends ScalarTypeBase<T> implements
|
||||
return docPropertyType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convertFromMillis(long dateTime) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
|
||||
@@ -215,16 +215,6 @@ abstract class ScalarTypeJsonMap extends ScalarTypeBase<Map> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Map convertFromMillis(long dateTime) {
|
||||
throw new RuntimeException("Should never be called");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Map readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
|
||||
@@ -167,16 +167,6 @@ abstract class ScalarTypeJsonNode extends ScalarTypeBase<JsonNode> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonNode convertFromMillis(long dateTime) {
|
||||
throw new RuntimeException("Should never be called");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonNode readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
|
||||
+5
-25
@@ -55,16 +55,6 @@ final class ScalarTypeJsonObjectMapper {
|
||||
NoMutationDetection(TypeJsonManager jsonManager, AnnotatedField field, int dbType, DocPropertyType docType) {
|
||||
super(Object.class, jsonManager, field, dbType, docType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDirty(Object value) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,6 +69,11 @@ final class ScalarTypeJsonObjectMapper {
|
||||
this.jsonb = "jsonb".equals(pgType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJsonMapper() {
|
||||
return true;
|
||||
@@ -144,11 +139,6 @@ final class ScalarTypeJsonObjectMapper {
|
||||
this.objectWriter = helper.objectWriter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T read(DataReader reader) throws SQLException {
|
||||
String json = reader.getString();
|
||||
@@ -212,16 +202,6 @@ final class ScalarTypeJsonObjectMapper {
|
||||
return docType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final T convertFromMillis(long dateTime) {
|
||||
throw new IllegalStateException("Not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final T jsonRead(JsonParser parser) throws IOException {
|
||||
return objectReader.readValue(parser, deserType);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
|
||||
import io.ebean.config.dbplatform.DbPlatformType;
|
||||
import io.ebean.config.dbplatform.ExtraDbTypes;
|
||||
import io.ebean.core.type.DataBinder;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
final class ScalarTypeJsonString {
|
||||
|
||||
static final Postgres JSONB = new Postgres(ExtraDbTypes.JSONB, PostgresHelper.JSONB_TYPE);
|
||||
static final Postgres JSON = new Postgres(ExtraDbTypes.JSON, PostgresHelper.JSON_TYPE);
|
||||
|
||||
static ScalarType<?> typeFor(boolean postgres, int dbType) {
|
||||
if (postgres) {
|
||||
switch (dbType) {
|
||||
case DbPlatformType.JSONB:
|
||||
return JSONB;
|
||||
case DbPlatformType.JSON:
|
||||
return JSON;
|
||||
}
|
||||
}
|
||||
return ScalarTypeString.INSTANCE;
|
||||
}
|
||||
|
||||
private static class Postgres extends ScalarTypeStringBase {
|
||||
final String postgresType;
|
||||
|
||||
Postgres(int jdbcType, String postgresType) {
|
||||
super(true, jdbcType);
|
||||
this.postgresType = postgresType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(DataBinder binder, String rawJson) throws SQLException {
|
||||
binder.setObject(PostgresHelper.asObject(postgresType, rawJson));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -78,16 +78,6 @@ final class ScalarTypeMonthDay extends ScalarTypeBase<MonthDay> {
|
||||
return MonthDay.parse(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MonthDay convertFromMillis(long dateTime) {
|
||||
throw new RuntimeException("Not supported on this type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public MonthDay readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
|
||||
@@ -22,25 +22,6 @@ class ScalarTypeNotFound implements ScalarType<Void> {
|
||||
|
||||
public static final ScalarTypeNotFound INSTANCE = new ScalarTypeNotFound();
|
||||
private ScalarTypeNotFound() { }
|
||||
@Override
|
||||
public boolean isBinaryType() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDirty(Object value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJdbcNative() {
|
||||
@@ -102,21 +83,6 @@ class ScalarTypeNotFound implements ScalarType<Void> {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long asVersion(Void value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void convertFromMillis(long dateTime) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void readData(DataInput dataInput) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -82,16 +82,6 @@ final class ScalarTypePostgresHstore extends ScalarTypeBase<Map> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map convertFromMillis(long dateTime) {
|
||||
throw new RuntimeException("Should never be called");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
|
||||
@@ -57,16 +57,6 @@ final class ScalarTypeShort extends ScalarTypeBase<Short> {
|
||||
return Short.valueOf(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Short convertFromMillis(long systemTimeMillis) {
|
||||
throw new TextException("Not Supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Short readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
|
||||
@@ -13,7 +13,7 @@ final class ScalarTypeTimeZone extends ScalarTypeBaseVarchar<TimeZone> {
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
return 20;
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,16 +25,6 @@ abstract class ScalarTypeUUIDBase extends ScalarTypeBase<UUID> implements Scalar
|
||||
return DbPlatformType.UUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDirty(Object value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(Object value) {
|
||||
return String.valueOf(value);
|
||||
@@ -50,16 +40,6 @@ abstract class ScalarTypeUUIDBase extends ScalarTypeBase<UUID> implements Scalar
|
||||
return UUID.fromString(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID convertFromMillis(long dateTime) {
|
||||
throw new RuntimeException("Should never be called");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID toBeanType(Object value) {
|
||||
return BasicTypeConverter.toUUID(value, false);
|
||||
|
||||
@@ -44,8 +44,7 @@ public class ScalarTypeWrapper<B, S> implements ScalarType<B> {
|
||||
|
||||
@Override
|
||||
public long asVersion(B value) {
|
||||
S unwrapValue = converter.unwrapValue(value);
|
||||
return scalarType.asVersion(unwrapValue);
|
||||
return scalarType.asVersion(converter.unwrapValue(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -81,16 +81,6 @@ final class ScalarTypeYear extends ScalarTypeBase<Year> {
|
||||
return Year.parse(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Year convertFromMillis(long systemTimeMillis) {
|
||||
throw new TextException("Not Supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Year jsonRead(JsonParser parser) throws IOException {
|
||||
return Year.of(parser.getIntValue());
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.ebeaninternal.server.dto;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -12,42 +11,54 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class DtoMetaBuilderTest {
|
||||
|
||||
@Test
|
||||
public void includeMethod() {
|
||||
void includeMethod() {
|
||||
Map<String, Method> methods = getIncludedMethodsFor(D0.class);
|
||||
|
||||
assertThat(methods).hasSize(2);
|
||||
assertThat(methods.get("setName")).isNotNull();
|
||||
assertThat(methods.get("setId")).isNotNull();
|
||||
assertThat(methods).containsKeys("setId", "setName");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void includeMethod_when_notStrictlySetters() {
|
||||
void includeMethod_when_notStrictlySetters() {
|
||||
Map<String, Method> methods = getIncludedMethodsFor(D1.class);
|
||||
|
||||
assertThat(methods).hasSize(3);
|
||||
assertThat(methods.get("setNameThen")).isNotNull();
|
||||
assertThat(methods.get("setIdFor")).isNotNull();
|
||||
assertThat(methods.get("setI")).isNotNull();
|
||||
assertThat(methods).hasSize(5);
|
||||
assertThat(methods).containsKeys("setNameThen", "setIdFor", "setI", "setA", "set");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertyType() {
|
||||
void includeMethod_when_fluidAccessors() {
|
||||
Map<String, Method> methods = getIncludedMethodsFor(D2FluidAccessors.class);
|
||||
|
||||
assertThat(methods).hasSize(5);
|
||||
assertThat(methods).containsKeys("nameThen", "idFor", "a", "i", "set");
|
||||
}
|
||||
|
||||
@Test
|
||||
void includeMethod_when_plainAccessors() {
|
||||
Map<String, Method> methods = getIncludedMethodsFor(D2PlainAccessors.class);
|
||||
|
||||
assertThat(methods).hasSize(5);
|
||||
assertThat(methods).containsKeys("nameThen", "idFor", "a", "i", "set");
|
||||
}
|
||||
|
||||
@Test
|
||||
void propertyType() {
|
||||
Map<String, Method> methods = getIncludedMethodsFor(D0.class);
|
||||
|
||||
assertThat(methods).hasSize(2);
|
||||
Assertions.assertThat(DtoMetaProperty.propertyClass(methods.get("setName"))).isEqualTo(String.class);
|
||||
assertThat(DtoMetaProperty.propertyClass(methods.get("setName"))).isEqualTo(String.class);
|
||||
assertThat(DtoMetaProperty.propertyClass(methods.get("setId"))).isEqualTo(long.class);
|
||||
assertThat(DtoMetaProperty.propertyType(methods.get("setName"))).isEqualTo(String.class);
|
||||
assertThat(DtoMetaProperty.propertyType(methods.get("setId"))).isEqualTo(long.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertyName() {
|
||||
|
||||
Assertions.assertThat(DtoMetaBuilder.propertyName("setName")).isEqualTo("name");
|
||||
void propertyName() {
|
||||
assertThat(DtoMetaBuilder.propertyName("setName")).isEqualTo("name");
|
||||
assertThat(DtoMetaBuilder.propertyName("setId")).isEqualTo("id");
|
||||
assertThat(DtoMetaBuilder.propertyName("setI")).isEqualTo("i");
|
||||
assertThat(DtoMetaBuilder.propertyName("setfoo")).isEqualTo("foo");
|
||||
assertThat(DtoMetaBuilder.propertyName("setFoo")).isEqualTo("foo");
|
||||
}
|
||||
|
||||
|
||||
@@ -120,4 +131,47 @@ public class DtoMetaBuilderTest {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
static class D2FluidAccessors {
|
||||
|
||||
public D2FluidAccessors nameThen(String name) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public D2FluidAccessors idFor(long id) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public D2FluidAccessors i(long val) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public D2FluidAccessors set(long val) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public D2FluidAccessors a(long val) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
static class D2PlainAccessors {
|
||||
|
||||
public void nameThen(String name) {
|
||||
}
|
||||
|
||||
public void idFor(long id) {
|
||||
}
|
||||
|
||||
public void i(long val) {
|
||||
}
|
||||
|
||||
public void set(long val) {
|
||||
}
|
||||
|
||||
public void a(long val) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,11 +17,11 @@ class BasicProfileLocationTest {
|
||||
assertThat(loc.fullLocation()).endsWith("invoke0(Native Method:12)");
|
||||
assertThat(loc.location()).isEqualTo("sun.reflect.NativeMethodAccessorImpl.invoke0");
|
||||
assertThat(loc.label()).isEqualTo("NativeMethodAccessorImpl.invoke0");
|
||||
} else if (javaVersion.startsWith("18") || javaVersion.startsWith("19")){
|
||||
} else if (javaVersion.startsWith("18") || javaVersion.startsWith("19") || javaVersion.startsWith("20")){
|
||||
assertThat(loc.fullLocation()).endsWith("jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)");
|
||||
assertThat(loc.location()).isEqualTo("java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke");
|
||||
assertThat(loc.label()).isEqualTo("DirectMethodHandleAccessor.invoke");
|
||||
} else {
|
||||
} else if (javaVersion.startsWith("11") || javaVersion.startsWith("17")) {
|
||||
assertThat(loc.fullLocation()).endsWith("jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method:12)");
|
||||
assertThat(loc.location()).isEqualTo("java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0");
|
||||
assertThat(loc.label()).isEqualTo("NativeMethodAccessorImpl.invoke0");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
|
||||
import io.ebean.text.TextException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -11,13 +10,12 @@ import java.time.Duration;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class ScalarTypeDurationTest {
|
||||
class ScalarTypeDurationTest {
|
||||
|
||||
ScalarTypeDuration type = new ScalarTypeDuration();
|
||||
|
||||
@Test
|
||||
public void testReadData() throws Exception {
|
||||
|
||||
void testReadData() throws Exception {
|
||||
Duration duration = Duration.ofSeconds(1234);
|
||||
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
@@ -39,8 +37,7 @@ public class ScalarTypeDurationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToJdbcType() throws Exception {
|
||||
|
||||
void testToJdbcType() throws Exception {
|
||||
Duration duration = Duration.ofSeconds(1234);
|
||||
long seconds = duration.getSeconds();
|
||||
|
||||
@@ -52,8 +49,7 @@ public class ScalarTypeDurationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToBeanType() throws Exception {
|
||||
|
||||
void testToBeanType() throws Exception {
|
||||
Duration duration = Duration.ofSeconds(1234);
|
||||
long seconds = duration.getSeconds();
|
||||
|
||||
@@ -67,37 +63,34 @@ public class ScalarTypeDurationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormatValue() throws Exception {
|
||||
|
||||
void testFormatValue() {
|
||||
Duration duration = Duration.ofSeconds(1234);
|
||||
String formatValue = type.formatValue(duration);
|
||||
assertEquals("PT20M34S", formatValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParse() {
|
||||
void testParse() {
|
||||
Duration duration = type.parse("PT20M34S");
|
||||
assertEquals(Duration.ofSeconds(1234), duration);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsDateTimeCapable() {
|
||||
void testIsDateTimeCapable() {
|
||||
assertFalse(type.isDateTimeCapable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertFromMillis() {
|
||||
assertThrows(TextException.class, () -> type.convertFromMillis(1000));
|
||||
void testConvertFromMillis() {
|
||||
assertThrows(UnsupportedOperationException.class, () -> type.convertFromMillis(1000));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJsonRead() throws Exception {
|
||||
|
||||
void testJsonRead() throws Exception {
|
||||
Duration duration = Duration.ofSeconds(1234);
|
||||
|
||||
JsonTester<Duration> jsonTester = new JsonTester<>(type);
|
||||
jsonTester.test(duration);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-15
@@ -1,6 +1,5 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
|
||||
import io.ebean.text.TextException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -12,13 +11,12 @@ import java.time.Duration;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class ScalarTypeDurationWithNanosTest {
|
||||
class ScalarTypeDurationWithNanosTest {
|
||||
|
||||
ScalarTypeDurationWithNanos type = new ScalarTypeDurationWithNanos();
|
||||
|
||||
@Test
|
||||
public void testReadData() throws Exception {
|
||||
|
||||
void testReadData() throws Exception {
|
||||
Duration duration = Duration.ofSeconds(323, 1500000);
|
||||
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
@@ -40,8 +38,7 @@ public class ScalarTypeDurationWithNanosTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToJdbcType() throws Exception {
|
||||
|
||||
void testToJdbcType() throws Exception {
|
||||
Duration duration = Duration.ofSeconds(323, 1500000);
|
||||
BigDecimal bigDecimal = DecimalUtils.toDecimal(duration);
|
||||
|
||||
@@ -53,8 +50,7 @@ public class ScalarTypeDurationWithNanosTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToBeanType() throws Exception {
|
||||
|
||||
void testToBeanType() throws Exception {
|
||||
Duration duration = Duration.ofSeconds(323, 1500000);
|
||||
BigDecimal bigDecimal = DecimalUtils.toDecimal(duration);
|
||||
|
||||
@@ -66,32 +62,31 @@ public class ScalarTypeDurationWithNanosTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormatValue() throws Exception {
|
||||
|
||||
void testFormatValue() {
|
||||
Duration duration = Duration.ofSeconds(323, 1500000);
|
||||
String formatValue = type.formatValue(duration);
|
||||
assertEquals("PT5M23.0015S", formatValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParse() {
|
||||
void testParse() {
|
||||
Duration duration = Duration.ofSeconds(323, 1500000);
|
||||
Duration val1 = type.parse("PT5M23.0015S");
|
||||
assertEquals(duration, val1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsDateTimeCapable() {
|
||||
void testIsDateTimeCapable() {
|
||||
assertFalse(type.isDateTimeCapable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertFromMillis() {
|
||||
assertThrows(TextException.class, () -> type.convertFromMillis(1000));
|
||||
void testConvertFromMillis() {
|
||||
assertThrows(UnsupportedOperationException.class, () -> type.convertFromMillis(1000));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJsonRead() throws Exception {
|
||||
void testJsonRead() throws Exception {
|
||||
Duration duration = Duration.ofSeconds(323, 1500000);
|
||||
|
||||
JsonTester<Duration> jsonTester = new JsonTester<>(type);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class ScalarTypeTimeZoneTest {
|
||||
|
||||
ScalarTypeTimeZone type = new ScalarTypeTimeZone();
|
||||
|
||||
@Test
|
||||
void getLength() {
|
||||
assertEquals(32, type.getLength());
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,12 @@ import java.time.Year;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class ScalarTypeYearTest {
|
||||
class ScalarTypeYearTest {
|
||||
|
||||
ScalarTypeYear type = new ScalarTypeYear();
|
||||
|
||||
@Test
|
||||
public void testReadData() throws Exception {
|
||||
|
||||
void testReadData() throws Exception {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
ObjectOutputStream out = new ObjectOutputStream(os);
|
||||
|
||||
@@ -37,8 +36,7 @@ public class ScalarTypeYearTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToJdbcType() throws Exception {
|
||||
|
||||
void testToJdbcType() throws Exception {
|
||||
Integer year = 2013;
|
||||
Object val1 = type.toJdbcType(Year.of(2013));
|
||||
Object val2 = type.toJdbcType(2013);
|
||||
@@ -50,8 +48,7 @@ public class ScalarTypeYearTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToBeanType() throws Exception {
|
||||
|
||||
void testToBeanType() throws Exception {
|
||||
Year year = Year.of(2013);
|
||||
Year val1 = type.toBeanType(year);
|
||||
Year val2 = type.toBeanType(2013);
|
||||
@@ -63,29 +60,29 @@ public class ScalarTypeYearTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormatValue() throws Exception {
|
||||
void testFormatValue() {
|
||||
String formatted = type.formatValue(Year.of(2013));
|
||||
assertEquals("2013", formatted);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParse() {
|
||||
void testParse() {
|
||||
Year year = type.parse("2013");
|
||||
assertEquals(Year.of(2013), year);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsDateTimeCapable() {
|
||||
void testIsDateTimeCapable() {
|
||||
assertFalse(type.isDateTimeCapable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertFromMillis() {
|
||||
assertThrows(TextException.class, () -> type.convertFromMillis(1000));
|
||||
void testConvertFromMillis() {
|
||||
assertThrows(UnsupportedOperationException.class, () -> type.convertFromMillis(1000));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJson() throws Exception {
|
||||
void testJson() throws Exception {
|
||||
JsonTester<Year> jsonTester = new JsonTester<>(type);
|
||||
jsonTester.test(Year.of(2013));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean ddl generation</name>
|
||||
@@ -28,14 +28,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.6.3</version>
|
||||
<version>13.6.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -10,19 +10,12 @@ import io.ebean.util.JdbcClose;
|
||||
import io.ebeaninternal.api.SpiDdlGenerator;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.dbmigration.model.CurrentModel;
|
||||
import io.ebeaninternal.dbmigration.model.MTable;
|
||||
import io.ebeaninternal.extraddl.model.ExtraDdlXmlReader;
|
||||
import io.ebeaninternal.server.deploy.PartitionMeta;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.LineNumberReader;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.io.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@@ -205,7 +198,6 @@ public class DdlGenerator implements SpiDdlGenerator {
|
||||
createAllContent = readFile(getCreateFileName());
|
||||
}
|
||||
runScript(connection, false, createAllContent, getCreateFileName());
|
||||
|
||||
if (extraDdl && jaxbPresent) {
|
||||
if (currentModel().isTablePartitioning()) {
|
||||
String extraPartitioning = ExtraDdlXmlReader.buildPartitioning(platform);
|
||||
@@ -213,43 +205,10 @@ public class DdlGenerator implements SpiDdlGenerator {
|
||||
runScript(connection, false, extraPartitioning, "builtin-partitioning-ddl");
|
||||
}
|
||||
}
|
||||
|
||||
String extraApply = ExtraDdlXmlReader.buildExtra(platform, false);
|
||||
if (extraApply != null) {
|
||||
runScript(connection, false, extraApply, "extra-ddl");
|
||||
}
|
||||
|
||||
if (currentModel().isTablePartitioning()) {
|
||||
checkInitialTablePartitions(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if table partitions exist and if not create some. The expectation is that
|
||||
* extra-ddl.xml should have some partition initialisation but this helps people get going.
|
||||
*/
|
||||
private void checkInitialTablePartitions(Connection connection) {
|
||||
DatabasePlatform databasePlatform = server.databasePlatform();
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (MTable table : currentModel.getPartitionedTables()) {
|
||||
String tableName = table.getName();
|
||||
if (!databasePlatform.tablePartitionsExist(connection, tableName)) {
|
||||
log.info("No table partitions for table {}", tableName);
|
||||
PartitionMeta meta = table.getPartitionMeta();
|
||||
String initPart = databasePlatform.tablePartitionInit(tableName, meta.getMode());
|
||||
sb.append(initPart).append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
String initialPartitionSql = sb.toString();
|
||||
if (!initialPartitionSql.isEmpty()) {
|
||||
runScript(connection, false, initialPartitionSql, "initial table partitions");
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
log.error("Error checking initial table partitions", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user