mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Compare commits
88
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18765b3ac2 | ||
|
|
ea8e195183 | ||
|
|
f54c212b67 | ||
|
|
14d11b1c70 | ||
|
|
39de9d56db | ||
|
|
94dbd9d6ad | ||
|
|
7c23dd06f8 | ||
|
|
e813edae01 | ||
|
|
4218d5bd48 | ||
|
|
aaf7aa8386 | ||
|
|
fbe84a7c62 | ||
|
|
cbd213aad3 | ||
|
|
13622f6b62 | ||
|
|
8fe6de376d | ||
|
|
808ba719f4 | ||
|
|
117844b5ee | ||
|
|
fbb73d465c | ||
|
|
a5c3bbb97e | ||
|
|
674150dc75 | ||
|
|
ad938b2ce2 | ||
|
|
5b1ace8607 | ||
|
|
74321277ff | ||
|
|
c60362f6e1 | ||
|
|
c1320e4184 | ||
|
|
a7ea2cf3ef | ||
|
|
f86a0ac973 | ||
|
|
bcc21b1c04 | ||
|
|
d517dea27f | ||
|
|
7df168f232 | ||
|
|
563340edbd | ||
|
|
28d70cf9c4 | ||
|
|
25d0675532 | ||
|
|
c8ffad2831 | ||
|
|
8233058d2e | ||
|
|
f7e00aab78 | ||
|
|
a111f3ff10 | ||
|
|
29e2b81092 | ||
|
|
0dda3e0e93 | ||
|
|
f07c7411fa | ||
|
|
b4d037fa18 | ||
|
|
e46bbcf8cf | ||
|
|
0c2ab729bc | ||
|
|
81ef967d9f | ||
|
|
2d733795c7 | ||
|
|
7ce85fe5f2 | ||
|
|
e3e30cafdd | ||
|
|
e51ac7de36 | ||
|
|
ee71c79125 | ||
|
|
bce2dec1cd | ||
|
|
3f2d0ef520 | ||
|
|
bbb3ad9333 | ||
|
|
b7e62df371 | ||
|
|
7b3405ca25 | ||
|
|
9984b53070 | ||
|
|
5e1aef1953 | ||
|
|
4c13a3a779 | ||
|
|
100719ac1f | ||
|
|
a13f581a65 | ||
|
|
f319ee66ad | ||
|
|
6f249c7b72 | ||
|
|
09e20934d7 | ||
|
|
5b22506b9b | ||
|
|
13a913428e | ||
|
|
5667f1b118 | ||
|
|
fcb8e4ca64 | ||
|
|
c5e8b217e3 | ||
|
|
f98b6b0e2a | ||
|
|
f01d8174e8 | ||
|
|
ccf790a630 | ||
|
|
efe80a534c | ||
|
|
1aac01ead0 | ||
|
|
216c43eea6 | ||
|
|
5b2a8cdacb | ||
|
|
d2da4f7e52 | ||
|
|
186019da7f | ||
|
|
7d1772cb54 | ||
|
|
cd30c47951 | ||
|
|
4b11147b83 | ||
|
|
6d7a5f07f0 | ||
|
|
26f0605d72 | ||
|
|
4959053ce0 | ||
|
|
10c9b2addd | ||
|
|
3092b59622 | ||
|
|
8b086e0e49 | ||
|
|
981c3595a8 | ||
|
|
96b674114c | ||
|
|
456086fb3c | ||
|
|
341b9a7449 |
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-clickhouse</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-clickhouse</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-cockroach</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-db2</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-db2</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-h2</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-hana</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-hana</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-mariadb</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mariadb</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-mysql</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mysql</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-nuodb</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-nuodb</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-oracle</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-oracle</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-postgres</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-sqlite</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlite</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-sqlserver</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-yugabyte</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +35,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean (all platforms)</name>
|
||||
@@ -16,13 +16,19 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-joda-time</artifactId>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,18 +41,18 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<scm>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
</project>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>composites</artifactId>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
|
||||
@@ -5,7 +5,6 @@ import io.avaje.lang.Nullable;
|
||||
import io.ebean.annotation.TxIsolation;
|
||||
import io.ebean.cache.ServerCacheManager;
|
||||
import io.ebean.plugin.Property;
|
||||
import io.ebean.text.csv.CsvReader;
|
||||
import io.ebean.text.json.JsonContext;
|
||||
|
||||
import javax.persistence.OptimisticLockException;
|
||||
@@ -785,12 +784,6 @@ public final class DB {
|
||||
return getDefault().createUpdate(beanType, ormUpdate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a CsvReader for a given beanType.
|
||||
*/
|
||||
public static <T> CsvReader<T> createCsvReader(Class<T> beanType) {
|
||||
return getDefault().createCsvReader(beanType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a named query.
|
||||
|
||||
@@ -9,7 +9,6 @@ import io.ebean.config.DatabaseConfig;
|
||||
import io.ebean.meta.MetaInfoManager;
|
||||
import io.ebean.plugin.Property;
|
||||
import io.ebean.plugin.SpiServer;
|
||||
import io.ebean.text.csv.CsvReader;
|
||||
import io.ebean.text.json.JsonContext;
|
||||
|
||||
import javax.persistence.OptimisticLockException;
|
||||
@@ -204,10 +203,6 @@ public interface Database {
|
||||
*/
|
||||
<T> T createEntityBean(Class<T> type);
|
||||
|
||||
/**
|
||||
* Create a CsvReader for a given beanType.
|
||||
*/
|
||||
<T> CsvReader<T> createCsvReader(Class<T> beanType);
|
||||
|
||||
/**
|
||||
* Create an Update query to perform a bulk update.
|
||||
|
||||
@@ -16,7 +16,6 @@ import static java.lang.System.Logger.Level.ERROR;
|
||||
final class DbContext {
|
||||
|
||||
private static final System.Logger log = EbeanVersion.log;
|
||||
|
||||
static {
|
||||
EbeanVersion.getVersion();
|
||||
}
|
||||
@@ -24,14 +23,9 @@ final class DbContext {
|
||||
private static final DbContext INSTANCE = new DbContext();
|
||||
|
||||
private final ConcurrentHashMap<String, Database> concMap = new ConcurrentHashMap<>();
|
||||
|
||||
private final HashMap<String, Database> syncMap = new HashMap<>();
|
||||
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
/**
|
||||
* The 'default' Database.
|
||||
*/
|
||||
private Database defaultDatabase;
|
||||
|
||||
private DbContext() {
|
||||
@@ -70,9 +64,9 @@ final class DbContext {
|
||||
*/
|
||||
Database getDefault() {
|
||||
if (defaultDatabase == null) {
|
||||
String msg = "The default Database has not been defined?";
|
||||
msg += " This is normally set via the ebean.datasource.default property.";
|
||||
msg += " Otherwise it should be registered programmatically via registerServer()";
|
||||
String msg = "The default Database has not been defined?"
|
||||
+ " This is normally set via the ebean.datasource.default property."
|
||||
+ " Otherwise it should be registered programmatically via registerServer()";
|
||||
throw new PersistenceException(msg);
|
||||
}
|
||||
return defaultDatabase;
|
||||
|
||||
@@ -2,6 +2,28 @@ package io.ebean;
|
||||
|
||||
/**
|
||||
* Thrown when a duplicate is attempted on a unique constraint.
|
||||
* <p>
|
||||
* In terms of catching this exception with the view of continuing processing
|
||||
* using the same transaction look to use {@link Transaction#rollbackAndContinue()}.
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* try (Transaction txn = database.beginTransaction()) {
|
||||
*
|
||||
* try {
|
||||
* ...
|
||||
* database.save(bean);
|
||||
* database.flush();
|
||||
* } catch (DuplicateKeyException e) {
|
||||
* // carry on processing using the transaction
|
||||
* txn.rollbackAndContinue();
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* txn.commit();
|
||||
* }
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
public class DuplicateKeyException extends DataIntegrityException {
|
||||
private static final long serialVersionUID = -4771932723285724817L;
|
||||
|
||||
@@ -144,6 +144,35 @@ public interface Transaction extends AutoCloseable {
|
||||
*/
|
||||
void rollback(Throwable e) throws PersistenceException;
|
||||
|
||||
/**
|
||||
* Performs a rollback on the underlying JDBC connection with the intention of
|
||||
* continuing to use this same transaction and performing a commit or rollback
|
||||
* later to complete the transaction.
|
||||
* <p>
|
||||
* Typically used when catching {@link DuplicateKeyException} where we wish to
|
||||
* rollback work done at that point but carry on processing using the transaction.
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* try (Transaction txn = database.beginTransaction()) {
|
||||
*
|
||||
* try {
|
||||
* ...
|
||||
* database.save(bean);
|
||||
* database.flush();
|
||||
* } catch (DuplicateKeyException e) {
|
||||
* // carry on processing using the transaction
|
||||
* txn.rollbackAndContinue();
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* txn.commit();
|
||||
* }
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
void rollbackAndContinue();
|
||||
|
||||
/**
|
||||
* Set when we want nested transactions to use Savepoint's.
|
||||
* <p>
|
||||
|
||||
@@ -237,7 +237,7 @@ public abstract class AbstractNamingConvention implements NamingConvention {
|
||||
}
|
||||
buffer.append(rhsTableName);
|
||||
|
||||
int maxTableNameLength = databasePlatform.getMaxTableNameLength();
|
||||
int maxTableNameLength = databasePlatform.maxTableNameLength();
|
||||
|
||||
// maxConstraintNameLength is used as the max table name length.
|
||||
if (buffer.length() > maxTableNameLength) {
|
||||
|
||||
@@ -3024,7 +3024,7 @@ public class DatabaseConfig {
|
||||
public PersistBatch appliedPersistBatchOnCascade() {
|
||||
if (persistBatchOnCascade == PersistBatch.INHERIT) {
|
||||
// use the platform default (ALL except SQL Server which has NONE)
|
||||
return databasePlatform.getPersistBatchOnCascade();
|
||||
return databasePlatform.persistBatchOnCascade();
|
||||
}
|
||||
return persistBatchOnCascade;
|
||||
}
|
||||
|
||||
@@ -22,23 +22,6 @@ public class DatabasePlatform {
|
||||
|
||||
private static final System.Logger log = EbeanVersion.log;
|
||||
|
||||
/**
|
||||
* Behavior used when ending a query only transaction (at read committed isolation level).
|
||||
*/
|
||||
public enum OnQueryOnly {
|
||||
|
||||
/**
|
||||
* Rollback the transaction.
|
||||
*/
|
||||
ROLLBACK,
|
||||
|
||||
/**
|
||||
* Commit the transaction
|
||||
*/
|
||||
COMMIT
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set to true for MySql, no other jdbc drivers need this workaround.
|
||||
*/
|
||||
@@ -59,11 +42,6 @@ public class DatabasePlatform {
|
||||
*/
|
||||
protected boolean supportsNativeJavaTime = true;
|
||||
|
||||
/**
|
||||
* The behaviour used when ending a read only transaction at read committed isolation level.
|
||||
*/
|
||||
protected OnQueryOnly onQueryOnly = OnQueryOnly.COMMIT;
|
||||
|
||||
/**
|
||||
* The open quote used by quoted identifiers.
|
||||
*/
|
||||
@@ -288,7 +266,7 @@ public class DatabasePlatform {
|
||||
/**
|
||||
* Return the platform key.
|
||||
*/
|
||||
public Platform getPlatform() {
|
||||
public Platform platform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
@@ -298,14 +276,14 @@ public class DatabasePlatform {
|
||||
* "generic" is returned when no specific database platform has been set or found.
|
||||
* </p>
|
||||
*/
|
||||
public String getName() {
|
||||
public String name() {
|
||||
return platform.name().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if we are using Sequence batch mode rather than STEP.
|
||||
*/
|
||||
public boolean isSequenceBatchMode() {
|
||||
public boolean sequenceBatchMode() {
|
||||
return sequenceBatchMode;
|
||||
}
|
||||
|
||||
@@ -319,52 +297,52 @@ public class DatabasePlatform {
|
||||
/**
|
||||
* Return true if this database platform supports native ILIKE expression.
|
||||
*/
|
||||
public boolean isSupportsNativeIlike() {
|
||||
public boolean supportsNativeIlike() {
|
||||
return supportsNativeIlike;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the platform supports delete statements with table alias.
|
||||
*/
|
||||
public boolean isSupportsDeleteTableAlias() {
|
||||
public boolean supportsDeleteTableAlias() {
|
||||
return supportsDeleteTableAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the collation is case sensitive.
|
||||
* Return true if the collation is case-sensitive.
|
||||
* <p>
|
||||
* This is expected to be used for testing only.
|
||||
* </p>
|
||||
*/
|
||||
public boolean isCaseSensitiveCollation() {
|
||||
public boolean caseSensitiveCollation() {
|
||||
return caseSensitiveCollation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the platform supports SavepointId values.
|
||||
*/
|
||||
public boolean isSupportsSavepointId() {
|
||||
public boolean supportsSavepointId() {
|
||||
return supportsSavepointId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if migrations should use stored procedures.
|
||||
*/
|
||||
public boolean isUseMigrationStoredProcedures() {
|
||||
public boolean useMigrationStoredProcedures() {
|
||||
return useMigrationStoredProcedures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the platform supports LIMIT with sql update.
|
||||
*/
|
||||
public boolean isInlineSqlUpdateLimit() {
|
||||
public boolean inlineSqlUpdateLimit() {
|
||||
return inlineSqlUpdateLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the maximum number of bind values this database platform allows or zero for no limit.
|
||||
*/
|
||||
public int getMaxInBinding() {
|
||||
public int maxInBinding() {
|
||||
return maxInBinding;
|
||||
}
|
||||
|
||||
@@ -374,14 +352,14 @@ public class DatabasePlatform {
|
||||
* This is used when deriving names of intersection tables.
|
||||
* </p>
|
||||
*/
|
||||
public int getMaxTableNameLength() {
|
||||
public int maxTableNameLength() {
|
||||
return maxTableNameLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the maximum constraint name allowed for the platform.
|
||||
*/
|
||||
public int getMaxConstraintNameLength() {
|
||||
public int maxConstraintNameLength() {
|
||||
return maxConstraintNameLength;
|
||||
}
|
||||
|
||||
@@ -409,24 +387,10 @@ public class DatabasePlatform {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the behaviour to use when ending a read only transaction.
|
||||
*/
|
||||
public OnQueryOnly getOnQueryOnly() {
|
||||
return onQueryOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the behaviour to use when ending a read only transaction.
|
||||
*/
|
||||
public void setOnQueryOnly(OnQueryOnly onQueryOnly) {
|
||||
this.onQueryOnly = onQueryOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DbEncrypt handler for this DB platform.
|
||||
*/
|
||||
public DbEncrypt getDbEncrypt() {
|
||||
public DbEncrypt dbEncrypt() {
|
||||
return dbEncrypt;
|
||||
}
|
||||
|
||||
@@ -440,7 +404,7 @@ public class DatabasePlatform {
|
||||
/**
|
||||
* Return the history support for this database platform.
|
||||
*/
|
||||
public DbHistorySupport getHistorySupport() {
|
||||
public DbHistorySupport historySupport() {
|
||||
return historySupport;
|
||||
}
|
||||
|
||||
@@ -454,14 +418,14 @@ public class DatabasePlatform {
|
||||
/**
|
||||
* So no except for Postgres and CockroachDB.
|
||||
*/
|
||||
public boolean isNativeArrayType() {
|
||||
public boolean nativeArrayType() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the DB supports native UUID.
|
||||
*/
|
||||
public boolean isNativeUuidType() {
|
||||
public boolean nativeUuidType() {
|
||||
return nativeUuidType;
|
||||
}
|
||||
|
||||
@@ -470,21 +434,21 @@ public class DatabasePlatform {
|
||||
*
|
||||
* @return the db type map
|
||||
*/
|
||||
public DbPlatformTypeMapping getDbTypeMap() {
|
||||
public DbPlatformTypeMapping dbTypeMap() {
|
||||
return dbTypeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the mapping for DB column default values.
|
||||
*/
|
||||
public DbDefaultValue getDbDefaultValue() {
|
||||
public DbDefaultValue dbDefaultValue() {
|
||||
return dbDefaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the column alias prefix.
|
||||
*/
|
||||
public String getColumnAliasPrefix() {
|
||||
public String columnAliasPrefix() {
|
||||
return columnAliasPrefix;
|
||||
}
|
||||
|
||||
@@ -498,21 +462,21 @@ public class DatabasePlatform {
|
||||
/**
|
||||
* Return the close quote for quoted identifiers.
|
||||
*/
|
||||
public String getCloseQuote() {
|
||||
public String closeQuote() {
|
||||
return closeQuote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the open quote for quoted identifiers.
|
||||
*/
|
||||
public String getOpenQuote() {
|
||||
public String openQuote() {
|
||||
return openQuote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the JDBC type used to store booleans.
|
||||
*/
|
||||
public int getBooleanDbType() {
|
||||
public int booleanDbType() {
|
||||
return booleanDbType;
|
||||
}
|
||||
|
||||
@@ -523,7 +487,7 @@ public class DatabasePlatform {
|
||||
* example.
|
||||
* </p>
|
||||
*/
|
||||
public int getBlobDbType() {
|
||||
public int blobDbType() {
|
||||
return blobDbType;
|
||||
}
|
||||
|
||||
@@ -533,7 +497,7 @@ public class DatabasePlatform {
|
||||
* This is typically Types.CLOB but for Postgres is Types.VARCHAR.
|
||||
* </p>
|
||||
*/
|
||||
public int getClobDbType() {
|
||||
public int clobDbType() {
|
||||
return clobDbType;
|
||||
}
|
||||
|
||||
@@ -542,7 +506,7 @@ public class DatabasePlatform {
|
||||
* expanded form of (a=? and b=?) or (a=? and b=?) or ... rather than (a,b) in
|
||||
* ((?,?),(?,?),...);
|
||||
*/
|
||||
public boolean isIdInExpandedForm() {
|
||||
public boolean idInExpandedForm() {
|
||||
return idInExpandedForm;
|
||||
}
|
||||
|
||||
@@ -553,7 +517,7 @@ public class DatabasePlatform {
|
||||
* This specifically is required for MySql when processing large results.
|
||||
* </p>
|
||||
*/
|
||||
public boolean isForwardOnlyHintOnFindIterate() {
|
||||
public boolean forwardOnlyHintOnFindIterate() {
|
||||
return forwardOnlyHintOnFindIterate;
|
||||
}
|
||||
|
||||
@@ -571,7 +535,7 @@ public class DatabasePlatform {
|
||||
* This specifically is required for Hana which doesn't support CONCUR_UPDATABLE
|
||||
* </p>
|
||||
*/
|
||||
public boolean isSupportsResultSetConcurrencyModeUpdatable() {
|
||||
public boolean supportsResultSetConcurrencyModeUpdatable() {
|
||||
return supportsResultSetConcurrencyModeUpdatable;
|
||||
}
|
||||
|
||||
@@ -591,7 +555,7 @@ public class DatabasePlatform {
|
||||
*
|
||||
* @return the db identity
|
||||
*/
|
||||
public DbIdentity getDbIdentity() {
|
||||
public DbIdentity dbIdentity() {
|
||||
return dbIdentity;
|
||||
}
|
||||
|
||||
@@ -604,14 +568,14 @@ public class DatabasePlatform {
|
||||
*
|
||||
* @return the sql limiter
|
||||
*/
|
||||
public SqlLimiter getSqlLimiter() {
|
||||
public SqlLimiter sqlLimiter() {
|
||||
return sqlLimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BasicSqlLimiter for limit/offset of SqlQuery queries.
|
||||
*/
|
||||
public BasicSqlLimiter getBasicSqlLimiter() {
|
||||
public BasicSqlLimiter basicSqlLimiter() {
|
||||
return basicSqlLimiter;
|
||||
}
|
||||
|
||||
@@ -680,14 +644,14 @@ public class DatabasePlatform {
|
||||
/**
|
||||
* Set to true if select count against anonymous view requires an alias.
|
||||
*/
|
||||
public boolean isSelectCountWithAlias() {
|
||||
public boolean selectCountWithAlias() {
|
||||
return selectCountWithAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if select count with subquery needs column alias (SQL Server).
|
||||
*/
|
||||
public boolean isSelectCountWithColumnAlias() {
|
||||
public boolean selectCountWithColumnAlias() {
|
||||
return selectCountWithColumnAlias;
|
||||
}
|
||||
|
||||
@@ -718,14 +682,14 @@ public class DatabasePlatform {
|
||||
* <p>
|
||||
* This may include an escape clause to disable a default escape character.
|
||||
*/
|
||||
public String getLikeClause(boolean rawLikeExpression) {
|
||||
public String likeClause(boolean rawLikeExpression) {
|
||||
return rawLikeExpression ? likeClauseRaw : likeClauseEscaped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the platform default JDBC batch mode for persist cascade.
|
||||
*/
|
||||
public PersistBatch getPersistBatchOnCascade() {
|
||||
public PersistBatch persistBatchOnCascade() {
|
||||
return persistBatchOnCascade;
|
||||
}
|
||||
|
||||
@@ -769,19 +733,6 @@ public class DatabasePlatform {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the table exists.
|
||||
*/
|
||||
public boolean tableExists(Connection connection, String catalog, String schema, String table) throws SQLException {
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
ResultSet tables = metaData.getTables(catalog, schema, table, null);
|
||||
try {
|
||||
return tables.next();
|
||||
} finally {
|
||||
JdbcClose.close(tables);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes the like string for this DB-Platform
|
||||
*/
|
||||
|
||||
@@ -122,9 +122,7 @@ public final class ShutdownManager {
|
||||
// Already run shutdown...
|
||||
return;
|
||||
}
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "Ebean shutting down");
|
||||
}
|
||||
log.log(DEBUG, "Ebean shutting down");
|
||||
stopping = true;
|
||||
deregisterShutdownHook();
|
||||
|
||||
|
||||
@@ -39,18 +39,6 @@ public interface ExpressionPath {
|
||||
*/
|
||||
StringParser stringParser();
|
||||
|
||||
/**
|
||||
* For DateTime capable scalar types convert the long systemTimeMillis into
|
||||
* an appropriate java time (Date,Timestamp,Time,Calendar, JODA type etc).
|
||||
*/
|
||||
Object parseDateTime(long systemTimeMillis);
|
||||
|
||||
/**
|
||||
* Return true if the last type is "DateTime capable" - can support
|
||||
* {@link #parseDateTime(long)}.
|
||||
*/
|
||||
boolean isDateTimeCapable();
|
||||
|
||||
/**
|
||||
* Return the underlying JDBC type or 0 if this is not a scalar type.
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@ package io.ebean.text;
|
||||
* Basic interface to support CSV, JSON and XML processing.
|
||||
* </p>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface StringFormatter {
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ package io.ebean.text;
|
||||
* <p>
|
||||
* Basic interface to support CSV, JSON and XML processing.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface StringParser {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,171 +0,0 @@
|
||||
package io.ebean.text.csv;
|
||||
|
||||
import io.ebean.text.StringParser;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Reads CSV data turning it into object graphs that you can be saved (inserted)
|
||||
* or processed yourself.
|
||||
* <p>
|
||||
* This first example doesn't use a {@link CsvCallback} and this means it will
|
||||
* automatically create a transaction, save the customers and commit the
|
||||
* transaction when successful.
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
* try {
|
||||
* File f = new File("src/test/resources/test1.csv");
|
||||
*
|
||||
* FileReader reader = new FileReader(f, encoding);
|
||||
*
|
||||
* CsvReader<Customer> csvReader = DB.createCsvReader(Customer.class);
|
||||
*
|
||||
* csvReader.setPersistBatchSize(20);
|
||||
*
|
||||
* csvReader.addProperty("status");
|
||||
* // ignore the next property
|
||||
* csvReader.addIgnore();
|
||||
* csvReader.addProperty("name");
|
||||
* csvReader.addDateTime("anniversary", "dd-MMM-yyyy");
|
||||
* csvReader.addProperty("billingAddress.line1");
|
||||
* csvReader.addProperty("billingAddress.city");
|
||||
*
|
||||
* csvReader.process(reader);
|
||||
*
|
||||
* } catch (Exception e) {
|
||||
* throw new RuntimeException(e);
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* @param <T> the entity bean type
|
||||
*/
|
||||
public interface CsvReader<T> {
|
||||
|
||||
/**
|
||||
* Explicitly set the default Locale.
|
||||
*/
|
||||
void setDefaultLocale(Locale defaultLocale);
|
||||
|
||||
/**
|
||||
* Set the default format to use for Time types.
|
||||
*/
|
||||
void setDefaultTimeFormat(String defaultTimeFormat);
|
||||
|
||||
/**
|
||||
* Set the default format to use for Date types.
|
||||
*/
|
||||
void setDefaultDateFormat(String defaultDateFormat);
|
||||
|
||||
/**
|
||||
* Set the default format to use for Timestamp types.
|
||||
*/
|
||||
void setDefaultTimestampFormat(String defaultTimestampFormat);
|
||||
|
||||
/**
|
||||
* Set the batch size for using JDBC statement batching.
|
||||
* <p>
|
||||
* By default this is set to 20 and setting this to 1 will disable the use of
|
||||
* JDBC statement batching.
|
||||
* </p>
|
||||
*/
|
||||
void setPersistBatchSize(int persistBatchSize);
|
||||
|
||||
/**
|
||||
* Set to true if there is a header row that should be ignored.
|
||||
* <p>
|
||||
* If addPropertiesFromHeader is true then all the properties are added using
|
||||
* the default time,date and timestamp formats.
|
||||
* <p>
|
||||
* If you have a mix of dateTime formats you can not use this method and must
|
||||
* add the properties yourself.
|
||||
* </p>
|
||||
*/
|
||||
void setHasHeader(boolean hasHeader, boolean addPropertiesFromHeader);
|
||||
|
||||
/**
|
||||
* Same as setHasHeader(true,true);
|
||||
* <p>
|
||||
* This will use a header to define all the properties to load using the
|
||||
* default formats for time, date and datetime types.
|
||||
* </p>
|
||||
*/
|
||||
void setAddPropertiesFromHeader();
|
||||
|
||||
/**
|
||||
* Same as setHasHeader(true, false);
|
||||
* <p>
|
||||
* This indicates that there is a header but that it should be ignored.
|
||||
* </p>
|
||||
*/
|
||||
void setIgnoreHeader();
|
||||
|
||||
/**
|
||||
* Set the frequency with which a INFO message will be logged showing the
|
||||
* progress of the processing. You might set this to 1000 or 10000 etc.
|
||||
* <p>
|
||||
* If this is not set then no INFO messages will be logged.
|
||||
* </p>
|
||||
*/
|
||||
void setLogInfoFrequency(int logInfoFrequency);
|
||||
|
||||
/**
|
||||
* Ignore the next column of data.
|
||||
*/
|
||||
void addIgnore();
|
||||
|
||||
/**
|
||||
* Define the property which will be loaded from the next column of data.
|
||||
* <p>
|
||||
* This takes into account the data type of the property and handles the
|
||||
* String to object conversion automatically.
|
||||
* </p>
|
||||
*/
|
||||
void addProperty(String propertyName);
|
||||
|
||||
/**
|
||||
* Define the next property and use a custom StringParser to convert the
|
||||
* string content into the appropriate type for the property.
|
||||
*/
|
||||
void addProperty(String propertyName, StringParser parser);
|
||||
|
||||
/**
|
||||
* Add a property with a custom Date/Time/Timestamp format using the default
|
||||
* Locale. This will convert the string into the appropriate java type for the
|
||||
* given property (Date, Calendar, SQL Date, Time, Timestamp, JODA etc).
|
||||
*/
|
||||
void addDateTime(String propertyName, String dateTimeFormat);
|
||||
|
||||
/**
|
||||
* Add a property with a custom Date/Time/Timestamp format. This will convert
|
||||
* the string into the appropriate java type for the given property (Date,
|
||||
* Calendar, SQL Date, Time, Timestamp, JODA etc).
|
||||
*/
|
||||
void addDateTime(String propertyName, String dateTimeFormat, Locale locale);
|
||||
|
||||
/**
|
||||
* Automatically create a transaction if required to process all the CSV
|
||||
* content from the reader.
|
||||
* <p>
|
||||
* This will check for a current transaction. If there is no current
|
||||
* transaction then one is started and will commit (or rollback) at the end of
|
||||
* processing. This will also set the persistBatchSize on the transaction.
|
||||
* </p>
|
||||
*/
|
||||
void process(Reader reader) throws Exception;
|
||||
|
||||
/**
|
||||
* Process the CSV content passing the bean to the CsvCallback after each row.
|
||||
* <p>
|
||||
* This provides you with the ability to modify and process the bean.
|
||||
* </p>
|
||||
* <p>
|
||||
* When using a CsvCallback the reader WILL NOT create a transaction or save
|
||||
* the bean(s) for you. If you want to insert the processed beans you must
|
||||
* create your own transaction and save the bean(s) yourself.
|
||||
* </p>
|
||||
*/
|
||||
void process(Reader reader, CsvCallback<T> callback) throws Exception;
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/**
|
||||
* CSV processing objects.
|
||||
*/
|
||||
package io.ebean.text.csv;
|
||||
@@ -40,7 +40,6 @@ module io.ebean.api {
|
||||
exports io.ebean.service;
|
||||
exports io.ebean.text;
|
||||
exports io.ebean.text.json;
|
||||
exports io.ebean.text.csv;
|
||||
exports io.ebean.util;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</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.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
|
||||
<name>ebean autotune</name>
|
||||
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+21
-15
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
@@ -89,88 +89,94 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-joda-time</artifactId>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-xml</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -26,6 +26,13 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.avaje</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
+28
-108
@@ -1,8 +1,5 @@
|
||||
package io.ebeaninternal.server.core;
|
||||
package io.ebean.core.type;
|
||||
|
||||
import io.ebeaninternal.server.type.ScalarTypeUUIDBinary;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Timestamp;
|
||||
@@ -14,14 +11,9 @@ import java.util.Calendar;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Default implementation of TypeConverter.
|
||||
* <p>
|
||||
* Converts objects to the required type if required.
|
||||
* </p>
|
||||
* Helper to converts objects to the basic types if required.
|
||||
*/
|
||||
public final class BasicTypeConverter implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7691463236204070311L;
|
||||
public final class BasicTypeConverter {
|
||||
|
||||
/**
|
||||
* Type code for java.util.Calendar.
|
||||
@@ -43,7 +35,6 @@ public final class BasicTypeConverter implements Serializable {
|
||||
* @param toDataType the dataType as per java.sql.Types.
|
||||
*/
|
||||
public static Object convert(Object value, int toDataType) {
|
||||
|
||||
try {
|
||||
switch (toDataType) {
|
||||
case UTIL_DATE: {
|
||||
@@ -58,7 +49,8 @@ public final class BasicTypeConverter implements Serializable {
|
||||
case Types.INTEGER: {
|
||||
return toInteger(value);
|
||||
}
|
||||
case Types.BIT: {
|
||||
case Types.BIT:
|
||||
case Types.BOOLEAN: {
|
||||
return toBoolean(value);
|
||||
}
|
||||
case Types.TINYINT: {
|
||||
@@ -67,59 +59,42 @@ public final class BasicTypeConverter implements Serializable {
|
||||
case Types.SMALLINT: {
|
||||
return toShort(value);
|
||||
}
|
||||
case Types.NUMERIC: {
|
||||
return toBigDecimal(value);
|
||||
}
|
||||
case Types.NUMERIC:
|
||||
case Types.DECIMAL: {
|
||||
return toBigDecimal(value);
|
||||
}
|
||||
case Types.REAL: {
|
||||
return toFloat(value);
|
||||
}
|
||||
case Types.DOUBLE: {
|
||||
return toDouble(value);
|
||||
}
|
||||
case Types.DOUBLE:
|
||||
case Types.FLOAT: {
|
||||
return toDouble(value);
|
||||
}
|
||||
case Types.BOOLEAN: {
|
||||
return toBoolean(value);
|
||||
}
|
||||
case Types.TIMESTAMP: {
|
||||
return toTimestamp(value);
|
||||
}
|
||||
case Types.DATE: {
|
||||
return toDate(value);
|
||||
}
|
||||
case Types.VARCHAR: {
|
||||
return toString(value);
|
||||
}
|
||||
case Types.VARCHAR:
|
||||
case Types.CHAR: {
|
||||
return toString(value);
|
||||
}
|
||||
case Types.OTHER: {
|
||||
return value;
|
||||
}
|
||||
case Types.JAVA_OBJECT: {
|
||||
return value;
|
||||
}
|
||||
case Types.OTHER:
|
||||
case Types.BINARY:
|
||||
case Types.LONGVARBINARY:
|
||||
case Types.BLOB: {
|
||||
return value;
|
||||
}
|
||||
case Types.BLOB:
|
||||
case Types.JAVA_OBJECT:
|
||||
case Types.LONGVARCHAR:
|
||||
case Types.CLOB: {
|
||||
return value;
|
||||
}
|
||||
default: {
|
||||
String msg = "Unhandled data type [" + toDataType + "] converting [" + value + "]";
|
||||
throw new RuntimeException(msg);
|
||||
throw new RuntimeException("Unhandled data type - " + toDataType);
|
||||
}
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
String m = "ClassCastException converting to data type [" + toDataType + "] value [" + value + "]";
|
||||
throw new RuntimeException(m);
|
||||
throw new RuntimeException("ClassCastException converting to data type: " + toDataType + " value: " + value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +102,6 @@ public final class BasicTypeConverter implements Serializable {
|
||||
* Convert the value to a String.
|
||||
*/
|
||||
public static String toString(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -137,7 +111,6 @@ public final class BasicTypeConverter implements Serializable {
|
||||
if (value instanceof char[]) {
|
||||
return String.valueOf((char[]) value);
|
||||
}
|
||||
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@@ -145,8 +118,7 @@ public final class BasicTypeConverter implements Serializable {
|
||||
/**
|
||||
* Convert the value to a Boolean with an explicit String true value.
|
||||
*/
|
||||
public static Boolean toBoolean(Object value, String dbTrueValue) {
|
||||
|
||||
public static Boolean toBoolean(Object value, String trueValue) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -156,8 +128,7 @@ public final class BasicTypeConverter implements Serializable {
|
||||
if (value instanceof Number) {
|
||||
return ((Number) value).intValue() == 1;
|
||||
}
|
||||
String s = value.toString();
|
||||
return s.equalsIgnoreCase(dbTrueValue);
|
||||
return value.toString().equalsIgnoreCase(trueValue);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,14 +136,12 @@ public final class BasicTypeConverter implements Serializable {
|
||||
* "true" or "false".
|
||||
*/
|
||||
public static Boolean toBoolean(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof Boolean) {
|
||||
return (Boolean) value;
|
||||
}
|
||||
|
||||
return Boolean.valueOf(value.toString());
|
||||
}
|
||||
|
||||
@@ -180,7 +149,6 @@ public final class BasicTypeConverter implements Serializable {
|
||||
* Convert the value to a UUID.
|
||||
*/
|
||||
public static UUID toUUID(Object value, boolean optimizedBinary) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -191,17 +159,15 @@ public final class BasicTypeConverter implements Serializable {
|
||||
return UUID.fromString((String) value);
|
||||
}
|
||||
if (value instanceof byte[]) {
|
||||
return ScalarTypeUUIDBinary.convertFromBytes((byte[]) value, optimizedBinary);
|
||||
return ScalarTypeUtils.uuidFromBytes((byte[]) value, optimizedBinary);
|
||||
}
|
||||
return UUID.fromString(value.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* convert the passed in object to a BigDecimal. It should be another
|
||||
* numeric type.
|
||||
* convert the passed in object to a BigDecimal. It should be another numeric type.
|
||||
*/
|
||||
public static BigDecimal toBigDecimal(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -212,7 +178,6 @@ public final class BasicTypeConverter implements Serializable {
|
||||
}
|
||||
|
||||
public static Float toFloat(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -226,7 +191,6 @@ public final class BasicTypeConverter implements Serializable {
|
||||
}
|
||||
|
||||
public static Short toShort(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -240,7 +204,6 @@ public final class BasicTypeConverter implements Serializable {
|
||||
}
|
||||
|
||||
public static Byte toByte(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -251,11 +214,9 @@ public final class BasicTypeConverter implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* convert the passed in object to a Integer. It should be another numeric
|
||||
* type.
|
||||
* convert the passed in object to an Integer.
|
||||
*/
|
||||
public static Integer toInteger(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -269,10 +230,9 @@ public final class BasicTypeConverter implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the object to a Long. It should be another numeric type.
|
||||
* Convert the object to a Long.
|
||||
*/
|
||||
public static Long toLong(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -294,8 +254,7 @@ public final class BasicTypeConverter implements Serializable {
|
||||
return Long.valueOf(value.toString());
|
||||
}
|
||||
|
||||
public static BigInteger toMathBigInteger(Object value) {
|
||||
|
||||
public static BigInteger toBigInteger(Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -306,10 +265,9 @@ public final class BasicTypeConverter implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the object to a Double. It should be another numberic type.
|
||||
* Convert the object to a Double.
|
||||
*/
|
||||
public static Double toDouble(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -323,56 +281,42 @@ public final class BasicTypeConverter implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* convert the passed in object to a Timestamp. It is expected to be a
|
||||
* java.sql.Date really.
|
||||
* convert the passed in object to a Timestamp.
|
||||
*/
|
||||
public static Timestamp toTimestamp(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof Timestamp) {
|
||||
return (Timestamp) value;
|
||||
|
||||
} else if (value instanceof java.util.Date) {
|
||||
// no nanos here... so hopefully ok
|
||||
return new Timestamp(((java.util.Date) value).getTime());
|
||||
|
||||
} else if (value instanceof Calendar) {
|
||||
return new Timestamp(((Calendar) value).getTime().getTime());
|
||||
|
||||
} else if (value instanceof String) {
|
||||
return Timestamp.valueOf((String) value);
|
||||
|
||||
} else if (value instanceof LocalDateTime) {
|
||||
return Timestamp.valueOf((LocalDateTime) value);
|
||||
|
||||
} else if (value instanceof Number) {
|
||||
return new Timestamp(((Number) value).longValue());
|
||||
|
||||
} else {
|
||||
String msg = "Unable to convert [" + value.getClass().getName() + "] into a Timestamp.";
|
||||
throw new RuntimeException(msg);
|
||||
throw new RuntimeException("Unable to convert " + value);
|
||||
}
|
||||
}
|
||||
|
||||
public static java.sql.Time toTime(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof java.sql.Time) {
|
||||
return (java.sql.Time) value;
|
||||
|
||||
} else if (value instanceof String) {
|
||||
return java.sql.Time.valueOf((String) value);
|
||||
|
||||
} else if (value instanceof LocalTime) {
|
||||
return java.sql.Time.valueOf((LocalTime) value);
|
||||
|
||||
} else {
|
||||
String m = "Unable to convert [" + value.getClass().getName() + "] into a java.sql.Date.";
|
||||
throw new RuntimeException(m);
|
||||
throw new RuntimeException("Unable to convert " + value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,31 +324,23 @@ public final class BasicTypeConverter implements Serializable {
|
||||
* convert the passed in object to a java sql Date.
|
||||
*/
|
||||
public static java.sql.Date toDate(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof java.sql.Date) {
|
||||
return (java.sql.Date) value;
|
||||
|
||||
} else if (value instanceof java.util.Date) {
|
||||
return new java.sql.Date(((java.util.Date) value).getTime());
|
||||
|
||||
} else if (value instanceof Calendar) {
|
||||
return new java.sql.Date(((Calendar) value).getTime().getTime());
|
||||
|
||||
} else if (value instanceof String) {
|
||||
return java.sql.Date.valueOf((String) value);
|
||||
|
||||
} else if (value instanceof Number) {
|
||||
return new java.sql.Date(((Number) value).longValue());
|
||||
|
||||
} else if (value instanceof LocalDate) {
|
||||
return java.sql.Date.valueOf((LocalDate)value);
|
||||
|
||||
return java.sql.Date.valueOf((LocalDate) value);
|
||||
} else {
|
||||
String m = "Unable to convert [" + value.getClass().getName() + "] into a java.sql.Date.";
|
||||
throw new RuntimeException(m);
|
||||
throw new RuntimeException("Unable to convert " + value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,7 +348,6 @@ public final class BasicTypeConverter implements Serializable {
|
||||
* convert the passed in object to a java sql Date.
|
||||
*/
|
||||
public static java.util.Date toUtilDate(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -420,26 +355,19 @@ public final class BasicTypeConverter implements Serializable {
|
||||
// loss of nanos precision
|
||||
return new java.util.Date(((java.sql.Timestamp) value).getTime());
|
||||
}
|
||||
// DEVNOTE: strictly speaking do I need to convert a java.sql.Date to
|
||||
// java.util.Date? equals() is symmetrical so perhaps this is not
|
||||
// really required?
|
||||
if (value instanceof java.sql.Date) {
|
||||
return new java.util.Date(((java.sql.Date) value).getTime());
|
||||
}
|
||||
if (value instanceof java.util.Date) {
|
||||
return (java.util.Date) value;
|
||||
|
||||
} else if (value instanceof Calendar) {
|
||||
return ((Calendar) value).getTime();
|
||||
|
||||
} else if (value instanceof String) {
|
||||
return new java.util.Date(Timestamp.valueOf((String) value).getTime());
|
||||
|
||||
} else if (value instanceof Number) {
|
||||
return new java.util.Date(((Number) value).longValue());
|
||||
|
||||
} else {
|
||||
throw new RuntimeException("Unable to convert [" + value.getClass().getName() + "] into a java.util.Date");
|
||||
throw new RuntimeException("Unable to convert " + value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,37 +375,29 @@ public final class BasicTypeConverter implements Serializable {
|
||||
* convert the passed in object to a java sql Date.
|
||||
*/
|
||||
public static Calendar toCalendar(Object value) {
|
||||
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof Calendar) {
|
||||
return (Calendar) value;
|
||||
|
||||
} else if (value instanceof java.util.Date) {
|
||||
java.util.Date date = ((java.util.Date) value);
|
||||
return toCalendarFromDate(date);
|
||||
|
||||
} else if (value instanceof String) {
|
||||
java.util.Date date = toUtilDate(value);
|
||||
return toCalendarFromDate(date);
|
||||
|
||||
} else if (value instanceof Number) {
|
||||
long timeMillis = ((Number) value).longValue();
|
||||
java.util.Date date = new java.util.Date(timeMillis);
|
||||
return toCalendarFromDate(date);
|
||||
|
||||
} else {
|
||||
String m = "Unable to convert [" + value.getClass().getName() + "] into a java.util.Date";
|
||||
throw new RuntimeException(m);
|
||||
throw new RuntimeException("Unable to convert " + value);
|
||||
}
|
||||
}
|
||||
|
||||
private static Calendar toCalendarFromDate(java.util.Date date) {
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
|
||||
return cal;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.ebean.core.type;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
|
||||
import io.ebean.text.StringFormatter;
|
||||
import io.ebean.text.StringParser;
|
||||
|
||||
@@ -34,7 +33,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
/**
|
||||
* Return true for types that do mutation detection based on json content.
|
||||
*/
|
||||
default boolean isJsonMapper() {
|
||||
default boolean jsonMapper() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -42,14 +41,14 @@ 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.
|
||||
*/
|
||||
default boolean isBinaryType() {
|
||||
default boolean binary() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a mutable scalar type (like hstore).
|
||||
*/
|
||||
default boolean isMutable() {
|
||||
default boolean mutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -67,7 +66,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
* If a BeanProperty has no explicit length defined then this length should
|
||||
* be assigned.
|
||||
*/
|
||||
default int getLength() {
|
||||
default int length() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -77,7 +76,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
* If it is native to JDBC then its values/instances do not need to be
|
||||
* converted to and from an associated JDBC type.
|
||||
*/
|
||||
boolean isJdbcNative();
|
||||
boolean jdbcNative();
|
||||
|
||||
/**
|
||||
* Return the type as per java.sql.Types that this maps to.
|
||||
@@ -85,14 +84,19 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
* This type should be consistent with the toJdbcType() method in converting
|
||||
* the type to the appropriate type for binding to preparedStatements.
|
||||
*/
|
||||
int getJdbcType();
|
||||
int jdbcType();
|
||||
|
||||
/**
|
||||
* Return the type that matches the bean property type.
|
||||
* <p>
|
||||
* This represents the 'logical' type rather than the JDBC type this maps to.
|
||||
*/
|
||||
Class<T> getType();
|
||||
Class<T> type();
|
||||
|
||||
/**
|
||||
* Return the type this maps to for JSON document stores.
|
||||
*/
|
||||
DocPropertyType docType();
|
||||
|
||||
/**
|
||||
* Read the value from the resultSet and convert if necessary to the logical
|
||||
@@ -101,12 +105,6 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
@Override
|
||||
T read(DataReader reader) throws SQLException;
|
||||
|
||||
/**
|
||||
* Ignore the reading of this value. Typically, this means moving the index
|
||||
* position in the ResultSet.
|
||||
*/
|
||||
void loadIgnore(DataReader reader);
|
||||
|
||||
/**
|
||||
* Convert (if necessary) and bind the value to the preparedStatement.
|
||||
* <p>
|
||||
@@ -135,6 +133,14 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
*/
|
||||
T toBeanType(Object value);
|
||||
|
||||
/**
|
||||
* Convert the string value to the appropriate java object.
|
||||
* <p>
|
||||
* Mostly used to support CSV, JSON and XML parsing.
|
||||
*/
|
||||
@Override
|
||||
T parse(String value);
|
||||
|
||||
/**
|
||||
* Convert the type into a string representation.
|
||||
*/
|
||||
@@ -147,34 +153,10 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
* <p>
|
||||
* This is so that ScalarType also implements the StringFormatter interface.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
String format(Object value);
|
||||
|
||||
/**
|
||||
* Convert the string value to the appropriate java object.
|
||||
* <p>
|
||||
* Mostly used to support CSV, JSON and XML parsing.
|
||||
*/
|
||||
@Override
|
||||
T parse(String value);
|
||||
|
||||
/**
|
||||
* Return the type this maps to for JSON document stores.
|
||||
*/
|
||||
DocPropertyType getDocType();
|
||||
|
||||
/**
|
||||
* Return true if the type can accept long systemTimeMillis input.
|
||||
* <p>
|
||||
* This is used to determine if it is sensible to use the
|
||||
* {@link #convertFromMillis(long)} method.
|
||||
* <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).
|
||||
*/
|
||||
default boolean isDateTimeCapable() {
|
||||
return false;
|
||||
default String format(Object value) {
|
||||
return formatValue((T) value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,15 +166,6 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the systemTimeMillis into the appropriate java object.
|
||||
* <p>
|
||||
* For non dateTime types this will throw an exception.
|
||||
*/
|
||||
default T convertFromMillis(long dateTime) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value from binary input.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package io.ebean.core.type;
|
||||
|
||||
/**
|
||||
* Base ScalarType object.
|
||||
*/
|
||||
public abstract class ScalarTypeBase<T> implements ScalarType<T> {
|
||||
|
||||
protected final Class<T> type;
|
||||
protected final boolean jdbcNative;
|
||||
protected final int jdbcType;
|
||||
|
||||
public ScalarTypeBase(Class<T> type, boolean jdbcNative, int jdbcType) {
|
||||
this.type = type;
|
||||
this.jdbcNative = jdbcNative;
|
||||
this.jdbcType = jdbcType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean jdbcNative() {
|
||||
return jdbcNative;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int jdbcType() {
|
||||
return jdbcType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
}
|
||||
+20
-33
@@ -1,4 +1,4 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
package io.ebean.core.type;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
@@ -7,6 +7,7 @@ import io.ebean.config.JsonConfig;
|
||||
import io.ebean.core.type.DataBinder;
|
||||
import io.ebean.core.type.DataReader;
|
||||
import io.ebean.core.type.DocPropertyType;
|
||||
import io.ebean.core.type.ScalarTypeBase;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -18,15 +19,20 @@ import java.sql.Types;
|
||||
/**
|
||||
* Base class for Date types.
|
||||
*/
|
||||
abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
|
||||
public abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
|
||||
|
||||
protected final JsonConfig.Date mode;
|
||||
|
||||
ScalarTypeBaseDate(JsonConfig.Date mode, Class<T> type, boolean jdbcNative, int jdbcType) {
|
||||
public ScalarTypeBaseDate(JsonConfig.Date mode, Class<T> type, boolean jdbcNative, int jdbcType) {
|
||||
super(type, jdbcNative, jdbcType);
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the value to ISO8601 format.
|
||||
*/
|
||||
protected abstract String toIsoFormat(T value);
|
||||
|
||||
/**
|
||||
* Convert the target value to millis.
|
||||
*/
|
||||
@@ -53,38 +59,27 @@ abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
|
||||
|
||||
@Override
|
||||
public T read(DataReader reader) throws SQLException {
|
||||
Date ts = reader.getDate();
|
||||
return ts == null ? null : convertFromDate(ts);
|
||||
final Date date = reader.getDate();
|
||||
return date == null ? null : convertFromDate(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatValue(T t) {
|
||||
Date date = convertToDate(t);
|
||||
// format all dates into epoch millis
|
||||
long epochMillis = date.getTime();
|
||||
return Long.toString(epochMillis);
|
||||
public String formatValue(T value) {
|
||||
final Date date = convertToDate(value);
|
||||
return Long.toString(date.getTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public T parse(String value) {
|
||||
try {
|
||||
long epochMillis = Long.parseLong(value);
|
||||
return convertFromDate(new Date(epochMillis));
|
||||
return convertFromDate(new Date(Long.parseLong(value)));
|
||||
} catch (NumberFormatException e) {
|
||||
Date date = Date.valueOf(value);
|
||||
return convertFromDate(date);
|
||||
return convertFromDate(Date.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convertFromMillis(long systemTimeMillis) {
|
||||
Date ts = new Date(systemTimeMillis);
|
||||
return convertFromDate(ts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return true;
|
||||
return convertFromDate(new Date(systemTimeMillis));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,13 +100,8 @@ abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the value to ISO8601 format.
|
||||
*/
|
||||
protected abstract String toIsoFormat(T value);
|
||||
|
||||
@Override
|
||||
public DocPropertyType getDocType() {
|
||||
public DocPropertyType docType() {
|
||||
return DocPropertyType.DATE;
|
||||
}
|
||||
|
||||
@@ -120,9 +110,7 @@ abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
|
||||
if (!dataInput.readBoolean()) {
|
||||
return null;
|
||||
} else {
|
||||
long val = dataInput.readLong();
|
||||
Date date = new Date(val);
|
||||
return convertFromDate(date);
|
||||
return convertFromDate(new Date(dataInput.readLong()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,8 +120,7 @@ abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
|
||||
dataOutput.writeBoolean(false);
|
||||
} else {
|
||||
dataOutput.writeBoolean(true);
|
||||
Date date = convertToDate(value);
|
||||
dataOutput.writeLong(date.getTime());
|
||||
dataOutput.writeLong(convertToDate(value).getTime());
|
||||
}
|
||||
}
|
||||
|
||||
+7
-18
@@ -1,11 +1,8 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
package io.ebean.core.type;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import io.ebean.config.JsonConfig;
|
||||
import io.ebean.core.type.DataBinder;
|
||||
import io.ebean.core.type.DataReader;
|
||||
import io.ebean.core.type.DocPropertyType;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -16,16 +13,14 @@ import java.sql.Timestamp;
|
||||
import java.sql.Types;
|
||||
import java.time.Instant;
|
||||
|
||||
import static io.ebeaninternal.server.type.IsoJsonDateTimeParser.parseIso;
|
||||
|
||||
/**
|
||||
* Base type for DateTime types.
|
||||
*/
|
||||
abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
|
||||
public abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
|
||||
|
||||
protected final JsonConfig.DateTime mode;
|
||||
|
||||
ScalarTypeBaseDateTime(JsonConfig.DateTime mode, Class<T> type, boolean jdbcNative, int jdbcType) {
|
||||
public ScalarTypeBaseDateTime(JsonConfig.DateTime mode, Class<T> type, boolean jdbcNative, int jdbcType) {
|
||||
super(type, jdbcNative, jdbcType);
|
||||
this.mode = mode;
|
||||
}
|
||||
@@ -53,7 +48,6 @@ abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
|
||||
/**
|
||||
* Convert from epoch millis to the value.
|
||||
*/
|
||||
@Override
|
||||
public abstract T convertFromMillis(long systemTimeMillis);
|
||||
|
||||
/**
|
||||
@@ -75,7 +69,7 @@ abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
|
||||
* Convert the value to ISO8601 format.
|
||||
*/
|
||||
protected T fromJsonISO8601(String value) {
|
||||
return convertFromInstant(parseIso(value));
|
||||
return convertFromInstant(ScalarTypeUtils.parseInstant(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,7 +95,7 @@ abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
|
||||
* Helper method that given epoch seconds and nanos return a JSON nanos formatted string.
|
||||
*/
|
||||
protected String toJsonNanos(long epochSecs, int nanos) {
|
||||
return DecimalUtils.toDecimal(epochSecs, nanos);
|
||||
return ScalarTypeUtils.toDecimal(epochSecs, nanos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,7 +106,7 @@ abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
|
||||
}
|
||||
case VALUE_NUMBER_FLOAT: {
|
||||
BigDecimal value = parser.getDecimalValue();
|
||||
Timestamp timestamp = DecimalUtils.toTimestamp(value);
|
||||
Timestamp timestamp = ScalarTypeUtils.toTimestamp(value);
|
||||
return convertFromTimestamp(timestamp);
|
||||
}
|
||||
default: {
|
||||
@@ -139,7 +133,7 @@ abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocPropertyType getDocType() {
|
||||
public DocPropertyType docType() {
|
||||
return DocPropertyType.DATETIME;
|
||||
}
|
||||
|
||||
@@ -160,11 +154,6 @@ abstract class ScalarTypeBaseDateTime<T> extends ScalarTypeBase<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
+7
-16
@@ -1,11 +1,7 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
package io.ebean.core.type;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import io.ebean.core.type.DataBinder;
|
||||
import io.ebean.core.type.DataReader;
|
||||
import io.ebean.core.type.DocPropertyType;
|
||||
import io.ebean.text.TextException;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -17,13 +13,13 @@ import java.sql.Types;
|
||||
* Base ScalarType for types which converts to and from a VARCHAR database
|
||||
* column.
|
||||
*/
|
||||
abstract class ScalarTypeBaseVarchar<T> extends ScalarTypeBase<T> {
|
||||
public abstract class ScalarTypeBaseVarchar<T> extends ScalarTypeBase<T> {
|
||||
|
||||
ScalarTypeBaseVarchar(Class<T> type) {
|
||||
public ScalarTypeBaseVarchar(Class<T> type) {
|
||||
super(type, false, Types.VARCHAR);
|
||||
}
|
||||
|
||||
ScalarTypeBaseVarchar(Class<T> type, boolean jdbcNative, int jdbcType) {
|
||||
public ScalarTypeBaseVarchar(Class<T> type, boolean jdbcNative, int jdbcType) {
|
||||
super(type, jdbcNative, jdbcType);
|
||||
}
|
||||
|
||||
@@ -88,12 +84,6 @@ abstract class ScalarTypeBaseVarchar<T> extends ScalarTypeBase<T> {
|
||||
return format(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public String format(Object value) {
|
||||
return formatValue((T) value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T readData(DataInput dataInput) throws IOException {
|
||||
if (!dataInput.readBoolean()) {
|
||||
@@ -108,7 +98,8 @@ abstract class ScalarTypeBaseVarchar<T> extends ScalarTypeBase<T> {
|
||||
if (value == null) {
|
||||
dataOutput.writeBoolean(false);
|
||||
} else {
|
||||
ScalarHelp.writeUTF(dataOutput, convertToDbString(value));
|
||||
dataOutput.writeBoolean(true);
|
||||
dataOutput.writeUTF(convertToDbString(value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +114,7 @@ abstract class ScalarTypeBaseVarchar<T> extends ScalarTypeBase<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocPropertyType getDocType() {
|
||||
public DocPropertyType docType() {
|
||||
return DocPropertyType.TEXT;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
package io.ebean.core.type;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Utilities to aid in the translation of decimal types to/from multiple parts.
|
||||
*
|
||||
* @author Nick Williams
|
||||
* @since 2.2.0
|
||||
*/
|
||||
public final class ScalarTypeUtils {
|
||||
|
||||
private static final char[] ZEROES = new char[]{'0', '0', '0', '0', '0', '0', '0', '0', '0'};
|
||||
|
||||
private static final BigDecimal ONE_BILLION = new BigDecimal(1000000000L);
|
||||
|
||||
private static final DateTimeFormatter ISO_MILLIS = new DateTimeFormatterBuilder()
|
||||
.parseCaseInsensitive()
|
||||
.appendInstant(3)
|
||||
.toFormatter();
|
||||
|
||||
/**
|
||||
* Parse using ISO8601.
|
||||
*/
|
||||
public static Instant parseInstant(String jsonDateTime) {
|
||||
return Instant.parse(jsonDateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format using ISO8601.
|
||||
*/
|
||||
public static String formatInstant(Instant value) {
|
||||
return ISO_MILLIS.format(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert decimal to duration with nanos.
|
||||
*/
|
||||
public static Duration toDuration(BigDecimal value) {
|
||||
long seconds = value.longValue();
|
||||
int nanoseconds = extractNanosecondDecimal(value, seconds);
|
||||
return Duration.ofSeconds(seconds, nanoseconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert duration to decimal with nanos.
|
||||
*/
|
||||
public static BigDecimal toDecimal(Duration instant) {
|
||||
return new BigDecimal(toDecimal(instant.getSeconds(), instant.getNano()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert decimal to timestamp with nanos.
|
||||
*/
|
||||
public static Timestamp toTimestamp(BigDecimal value) {
|
||||
long seconds = value.longValue();
|
||||
int nanoseconds = extractNanosecondDecimal(value, seconds);
|
||||
Timestamp ts = new Timestamp(seconds * 1000);
|
||||
ts.setNanos(nanoseconds);
|
||||
return ts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert timestamp to decimal with nanos.
|
||||
*/
|
||||
public static BigDecimal toDecimal(Timestamp instant) {
|
||||
long millis = instant.getTime();
|
||||
long secs = millis / 1000;
|
||||
return new BigDecimal(toDecimal(secs, instant.getNanos()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to decimal string with nanos.
|
||||
*/
|
||||
public static String toDecimal(long seconds, int nanoseconds) {
|
||||
StringBuilder string = new StringBuilder(Integer.toString(nanoseconds));
|
||||
if (string.length() < 9)
|
||||
string.insert(0, ZEROES, 0, 9 - string.length());
|
||||
return seconds + "." + string;
|
||||
}
|
||||
|
||||
private static int extractNanosecondDecimal(BigDecimal value, long integer) {
|
||||
return value.subtract(new BigDecimal(integer)).multiply(ONE_BILLION).intValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert from byte[] to UUID.
|
||||
*/
|
||||
public static UUID uuidFromBytes(byte[] bytes, boolean optimized) {
|
||||
int usableBytes = Math.min(bytes.length, 16);
|
||||
|
||||
// Need exactly 16 bytes - pad the input if not enough bytes are provided
|
||||
// Use provided bytes in the least significant position; if more than 16 bytes are given,
|
||||
// then use the first 16 bytes from the array;
|
||||
byte[] barr = new byte[16];
|
||||
for (int i = 15, j = usableBytes - 1; j >= 0; i--, j--) {
|
||||
barr[i] = bytes[j];
|
||||
}
|
||||
|
||||
long msb;
|
||||
if (optimized) {
|
||||
msb = ((long)barr[4] << 56) + // XXXXXXXX-____-____-...
|
||||
((long)(barr[5] & 255) << 48) + // -> put at end 4..7 of buf
|
||||
((long)(barr[6] & 255) << 40) +
|
||||
((long)(barr[7] & 255) << 32) +
|
||||
((long)(barr[2] & 255) << 24) + // ________-XXXX-____-...
|
||||
((barr[3] & 255) << 16) + // put at 2..3 in buf
|
||||
((barr[0] & 255) << 8) + // ________-____-XXXX-...
|
||||
((barr[1] & 255) << 0); // put at 0..1 in buf
|
||||
} else {
|
||||
msb = ((long)barr[0] << 56) + // XXXXXXXX-____-____-...
|
||||
((long)(barr[1] & 255) << 48) +
|
||||
((long)(barr[2] & 255) << 40) +
|
||||
((long)(barr[3] & 255) << 32) +
|
||||
((long)(barr[4] & 255) << 24) + // ________-XXXX-____-...
|
||||
((barr[5] & 255) << 16) +
|
||||
((barr[6] & 255) << 8) + // ________-____-XXXX-...
|
||||
((barr[7] & 255) << 0);
|
||||
}
|
||||
long lsb = ((long)barr[8] << 56) +
|
||||
((long)(barr[9] & 255) << 48) +
|
||||
((long)(barr[10] & 255) << 40) +
|
||||
((long)(barr[11] & 255) << 32) +
|
||||
((long)(barr[12] & 255) << 24) +
|
||||
((barr[13] & 255) << 16) +
|
||||
((barr[14] & 255) << 8) +
|
||||
((barr[15] & 255) << 0);
|
||||
|
||||
return new UUID(msb, lsb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from UUID to byte[].
|
||||
*/
|
||||
public static byte[] uuidToBytes(UUID uuid, boolean optimized) {
|
||||
byte[] ret = new byte[16];
|
||||
long l = uuid.getMostSignificantBits();
|
||||
|
||||
if (optimized) {
|
||||
ret[0] = (byte) (l >>> 8); // was 6/7
|
||||
ret[1] = (byte) (l >>> 0);
|
||||
|
||||
ret[2] = (byte) (l >>> 24); // was 4/5
|
||||
ret[3] = (byte) (l >>> 16);
|
||||
|
||||
ret[4] = (byte) (l >>> 56); // was 0..3
|
||||
ret[5] = (byte) (l >>> 48);
|
||||
ret[6] = (byte) (l >>> 40);
|
||||
ret[7] = (byte) (l >>> 32);
|
||||
} else {
|
||||
ret[0] = (byte) (l >>> 56);
|
||||
ret[1] = (byte) (l >>> 48);
|
||||
ret[2] = (byte) (l >>> 40);
|
||||
ret[3] = (byte) (l >>> 32);
|
||||
ret[4] = (byte) (l >>> 24);
|
||||
ret[5] = (byte) (l >>> 16);
|
||||
ret[6] = (byte) (l >>> 8);
|
||||
ret[7] = (byte) (l >>> 0);
|
||||
}
|
||||
l = uuid.getLeastSignificantBits();
|
||||
ret[8] = (byte) (l >>> 56);
|
||||
ret[9] = (byte) (l >>> 48);
|
||||
ret[10] = (byte) (l >>> 40);
|
||||
ret[11] = (byte) (l >>> 32);
|
||||
ret[12] = (byte) (l >>> 24);
|
||||
ret[13] = (byte) (l >>> 16);
|
||||
ret[14] = (byte) (l >>> 8);
|
||||
ret[15] = (byte) (l >>> 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.ebean.core.type;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class DecimalUtilsTest {
|
||||
|
||||
@Test
|
||||
void testToDecimal() {
|
||||
Instant now = Instant.now();
|
||||
Timestamp sourceTimestamp = Timestamp.from(now);
|
||||
|
||||
BigDecimal decimal = ScalarTypeUtils.toDecimal(sourceTimestamp);
|
||||
Timestamp timestamp = ScalarTypeUtils.toTimestamp(decimal);
|
||||
|
||||
assertEquals(now, timestamp.toInstant());
|
||||
assertEquals(sourceTimestamp, timestamp);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDuration() {
|
||||
Duration duration = Duration.ofSeconds(323, 1500000);
|
||||
|
||||
BigDecimal bigDecimal = ScalarTypeUtils.toDecimal(duration);
|
||||
Duration duration1 = ScalarTypeUtils.toDuration(bigDecimal);
|
||||
|
||||
assertEquals(duration, duration1);
|
||||
assertEquals("PT5M23.0015S", duration1.toString());
|
||||
}
|
||||
}
|
||||
+11
-12
@@ -1,5 +1,4 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
|
||||
package io.ebean.core.type;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -7,43 +6,43 @@ import java.time.Instant;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class IsoJsonDateTimeParserTest {
|
||||
class IsoJsonDateTimeParserTest {
|
||||
|
||||
private IsoJsonDateTimeParser parser = new IsoJsonDateTimeParser();
|
||||
private ScalarTypeUtils parser = new ScalarTypeUtils();
|
||||
|
||||
@Test
|
||||
public void parseFormat_when_hasMillis() {
|
||||
void parseFormat_when_hasMillis() {
|
||||
parseAndFormat("2016-02-28T20:39:00.123Z", "2016-02-28T20:39:00.123Z");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseFormat_when_noMillis() {
|
||||
void parseFormat_when_noMillis() {
|
||||
parseAndFormat("2016-02-28T20:39:00Z", "2016-02-28T20:39:00.000Z");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseFormat_when_millis_1dp() {
|
||||
void parseFormat_when_millis_1dp() {
|
||||
parseAndFormat("2016-02-28T20:39:00.0Z", "2016-02-28T20:39:00.000Z");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseFormat_when_millis_2dp() {
|
||||
void parseFormat_when_millis_2dp() {
|
||||
parseAndFormat("2016-02-28T20:39:00.00Z", "2016-02-28T20:39:00.000Z");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseFormat_when_millis_3dp() {
|
||||
void parseFormat_when_millis_3dp() {
|
||||
parseAndFormat("2016-02-28T20:39:00.000Z", "2016-02-28T20:39:00.000Z");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseFormat_when_millis_3dp_2() {
|
||||
void parseFormat_when_millis_3dp_2() {
|
||||
parseAndFormat("2016-02-28T20:39:32.999000Z", "2016-02-28T20:39:32.999Z");
|
||||
}
|
||||
|
||||
private void parseAndFormat(String input, String expected) {
|
||||
Instant timestamp = parser.parseIso(input);
|
||||
String format = parser.formatIso(timestamp);
|
||||
Instant timestamp = parser.parseInstant(input);
|
||||
String format = parser.formatInstant(timestamp);
|
||||
assertThat(format).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package io.ebean.core.type;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class ScalarTypeUtilsUuidBytesTest {
|
||||
|
||||
@Test
|
||||
void testConversion() {
|
||||
UUID id = UUID.randomUUID();
|
||||
|
||||
byte[] bytes = ScalarTypeUtils.uuidToBytes(id, false);
|
||||
assertEquals(16, bytes.length);
|
||||
|
||||
UUID id2 = ScalarTypeUtils.uuidFromBytes(bytes, false);
|
||||
assertEquals(id, id2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testConversionOptimized() {
|
||||
UUID id = UUID.randomUUID();
|
||||
|
||||
byte[] bytes = ScalarTypeUtils.uuidToBytes(id, true);
|
||||
assertEquals(16, bytes.length);
|
||||
|
||||
UUID id2 = ScalarTypeUtils.uuidFromBytes(bytes, true);
|
||||
assertEquals(id, id2);
|
||||
}
|
||||
|
||||
}
|
||||
+13
-14
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core</artifactId>
|
||||
@@ -15,10 +15,15 @@
|
||||
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
|
||||
<tag>ebean-parent-13.8.1</tag>
|
||||
<tag>ebean-parent-13.9.3</tag>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
@@ -38,22 +43,16 @@
|
||||
<version>${ebean-migration-auto.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -106,7 +105,7 @@
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.9.7</version>
|
||||
<version>2.11.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
@@ -144,21 +143,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.8.1</version>
|
||||
<version>13.9.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -228,10 +228,9 @@ public final class BindParams implements Serializable {
|
||||
/**
|
||||
* Set a named In parameter that is multi-valued.
|
||||
*/
|
||||
public Param setArrayParameter(String name, Collection<?> value) {
|
||||
public void setArrayParameter(String name, Collection<?> value) {
|
||||
Param p = getParam(name);
|
||||
p.setInValue(new MultiValueWrapper(value));
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,7 +117,7 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
EntityBean ownerBean = bc.getOwnerBean();
|
||||
Object parentId = desc.getId(ownerBean);
|
||||
log.log(DEBUG, "BeanCollection after lazy load was empty. type:" + ownerBean.getClass().getName() + " id:" + parentId + " owner:" + ownerBean);
|
||||
log.log(DEBUG, "BeanCollection after lazy load was empty. type:{0} id:{1} owner:{2}", ownerBean.getClass().getName(), parentId, ownerBean);
|
||||
}
|
||||
} else if (loadCache && many.isUseCache()) {
|
||||
desc.cacheManyPropPut(many, bc, desc.getId(bc.getOwnerBean()));
|
||||
|
||||
@@ -50,7 +50,6 @@ public final class ManyWhereJoins implements Serializable {
|
||||
* Add a many where join.
|
||||
*/
|
||||
public void add(ElPropertyDeploy elProp) {
|
||||
|
||||
String join = elProp.elPrefix();
|
||||
BeanProperty p = elProp.beanProperty();
|
||||
if (p instanceof BeanPropertyAssocMany<?>) {
|
||||
@@ -111,7 +110,6 @@ public final class ManyWhereJoins implements Serializable {
|
||||
* Return the set of property names for the many where joins.
|
||||
*/
|
||||
public TreeSet<String> getPropertyNames() {
|
||||
|
||||
TreeSet<String> propertyNames = new TreeSet<>();
|
||||
for (PropertyJoin join : joins.values()) {
|
||||
propertyNames.add(join.getProperty());
|
||||
|
||||
@@ -142,7 +142,9 @@ public final class NaturalKeyQueryData<T> {
|
||||
*/
|
||||
private boolean matchProperties() {
|
||||
if (naturalKey.isSingleProperty()) {
|
||||
naturalKey.matchSingleProperty((inProperty != null) ? inProperty : eqList.get(0).property);
|
||||
if (naturalKey.matchSingleProperty((inProperty != null) ? inProperty : eqList.get(0).property)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// multiple properties case
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
import io.ebeaninternal.server.type.bindcapture.BindCapture;
|
||||
import io.ebeaninternal.server.bind.capture.BindCapture;
|
||||
|
||||
final class NoopQueryBindCapture implements SpiQueryBindCapture {
|
||||
|
||||
|
||||
@@ -45,15 +45,14 @@ public final class ScopeTrans {
|
||||
* Flag set when nested commit has occurred.
|
||||
*/
|
||||
private boolean nestedCommit;
|
||||
private boolean nestedUseSavepoint;
|
||||
|
||||
public ScopeTrans(boolean rollbackOnChecked, boolean created, SpiTransaction transaction, TxScope txScope) {
|
||||
|
||||
this.rollbackOnChecked = rollbackOnChecked;
|
||||
this.created = created;
|
||||
this.transaction = transaction;
|
||||
this.noRollbackFor = txScope.getNoRollbackFor();
|
||||
this.rollbackFor = txScope.getRollbackFor();
|
||||
|
||||
if (transaction != null) {
|
||||
if (!created && txScope.isBatchSet() || txScope.isBatchOnCascadeSet() || txScope.isBatchSizeSet()) {
|
||||
restoreBatch = transaction.isBatchMode();
|
||||
@@ -87,13 +86,21 @@ public final class ScopeTrans {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScopeTrans[" + transaction + "]";
|
||||
return "ScopeTrans " + transaction;
|
||||
}
|
||||
|
||||
void setNestedUseSavepoint() {
|
||||
nestedUseSavepoint = true;
|
||||
}
|
||||
|
||||
boolean isNestedUseSavepoint() {
|
||||
return nestedUseSavepoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current/active transaction.
|
||||
*/
|
||||
protected SpiTransaction getTransaction() {
|
||||
SpiTransaction getTransaction() {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
@@ -101,7 +108,6 @@ public final class ScopeTrans {
|
||||
* Complete the transaction from enhanced transactional. Try to commit.
|
||||
*/
|
||||
void complete(Object returnOrThrowable, int opCode) {
|
||||
|
||||
if (opCode == OPCODE_ATHROW) {
|
||||
// exited with a Throwable
|
||||
caughtThrowable((Throwable) returnOrThrowable);
|
||||
@@ -124,7 +130,7 @@ public final class ScopeTrans {
|
||||
}
|
||||
}
|
||||
|
||||
protected void commitTransaction() {
|
||||
void commitTransaction() {
|
||||
if (created) {
|
||||
transaction.commit();
|
||||
} else {
|
||||
@@ -168,14 +174,13 @@ public final class ScopeTrans {
|
||||
* Returns the exception and this should be thrown by the calling code.
|
||||
*/
|
||||
public <T extends Throwable> T caughtThrowable(T e) {
|
||||
|
||||
if (isRollbackThrowable(e)) {
|
||||
rollback(e);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
protected void rollback(Throwable e) {
|
||||
void rollback(Throwable e) {
|
||||
if (transaction != null && transaction.isActive()) {
|
||||
// transaction is null for NOT_SUPPORTED and sometimes SUPPORTS
|
||||
// and Inactive (already rolled back) if nested REQUIRED
|
||||
@@ -188,21 +193,17 @@ public final class ScopeTrans {
|
||||
* Return true if this throwable should cause a rollback to occur.
|
||||
*/
|
||||
private boolean isRollbackThrowable(Throwable e) {
|
||||
|
||||
if (e instanceof Error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (noRollbackFor != null) {
|
||||
for (Class<? extends Throwable> aNoRollbackFor : noRollbackFor) {
|
||||
if (aNoRollbackFor.equals(e.getClass())) {
|
||||
|
||||
// explicit no rollback for this one
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rollbackFor != null) {
|
||||
for (Class<? extends Throwable> aRollbackFor : rollbackFor) {
|
||||
if (aRollbackFor.equals(e.getClass())) {
|
||||
@@ -211,7 +212,6 @@ public final class ScopeTrans {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checked exceptions...
|
||||
// EJB defaults this to false which is not intuitive IMO
|
||||
// Ebean makes this configurable (default to true)
|
||||
|
||||
@@ -7,7 +7,7 @@ import javax.persistence.PersistenceException;
|
||||
|
||||
/**
|
||||
* Manage scoped (typically thread local) transactions.
|
||||
*
|
||||
* <p>
|
||||
* These can be nested and internally they are pushed and popped from a stack.
|
||||
*/
|
||||
public final class ScopedTransaction extends SpiTransactionProxy {
|
||||
@@ -30,16 +30,29 @@ public final class ScopedTransaction extends SpiTransactionProxy {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScopedTransaction[" + current + "]";
|
||||
return "ScopedTransaction " + current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNestedUseSavepoint() {
|
||||
current.setNestedUseSavepoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNestedUseSavepoint() {
|
||||
return current.isNestedUseSavepoint();
|
||||
}
|
||||
|
||||
/**
|
||||
* Push the scope transaction.
|
||||
*/
|
||||
public void push(ScopeTrans scopeTrans) {
|
||||
|
||||
if (current != null) {
|
||||
stack.push(current);
|
||||
if (current.isNestedUseSavepoint()) {
|
||||
// child scope 'inherits' nestedUseSavepoint
|
||||
scopeTrans.setNestedUseSavepoint();
|
||||
}
|
||||
}
|
||||
current = scopeTrans;
|
||||
transaction = scopeTrans.getTransaction();
|
||||
@@ -111,6 +124,11 @@ public final class ScopedTransaction extends SpiTransactionProxy {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollbackAndContinue() {
|
||||
transaction.rollbackAndContinue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollback() throws PersistenceException {
|
||||
try {
|
||||
|
||||
@@ -13,8 +13,8 @@ import java.io.IOException;
|
||||
*/
|
||||
public interface SpiExpression extends Expression {
|
||||
|
||||
static final String SQL_TRUE = "1=1";
|
||||
static final String SQL_FALSE = "1=0";
|
||||
String SQL_TRUE = "1=1";
|
||||
String SQL_FALSE = "1=0";
|
||||
|
||||
/**
|
||||
* Simplify nested expressions if possible.
|
||||
@@ -110,4 +110,11 @@ public interface SpiExpression extends Expression {
|
||||
* Apply property prefix when filterMany expressions included into main query.
|
||||
*/
|
||||
void prefixProperty(String path);
|
||||
|
||||
/**
|
||||
* Return a copy of the expression (as part of creating a query copy).
|
||||
*/
|
||||
default SpiExpression copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
|
||||
* Return true if select all properties was used to ensure the property
|
||||
* invoking a lazy load was included in the query.
|
||||
*/
|
||||
boolean selectAllForLazyLoadProperty();
|
||||
void selectAllForLazyLoadProperty();
|
||||
|
||||
/**
|
||||
* Set the select properties.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebeaninternal.api;
|
||||
|
||||
import io.ebeaninternal.server.type.bindcapture.BindCapture;
|
||||
import io.ebeaninternal.server.bind.capture.BindCapture;
|
||||
|
||||
/**
|
||||
* Capture query bind values and with those actual database query plans.
|
||||
|
||||
@@ -139,7 +139,7 @@ public final class TransactionEvent implements Serializable {
|
||||
|
||||
/**
|
||||
* Return the CacheChangeSet that we add cache notification messages to.
|
||||
*
|
||||
* <p>
|
||||
* We want to add to this change set as we process requests allowing the
|
||||
* PersistRequestBean to be garbage collected for large transactions.
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.ebeaninternal.api;
|
||||
|
||||
/**
|
||||
* Event codes used in transaction profiling.
|
||||
*
|
||||
* <p>
|
||||
* These appear in verbose transaction profile logs.
|
||||
*/
|
||||
public interface TxnProfileEventCodes {
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Map;
|
||||
|
||||
public interface SpiJsonReader {
|
||||
|
||||
PersistenceContext getPersistenceContext();
|
||||
PersistenceContext persistenceContext();
|
||||
|
||||
SpiJsonReader forJson(JsonParser moreJson);
|
||||
|
||||
@@ -20,9 +20,9 @@ public interface SpiJsonReader {
|
||||
|
||||
Object persistenceContextPutIfAbsent(Object id, EntityBean bean, BeanDescriptor<?> beanDesc);
|
||||
|
||||
ObjectMapper getObjectMapper();
|
||||
ObjectMapper mapper();
|
||||
|
||||
JsonParser getParser();
|
||||
JsonParser parser();
|
||||
|
||||
JsonToken nextToken() throws IOException;
|
||||
|
||||
@@ -34,5 +34,5 @@ public interface SpiJsonReader {
|
||||
|
||||
Object readValueUsingObjectMapper(Class<?> propertyType) throws IOException;
|
||||
|
||||
boolean isIntercept();
|
||||
boolean intercept();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public interface SpiJsonWriter extends JsonWriter {
|
||||
/**
|
||||
* Return true if the value is a parent bean.
|
||||
*/
|
||||
boolean isParentBean(Object value);
|
||||
boolean parentBean(Object value);
|
||||
|
||||
/**
|
||||
* Start an assoc one path.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
package io.ebeaninternal.server.bind;
|
||||
|
||||
import io.ebean.core.type.DataBinder;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package io.ebeaninternal.server.type;
|
||||
package io.ebeaninternal.server.bind;
|
||||
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
import io.ebeaninternal.server.type.bindcapture.BindCapture;
|
||||
import io.ebeaninternal.server.type.bindcapture.BindCaptureStatement;
|
||||
import io.ebeaninternal.server.bind.capture.BindCapture;
|
||||
import io.ebeaninternal.server.bind.capture.BindCaptureStatement;
|
||||
|
||||
/**
|
||||
* Special DataBind used to capture bind values for obtaining explain plans.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package io.ebeaninternal.server.type.bindcapture;
|
||||
package io.ebeaninternal.server.bind.capture;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package io.ebeaninternal.server.type.bindcapture;
|
||||
package io.ebeaninternal.server.bind.capture;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package io.ebeaninternal.server.type.bindcapture;
|
||||
package io.ebeaninternal.server.bind.capture;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package io.ebeaninternal.server.type.bindcapture;
|
||||
package io.ebeaninternal.server.bind.capture;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package io.ebeaninternal.server.type.bindcapture;
|
||||
package io.ebeaninternal.server.bind.capture;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.StringReader;
|
||||
+1
-1
@@ -52,7 +52,7 @@ public final class RemoteCacheEvent implements BinaryWritable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CacheEvent[ clearAll:" + clearAll + " caches:" + clearCaches + "]";
|
||||
return "CacheEvent clearAll:" + clearAll + " caches:" + clearCaches;
|
||||
}
|
||||
|
||||
public static RemoteCacheEvent readBinaryMessage(BinaryReadContext dataInput) throws IOException {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ public class BinaryTransactionEventReader {
|
||||
String serverName = dataInput.readUTF();
|
||||
SpiEbeanServer server = (SpiEbeanServer) serverLookup.getServer(serverName);
|
||||
if (server == null) {
|
||||
throw new IllegalStateException("EbeanServer not found for name [" + serverName + "]");
|
||||
throw new IllegalStateException("Database not found for name " + serverName);
|
||||
}
|
||||
RemoteTransactionEvent event = new RemoteTransactionEvent(server);
|
||||
event.readBinary(dataInput);
|
||||
|
||||
@@ -119,7 +119,7 @@ public abstract class AbstractSqlQueryRequest implements CancelableQuery {
|
||||
int firstRow = query.getFirstRow();
|
||||
int maxRows = query.getMaxRows();
|
||||
if (firstRow > 0 || maxRows > 0) {
|
||||
return server.databasePlatform().getBasicSqlLimiter().limit(sql, firstRow, maxRows);
|
||||
return server.databasePlatform().basicSqlLimiter().limit(sql, firstRow, maxRows);
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ final class DefaultBeanLoader {
|
||||
if (beanCollection != null) {
|
||||
if (beanCollection.checkEmptyLazyLoad()) {
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
log.log(DEBUG, "BeanCollection after load was empty. Owner:" + beanCollection.getOwnerBean());
|
||||
log.log(DEBUG, "BeanCollection after load was empty. Owner:{0}", beanCollection.getOwnerBean());
|
||||
}
|
||||
} else if (useManyIdCache) {
|
||||
parentDesc.cacheManyPropPut(many, beanCollection, parentId);
|
||||
@@ -229,7 +229,7 @@ final class DefaultBeanLoader {
|
||||
|
||||
Object dbBean = query.findOne();
|
||||
if (dbBean == null) {
|
||||
throw new EntityNotFoundException("Bean not found during lazy load or refresh." + " id[" + id + "] type[" + desc.type() + "]");
|
||||
throw new EntityNotFoundException("Bean not found during lazy load or refresh. Id:" + id + " type:" + desc.type());
|
||||
}
|
||||
desc.resetManyProperties(dbBean);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public final class DefaultContainer implements SpiContainer {
|
||||
startServer(online, server);
|
||||
}
|
||||
DbOffline.reset();
|
||||
log.log(INFO, "Started database[{0}] platform[{1}] in {2}ms", config.getName(), config.getDatabasePlatform().getPlatform(), System.currentTimeMillis() - start);
|
||||
log.log(INFO, "Started database[{0}] platform[{1}] in {2}ms", config.getName(), config.getDatabasePlatform().platform(), System.currentTimeMillis() - start);
|
||||
return server;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
|
||||
@@ -21,7 +21,6 @@ import io.ebean.plugin.BeanType;
|
||||
import io.ebean.plugin.Plugin;
|
||||
import io.ebean.plugin.Property;
|
||||
import io.ebean.plugin.SpiServer;
|
||||
import io.ebean.text.csv.CsvReader;
|
||||
import io.ebean.text.json.JsonContext;
|
||||
import io.ebeaninternal.api.*;
|
||||
import io.ebeaninternal.api.SpiQuery.Type;
|
||||
@@ -39,7 +38,6 @@ import io.ebeaninternal.server.grammer.EqlParser;
|
||||
import io.ebeaninternal.server.query.*;
|
||||
import io.ebeaninternal.server.querydefn.*;
|
||||
import io.ebeaninternal.server.rawsql.SpiRawSql;
|
||||
import io.ebeaninternal.server.text.csv.TCsvReader;
|
||||
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
|
||||
import io.ebeaninternal.server.transaction.RemoteTransactionEvent;
|
||||
import io.ebeaninternal.server.transaction.TransactionManager;
|
||||
@@ -251,7 +249,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
|
||||
@Override
|
||||
public Platform platform() {
|
||||
return databasePlatform.getPlatform();
|
||||
return databasePlatform.platform();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -318,7 +316,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
migrationRunner.setDefaultDbSchema(dbSchema);
|
||||
}
|
||||
migrationRunner.setName(config.getName());
|
||||
Platform platform = config.getDatabasePlatform().getPlatform();
|
||||
Platform platform = config.getDatabasePlatform().platform();
|
||||
migrationRunner.setBasePlatform(platform.base().name().toLowerCase());
|
||||
migrationRunner.setPlatform(platform.name().toLowerCase());
|
||||
migrationRunner.loadProperties(config.getProperties());
|
||||
@@ -560,7 +558,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
try (Connection connection = dataSource().getConnection()) {
|
||||
for (String table : tables) {
|
||||
executeSql(connection, databasePlatform.truncateStatement(table));
|
||||
if (databasePlatform.getPlatform().base() == Platform.DB2) {
|
||||
if (databasePlatform.platform().base() == Platform.DB2) {
|
||||
// DB2 requires commit after each truncate statement
|
||||
connection.commit();
|
||||
}
|
||||
@@ -807,10 +805,6 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
return new ElFilter<>(desc(beanType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CsvReader<T> createCsvReader(Class<T> beanType) {
|
||||
return new TCsvReader<>(this, desc(beanType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> UpdateQuery<T> update(Class<T> beanType) {
|
||||
@@ -1085,7 +1079,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
} else if (list.size() > 1) {
|
||||
throw new NonUniqueResultException("Unique expecting 0 or 1 results but got [" + list.size() + "]");
|
||||
throw new NonUniqueResultException("Unique expecting 0 or 1 results but got " + list.size());
|
||||
} else {
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
@@ -100,11 +100,7 @@ final class DumpMetrics {
|
||||
}
|
||||
|
||||
private void logCount(MetaCountMetric metric) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(padNameTimed(metric.name())).append(" ");
|
||||
sb.append(" count:").append(pad(metric.count()));
|
||||
out(sb.toString());
|
||||
out(padNameTimed(metric.name()) + " count:" + pad(metric.count()));
|
||||
}
|
||||
|
||||
private void out(String sb) {
|
||||
|
||||
@@ -105,7 +105,7 @@ final class InitDataSource {
|
||||
}
|
||||
|
||||
boolean isPostgresAllQuotedIdentifiers() {
|
||||
return config.isAllQuotedIdentifiers() && Platform.POSTGRES == config.getDatabasePlatform().getPlatform().base();
|
||||
return config.isAllQuotedIdentifiers() && Platform.POSTGRES == config.getDatabasePlatform().platform().base();
|
||||
}
|
||||
|
||||
private DataSource create(DataSourceConfig dsConfig, boolean readOnly) {
|
||||
|
||||
@@ -46,7 +46,7 @@ import io.ebeaninternal.server.persist.platform.PostgresMultiValueBind;
|
||||
import io.ebeaninternal.server.query.*;
|
||||
import io.ebeaninternal.server.readaudit.DefaultReadAuditLogger;
|
||||
import io.ebeaninternal.server.readaudit.DefaultReadAuditPrepare;
|
||||
import io.ebeaninternal.server.text.json.DJsonContext;
|
||||
import io.ebeaninternal.server.json.DJsonContext;
|
||||
import io.ebeaninternal.server.transaction.*;
|
||||
import io.ebeaninternal.server.type.DefaultTypeManager;
|
||||
import io.ebeaninternal.server.type.TypeManager;
|
||||
@@ -116,7 +116,7 @@ public final class InternalConfiguration {
|
||||
this.databasePlatform = config.getDatabasePlatform();
|
||||
this.expressionFactory = initExpressionFactory(config);
|
||||
this.typeManager = new DefaultTypeManager(config, bootupClasses);
|
||||
this.multiValueBind = createMultiValueBind(databasePlatform.getPlatform());
|
||||
this.multiValueBind = createMultiValueBind(databasePlatform.platform());
|
||||
this.deployInherit = new DeployInherit(bootupClasses);
|
||||
this.deployCreateProperties = new DeployCreateProperties(typeManager);
|
||||
this.deployUtil = new DeployUtil(typeManager, config);
|
||||
@@ -171,7 +171,7 @@ public final class InternalConfiguration {
|
||||
* Create and return the ExpressionFactory based on configuration and database platform.
|
||||
*/
|
||||
private ExpressionFactory initExpressionFactory(DatabaseConfig config) {
|
||||
boolean nativeIlike = config.isExpressionNativeIlike() && databasePlatform.isSupportsNativeIlike();
|
||||
boolean nativeIlike = config.isExpressionNativeIlike() && databasePlatform.supportsNativeIlike();
|
||||
return new DefaultExpressionFactory(config.isExpressionEqualsWithNullAsNoop(), nativeIlike);
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ public final class InternalConfiguration {
|
||||
|
||||
DbExpressionHandler jsonHandler = getDbExpressionHandler(databasePlatform);
|
||||
|
||||
DbHistorySupport historySupport = databasePlatform.getHistorySupport();
|
||||
DbHistorySupport historySupport = databasePlatform.historySupport();
|
||||
if (historySupport == null) {
|
||||
return new Binder(typeManager, logManager, 0, false, jsonHandler, dataTimeZone, multiValueBind);
|
||||
}
|
||||
@@ -321,7 +321,7 @@ public final class InternalConfiguration {
|
||||
}
|
||||
|
||||
private Platform getPlatform() {
|
||||
return getDatabasePlatform().getPlatform();
|
||||
return getDatabasePlatform().platform();
|
||||
}
|
||||
|
||||
public DatabasePlatform getDatabasePlatform() {
|
||||
@@ -577,7 +577,7 @@ public final class InternalConfiguration {
|
||||
return QueryPlanManager.NOOP;
|
||||
}
|
||||
long threshold = config.getQueryPlanThresholdMicros();
|
||||
return new CQueryPlanManager(transactionManager, threshold, queryPlanLogger(databasePlatform.getPlatform()), extraMetrics);
|
||||
return new CQueryPlanManager(transactionManager, threshold, queryPlanLogger(databasePlatform.platform()), extraMetrics);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,7 +100,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
*/
|
||||
@Override
|
||||
public String dbLikeClause(boolean rawLikeExpression) {
|
||||
return server.databasePlatform().getLikeClause(rawLikeExpression);
|
||||
return server.databasePlatform().likeClause(rawLikeExpression);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -761,7 +761,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
* Return true if no MaxRows or use LIMIT in SQL update.
|
||||
*/
|
||||
public boolean isInlineSqlUpdateLimit() {
|
||||
return query.getMaxRows() < 1 || server.databasePlatform().isInlineSqlUpdateLimit();
|
||||
return query.getMaxRows() < 1 || server.databasePlatform().inlineSqlUpdateLimit();
|
||||
}
|
||||
|
||||
public int forwardOnlyFetchSize() {
|
||||
|
||||
@@ -928,20 +928,20 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
}
|
||||
|
||||
private void logSummaryMessage() {
|
||||
String draft = (beanDescriptor.isDraftable() && !publish) ? " draft[true]" : "";
|
||||
String draft = (beanDescriptor.isDraftable() && !publish) ? "] draft[true]" : "]";
|
||||
String name = beanDescriptor.name();
|
||||
switch (type) {
|
||||
case INSERT:
|
||||
transaction.logSummary("Inserted [" + name + "] [" + (idValue == null ? "" : idValue) + "]" + draft);
|
||||
transaction.logSummary("Inserted [" + name + "] [" + (idValue == null ? "" : idValue) + draft);
|
||||
break;
|
||||
case UPDATE:
|
||||
transaction.logSummary("Updated [" + name + "] [" + idValue + "]" + draft);
|
||||
transaction.logSummary("Updated [" + name + "] [" + idValue + draft);
|
||||
break;
|
||||
case DELETE:
|
||||
transaction.logSummary("Deleted [" + name + "] [" + idValue + "]" + draft);
|
||||
transaction.logSummary("Deleted [" + name + "] [" + idValue + draft);
|
||||
break;
|
||||
case DELETE_SOFT:
|
||||
transaction.logSummary("SoftDelete [" + name + "] [" + idValue + "]" + draft);
|
||||
transaction.logSummary("SoftDelete [" + name + "] [" + idValue + draft);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
+1
-2
@@ -86,8 +86,7 @@ public final class PersistRequestCallableSql extends PersistRequest {
|
||||
persistExecute.collectSqlCall(label, startNanos);
|
||||
}
|
||||
if (transaction.isLogSummary()) {
|
||||
String m = "CallableSql label[" + callableSql.getLabel() + "]" + " rows[" + rowCount + "]" + " bind[" + bindLog + "]";
|
||||
transaction.logSummary(m);
|
||||
transaction.logSummary("CallableSql label[" + callableSql.getLabel() + "]" + " rows[" + rowCount + "]" + " bind[" + bindLog + "]");
|
||||
}
|
||||
|
||||
// register table modifications with the transaction event
|
||||
|
||||
@@ -83,8 +83,7 @@ public final class PersistRequestOrmUpdate extends PersistRequest {
|
||||
OrmUpdateType ormUpdateType = ormUpdate.getOrmUpdateType();
|
||||
String tableName = ormUpdate.getBaseTable();
|
||||
if (transaction.isLogSummary()) {
|
||||
String m = ormUpdateType + " table[" + tableName + "] rows[" + rowCount + "] bind[" + bindLog + "]";
|
||||
transaction.logSummary(m);
|
||||
transaction.logSummary(ormUpdateType + " table[" + tableName + "] rows[" + rowCount + "] bind[" + bindLog + "]");
|
||||
}
|
||||
if (ormUpdate.isNotifyCache()) {
|
||||
// add the modification info to the TransactionEvent
|
||||
|
||||
@@ -49,9 +49,9 @@ public final class PersistRequestUpdateSql extends PersistRequest {
|
||||
/**
|
||||
* Add this statement to JDBC batch for later execution.
|
||||
*/
|
||||
public int addBatch() {
|
||||
public void addBatch() {
|
||||
this.addBatch = true;
|
||||
return executeStatement(true);
|
||||
executeStatement(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -138,7 +138,7 @@ public interface SpiOrmQueryRequest<T> extends BeanQueryRequest<T>, DocQueryRequ
|
||||
/**
|
||||
* Maybe hit the bean cache returning true if everything was obtained from the
|
||||
* cache (that there were no misses).
|
||||
*
|
||||
* <p>
|
||||
* Do this for findList() on many natural keys or many Ids.
|
||||
*/
|
||||
boolean getFromBeanCache();
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.sql.ResultSet;
|
||||
|
||||
/**
|
||||
* Hold the JDBC PreparedStatement and ResultSet.
|
||||
*
|
||||
* <p>
|
||||
* These both must be closed properly when done.
|
||||
*/
|
||||
public final class SpiResultSet {
|
||||
|
||||
@@ -207,7 +207,7 @@ public class BootupClasses implements Predicate<Class<?>> {
|
||||
try {
|
||||
return cls.getConstructor().newInstance();
|
||||
} catch (NoSuchMethodException e) {
|
||||
log.log(DEBUG, "Ignore/expected - no default constructor: " + e.getMessage());
|
||||
log.log(DEBUG, "Ignore/expected - no default constructor: {0}", e.getMessage());
|
||||
return null;
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -55,7 +55,7 @@ class ManifestReader {
|
||||
/**
|
||||
* Read all the specific manifest files and return the set of packages containing type query beans.
|
||||
*/
|
||||
private Set<String> read(ClassLoader classLoader, String resourcePath) {
|
||||
private void read(ClassLoader classLoader, String resourcePath) {
|
||||
try {
|
||||
Enumeration<URL> resources = classLoader.getResources(resourcePath);
|
||||
while (resources.hasMoreElements()) {
|
||||
@@ -66,7 +66,6 @@ class ManifestReader {
|
||||
} catch (IOException e) {
|
||||
log.log(WARNING, "Error reading " + resourcePath + " manifest resources", e);
|
||||
}
|
||||
return packageSet;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,7 @@ public final class BeanCollectionUtil {
|
||||
} else if (o instanceof Collection<?>) {
|
||||
return ((Collection<?>) o);
|
||||
}
|
||||
throw new PersistenceException("expecting a Map or Collection but got [" + o.getClass().getName() + "]");
|
||||
throw new PersistenceException("expecting a Map or Collection but got " + o.getClass().getName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,6 +73,6 @@ public final class BeanCollectionUtil {
|
||||
} else if (o instanceof Collection<?>) {
|
||||
return ((Collection<?>) o);
|
||||
}
|
||||
throw new PersistenceException("expecting a Map or Collection but got [" + o.getClass().getName() + "]");
|
||||
throw new PersistenceException("expecting a Map or Collection but got " + o.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ import io.ebeaninternal.server.querydefn.DefaultOrmQuery;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryDetail;
|
||||
import io.ebeaninternal.server.querydefn.OrmQueryProperties;
|
||||
import io.ebeaninternal.server.rawsql.SpiRawSql;
|
||||
import io.ebeaninternal.server.type.DataBind;
|
||||
import io.ebeaninternal.server.bind.DataBind;
|
||||
import io.ebeaninternal.util.SortByClause;
|
||||
import io.ebeaninternal.util.SortByClauseParser;
|
||||
import io.ebeanservice.docstore.api.DocStoreBeanAdapter;
|
||||
@@ -323,7 +323,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
this.jsonHelp = initJsonHelp();
|
||||
this.draftHelp = new BeanDescriptorDraftHelp<>(this);
|
||||
this.docStoreAdapter = owner.createDocStoreBeanAdapter(this, deploy);
|
||||
this.docStoreQueueId = docStoreAdapter.getQueueId();
|
||||
this.docStoreQueueId = docStoreAdapter.queueId();
|
||||
// Check if there are no cascade save associated beans ( subject to change
|
||||
// in initialiseOther()). Note that if we are in an inheritance hierarchy
|
||||
// then we also need to check every BeanDescriptors in the InheritInfo as
|
||||
@@ -966,7 +966,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
*/
|
||||
@Override
|
||||
public boolean isDocStoreMapped() {
|
||||
return docStoreAdapter.isMapped();
|
||||
return docStoreAdapter.mapped();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1072,7 +1072,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* given the transactions requested mode.
|
||||
*/
|
||||
public DocStoreMode docStoreMode(PersistRequest.Type persistType, DocStoreMode txnMode) {
|
||||
return docStoreAdapter.getMode(persistType, txnMode);
|
||||
return docStoreAdapter.mode(persistType, txnMode);
|
||||
}
|
||||
|
||||
public void docStoreInsert(Object idValue, PersistRequestBean<T> persistRequest, DocStoreUpdateContext bulkUpdate) throws IOException {
|
||||
@@ -1891,7 +1891,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
}
|
||||
BeanPropertyAssoc<?> assocProp = (BeanPropertyAssoc<?>) other._findBeanProperty(split[0]);
|
||||
if (assocProp == null) {
|
||||
throw new IllegalStateException("Unknown property path [" + split[0] + "] from[" + path + "]");
|
||||
throw new IllegalStateException("Unknown property path " + split[0] + " from " + path);
|
||||
}
|
||||
BeanDescriptor<?> targetDesc = assocProp.targetDescriptor();
|
||||
path = split[1];
|
||||
@@ -3157,18 +3157,17 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return true if any mutable properties are dirty.
|
||||
*/
|
||||
public boolean checkAnyMutableProperties(EntityBeanIntercept ebi) {
|
||||
public void 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ConcurrencyMode concurrencyMode(EntityBeanIntercept ebi) {
|
||||
|
||||
+1
-3
@@ -706,9 +706,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
}
|
||||
|
||||
Set<EntityBeanIntercept> loaded = new HashSet<>();
|
||||
Iterator<Map.Entry<Object, Object>> iterator = hits.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<Object, Object> hit = iterator.next();
|
||||
for (Map.Entry<Object, Object> hit : hits.entrySet()) {
|
||||
Object key = hit.getKey();
|
||||
EntityBeanIntercept ebi = ebis.remove(key);
|
||||
CachedBeanData cacheData = (CachedBeanData) hit.getValue();
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ class BeanDescriptorElementEmbeddedMap<T> extends BeanDescriptorElementEmbedded<
|
||||
BeanDescriptorElementEmbeddedMap(BeanDescriptorMap owner, DeployBeanDescriptor<T> deploy, ElementHelp elementHelp) {
|
||||
super(owner, deploy, elementHelp);
|
||||
this.scalarTypeKey = firstBaseScalarType();
|
||||
this.stringKey = String.class.equals(scalarTypeKey.getType());
|
||||
this.stringKey = String.class.equals(scalarTypeKey.type());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,7 +49,7 @@ class BeanDescriptorElementEmbeddedMap<T> extends BeanDescriptorElementEmbedded<
|
||||
|
||||
@Override
|
||||
public Object jsonReadCollection(SpiJsonReader readJson, EntityBean parentBean) throws IOException {
|
||||
JsonParser parser = readJson.getParser();
|
||||
JsonParser parser = readJson.parser();
|
||||
ElementCollector add = elementHelp.createCollector();
|
||||
do {
|
||||
String fieldName = parser.nextFieldName();
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class BeanDescriptorElementScalar<T> extends BeanDescriptorElement<T> {
|
||||
|
||||
@Override
|
||||
public Object jsonReadCollection(SpiJsonReader readJson, EntityBean parentBean) throws IOException {
|
||||
JsonParser parser = readJson.getParser();
|
||||
JsonParser parser = readJson.parser();
|
||||
ElementCollector add = elementHelp.createCollector();
|
||||
do {
|
||||
JsonToken token = parser.nextToken();
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ class BeanDescriptorElementScalarMap<T> extends BeanDescriptorElement<T> {
|
||||
}
|
||||
this.scalarTypeKey = props[0].scalarType();
|
||||
this.scalarTypeVal = props[1].scalarType();
|
||||
this.stringKey = String.class.equals(scalarTypeKey.getType());
|
||||
this.stringKey = String.class.equals(scalarTypeKey.type());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,7 +49,7 @@ class BeanDescriptorElementScalarMap<T> extends BeanDescriptorElement<T> {
|
||||
|
||||
@Override
|
||||
public Object jsonReadCollection(SpiJsonReader readJson, EntityBean parentBean) throws IOException {
|
||||
JsonParser parser = readJson.getParser();
|
||||
JsonParser parser = readJson.parser();
|
||||
ElementCollector add = elementHelp.createCollector();
|
||||
do {
|
||||
String fieldName = parser.nextFieldName();
|
||||
|
||||
@@ -66,7 +66,7 @@ final class BeanDescriptorJsonHelp<T> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
T jsonRead(SpiJsonReader jsonRead, String path, boolean withInheritance, T target) throws IOException {
|
||||
JsonParser parser = jsonRead.getParser();
|
||||
JsonParser parser = jsonRead.parser();
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (parser.getCurrentToken() == JsonToken.START_OBJECT) {
|
||||
// start object token read by Jackson already
|
||||
@@ -85,7 +85,7 @@ final class BeanDescriptorJsonHelp<T> {
|
||||
return jsonReadObject(jsonRead, path, target);
|
||||
}
|
||||
|
||||
ObjectNode node = jsonRead.getObjectMapper().readTree(parser);
|
||||
ObjectNode node = jsonRead.mapper().readTree(parser);
|
||||
if (node.isNull()) {
|
||||
return null;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ final class BeanDescriptorJsonHelp<T> {
|
||||
// unmapped properties, send to JsonReadBeanVisitor later
|
||||
Map<String, Object> unmappedProperties = null;
|
||||
do {
|
||||
JsonParser parser = readJson.getParser();
|
||||
JsonParser parser = readJson.parser();
|
||||
JsonToken event = parser.nextToken();
|
||||
if (JsonToken.FIELD_NAME == event) {
|
||||
String key = parser.getCurrentName();
|
||||
|
||||
+13
-18
@@ -134,7 +134,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
this.encryptKeyManager = this.config.getEncryptKeyManager();
|
||||
this.databasePlatform = this.config.getDatabasePlatform();
|
||||
this.multiValueBind = config.getMultiValueBind();
|
||||
this.idBinderFactory = new IdBinderFactory(databasePlatform.isIdInExpandedForm(), multiValueBind);
|
||||
this.idBinderFactory = new IdBinderFactory(databasePlatform.idInExpandedForm(), multiValueBind);
|
||||
this.queryPlanTTLSeconds = this.config.getQueryPlanTTLSeconds();
|
||||
this.asOfViewSuffix = asOfViewSuffix(databasePlatform, this.config);
|
||||
String versionsBetweenSuffix = versionsBetweenSuffix(databasePlatform, this.config);
|
||||
@@ -142,7 +142,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
this.bootupClasses = config.getBootupClasses();
|
||||
this.createProperties = config.getDeployCreateProperties();
|
||||
this.namingConvention = this.config.getNamingConvention();
|
||||
this.dbIdentity = config.getDatabasePlatform().getDbIdentity();
|
||||
this.dbIdentity = config.getDatabasePlatform().dbIdentity();
|
||||
this.deplyInherit = config.getDeployInherit();
|
||||
this.deployUtil = config.getDeployUtil();
|
||||
this.typeManager = deployUtil.getTypeManager();
|
||||
@@ -196,7 +196,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
* Return the AsOfViewSuffix based on the DbHistorySupport.
|
||||
*/
|
||||
private String asOfViewSuffix(DatabasePlatform databasePlatform, DatabaseConfig serverConfig) {
|
||||
DbHistorySupport historySupport = databasePlatform.getHistorySupport();
|
||||
DbHistorySupport historySupport = databasePlatform.historySupport();
|
||||
// with historySupport returns a simple view suffix or the sql2011 as of timestamp suffix
|
||||
return (historySupport == null) ? serverConfig.getAsOfViewSuffix() : historySupport.getAsOfViewSuffix(serverConfig.getAsOfViewSuffix());
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
* Return the versions between timestamp suffix based on the DbHistorySupport.
|
||||
*/
|
||||
private String versionsBetweenSuffix(DatabasePlatform databasePlatform, DatabaseConfig serverConfig) {
|
||||
DbHistorySupport historySupport = databasePlatform.getHistorySupport();
|
||||
DbHistorySupport historySupport = databasePlatform.historySupport();
|
||||
// with historySupport returns a simple view suffix or the sql2011 versions between timestamp suffix
|
||||
return (historySupport == null) ? serverConfig.getAsOfViewSuffix() : historySupport.getVersionsBetweenSuffix(serverConfig.getAsOfViewSuffix());
|
||||
}
|
||||
@@ -868,11 +868,6 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
if (possibleLower.contains(searchName)) {
|
||||
// we have a match
|
||||
prop.setMappedBy(possibleMappedBy);
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
String m = "Implicitly found mappedBy for " + targetDesc + "." + prop;
|
||||
m += " by searching for [" + searchName + "] against " + matchSet;
|
||||
log.log(DEBUG, m);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -988,14 +983,14 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
private DeployBeanPropertyAssocOne<?> mappedOneToOne(DeployBeanPropertyAssocOne<?> prop, String mappedBy, DeployBeanDescriptor<?> targetDesc) {
|
||||
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
|
||||
if (mappedProp == null) {
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + " Can not find mappedBy property [" + targetDesc + "." + mappedBy + "]");
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + " Can not find mappedBy property " + targetDesc + "." + mappedBy);
|
||||
}
|
||||
if (!(mappedProp instanceof DeployBeanPropertyAssocOne<?>)) {
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property [" + targetDesc + "." + mappedBy + "]is not a OneToOne?");
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property " + targetDesc + "." + mappedBy + " is not a OneToOne?");
|
||||
}
|
||||
DeployBeanPropertyAssocOne<?> mappedAssocOne = (DeployBeanPropertyAssocOne<?>) mappedProp;
|
||||
if (!mappedAssocOne.isOneToOne()) {
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property [" + targetDesc + "." + mappedBy + "]is not a OneToOne?");
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property " + targetDesc + "." + mappedBy + " is not a OneToOne?");
|
||||
}
|
||||
return mappedAssocOne;
|
||||
}
|
||||
@@ -1078,10 +1073,10 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
private DeployBeanPropertyAssocOne<?> mappedManyToOne(DeployBeanPropertyAssocMany<?> prop, DeployBeanDescriptor<?> targetDesc, String mappedBy) {
|
||||
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
|
||||
if (mappedProp == null) {
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + " Can not find mappedBy property [" + mappedBy + "] " + "in [" + targetDesc + "]");
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + " Can not find mappedBy property " + mappedBy + " in " + targetDesc);
|
||||
}
|
||||
if (!(mappedProp instanceof DeployBeanPropertyAssocOne<?>)) {
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property [" + mappedBy + "]is not a ManyToOne?" + "in [" + targetDesc + "]");
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property " + mappedBy + " is not a ManyToOne? in " + targetDesc);
|
||||
}
|
||||
return (DeployBeanPropertyAssocOne<?>) mappedProp;
|
||||
}
|
||||
@@ -1129,15 +1124,15 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
private DeployBeanPropertyAssocMany<?> mappedManyToMany(DeployBeanPropertyAssocMany<?> prop, String mappedBy, DeployBeanDescriptor<?> targetDesc) {
|
||||
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
|
||||
if (mappedProp == null) {
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + " Can not find mappedBy property [" + mappedBy + "] " + "in [" + targetDesc + "]");
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + " Can not find mappedBy property " + mappedBy + " in " + targetDesc);
|
||||
}
|
||||
if (!(mappedProp instanceof DeployBeanPropertyAssocMany<?>)) {
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property [" + targetDesc + "." + mappedBy + "] is not a ManyToMany?");
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property " + targetDesc + "." + mappedBy + " is not a ManyToMany?");
|
||||
}
|
||||
|
||||
DeployBeanPropertyAssocMany<?> mappedAssocMany = (DeployBeanPropertyAssocMany<?>) mappedProp;
|
||||
if (!mappedAssocMany.isManyToMany()) {
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property [" + targetDesc + "." + mappedBy + "] is not a ManyToMany?");
|
||||
throw new PersistenceException("Error on " + prop.getFullBeanName() + ". mappedBy property " + targetDesc + "." + mappedBy + " is not a ManyToMany?");
|
||||
}
|
||||
return mappedAssocMany;
|
||||
}
|
||||
@@ -1251,7 +1246,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
String primaryKeyColumn = desc.getSinglePrimaryKeyColumn();
|
||||
seqName = namingConvention.getSequenceName(desc.getBaseTable(), primaryKeyColumn);
|
||||
}
|
||||
int stepSize = desc.setIdentitySequenceBatchMode(databasePlatform.isSequenceBatchMode());
|
||||
int stepSize = desc.setIdentitySequenceBatchMode(databasePlatform.sequenceBatchMode());
|
||||
desc.setIdGenerator(createSequenceIdGenerator(seqName, stepSize));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,11 +180,6 @@ public final class BeanFkeyProperty implements ElPropertyValue {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int jdbcType() {
|
||||
return 0;
|
||||
@@ -195,11 +190,6 @@ public final class BeanFkeyProperty implements ElPropertyValue {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object parseDateTime(long systemTimeMillis) {
|
||||
throw new RuntimeException("ElPropertyDeploy only - not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringParser stringParser() {
|
||||
throw new RuntimeException("ElPropertyDeploy only - not implemented");
|
||||
|
||||
@@ -22,6 +22,7 @@ import io.ebeaninternal.api.json.SpiJsonReader;
|
||||
import io.ebeaninternal.api.json.SpiJsonWriter;
|
||||
import io.ebeaninternal.server.core.EncryptAlias;
|
||||
import io.ebeaninternal.server.core.InternString;
|
||||
import io.ebeaninternal.server.bind.DataBind;
|
||||
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedProperty;
|
||||
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedWhenCreated;
|
||||
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedWhenModified;
|
||||
@@ -416,7 +417,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
* Return true if the underlying type is mutable.
|
||||
*/
|
||||
public boolean isMutableScalarType() {
|
||||
return scalarType != null && scalarType.isMutable();
|
||||
return scalarType != null && scalarType.mutable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -508,7 +509,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
|
||||
@Override
|
||||
public void loadIgnore(DbReadContext ctx) {
|
||||
scalarType.loadIgnore(ctx.dataReader());
|
||||
ctx.dataReader().incrementPos(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -703,7 +704,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
}
|
||||
|
||||
private Object cacheDataConvert(Object value) {
|
||||
if (value == null || scalarType.isBinaryType()) {
|
||||
if (value == null || scalarType.binary()) {
|
||||
return value;
|
||||
} else {
|
||||
// convert to string as an optimisation for java object serialisation
|
||||
@@ -940,19 +941,9 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
return scalarType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDateTimeCapable() {
|
||||
return scalarType != null && scalarType.isDateTimeCapable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int jdbcType() {
|
||||
return scalarType == null ? 0 : scalarType.getJdbcType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object parseDateTime(long systemTimeMillis) {
|
||||
return scalarType.convertFromMillis(systemTimeMillis);
|
||||
return scalarType == null ? 0 : scalarType.jdbcType();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1416,7 +1407,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
JsonToken event = ctx.nextToken();
|
||||
if (JsonToken.VALUE_NULL == event) {
|
||||
if (jsonDeserialize) {
|
||||
if (ctx.isIntercept()) {
|
||||
if (ctx.intercept()) {
|
||||
setValueIntercept(bean, null);
|
||||
} else {
|
||||
setValue(bean, null);
|
||||
@@ -1426,7 +1417,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
// expect to read non-null json value
|
||||
Object objValue;
|
||||
if (scalarType != null) {
|
||||
objValue = scalarType.jsonRead(ctx.getParser());
|
||||
objValue = scalarType.jsonRead(ctx.parser());
|
||||
} else {
|
||||
try {
|
||||
objValue = ctx.readValueUsingObjectMapper(propertyType);
|
||||
@@ -1439,7 +1430,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
}
|
||||
}
|
||||
if (jsonDeserialize) {
|
||||
if (ctx.isIntercept()) {
|
||||
if (ctx.intercept()) {
|
||||
setValueIntercept(bean, objValue);
|
||||
} else {
|
||||
setValue(bean, objValue);
|
||||
@@ -1472,7 +1463,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
*/
|
||||
public void docStoreMapping(DocMappingBuilder mapping, String prefix) {
|
||||
if (mapping.includesProperty(prefix, name)) {
|
||||
DocPropertyType type = scalarType.getDocType();
|
||||
DocPropertyType type = scalarType.docType();
|
||||
DocPropertyOptions options = docOptions.copy();
|
||||
if (isKeywordType(type, options)) {
|
||||
type = DocPropertyType.KEYWORD;
|
||||
|
||||
@@ -355,7 +355,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
mapping.push(nested);
|
||||
targetDescriptor.docStoreMapping(mapping, fullName);
|
||||
mapping.pop();
|
||||
if (!nested.getChildren().isEmpty()) {
|
||||
if (!nested.children().isEmpty()) {
|
||||
mapping.add(nested);
|
||||
}
|
||||
}
|
||||
@@ -366,7 +366,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
*/
|
||||
public boolean isUpdateable() {
|
||||
TableJoinColumn[] columns = tableJoin.columns();
|
||||
if (columns.length <= 0) {
|
||||
if (columns.length == 0) {
|
||||
return true;
|
||||
}
|
||||
for (TableJoinColumn column : columns) {
|
||||
@@ -383,7 +383,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
*/
|
||||
public boolean isInsertable() {
|
||||
TableJoinColumn[] columns = tableJoin.columns();
|
||||
if (columns.length <= 0) {
|
||||
if (columns.length == 0) {
|
||||
return true;
|
||||
}
|
||||
for (TableJoinColumn column : columns) {
|
||||
@@ -434,7 +434,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
if (!idProp.isEmbedded()) {
|
||||
// simple single scalar id
|
||||
if (cols.length != 1) {
|
||||
CoreLog.log.log(ERROR, "No Imported Id column for [" + idProp + "] in table [" + join.getTable() + "]");
|
||||
CoreLog.log.log(ERROR, "No Imported Id column for {0} in table {1}", idProp, join.getTable());
|
||||
return null;
|
||||
} else {
|
||||
BeanProperty[] idProps = {idProp};
|
||||
|
||||
@@ -718,7 +718,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("Can not find Master [" + beanType + "] in Child[" + targetDesc + "]");
|
||||
throw new RuntimeException("Can not find Master " + beanType + " in Child " + targetDesc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -734,7 +734,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
String from = descriptor.fullName();
|
||||
String to = targetDesc.fullName();
|
||||
throw new PersistenceException(from + ": Could not find mapKey property [" + mapKey + "] on [" + to + "]");
|
||||
throw new PersistenceException(from + ": Could not find mapKey property " + mapKey + " on " + to);
|
||||
}
|
||||
|
||||
public IntersectionRow buildManyDeleteChildren(EntityBean parentBean, List<Object> excludeDetailIds) {
|
||||
@@ -998,7 +998,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
*/
|
||||
private Object jsonReadCollection(String json) throws IOException {
|
||||
SpiJsonReader ctx = descriptor.createJsonReader(json);
|
||||
JsonParser parser = ctx.getParser();
|
||||
JsonParser parser = ctx.parser();
|
||||
JsonToken event = parser.nextToken();
|
||||
if (JsonToken.VALUE_NULL == event) {
|
||||
return null;
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ class BeanPropertyAssocManyJsonHelp {
|
||||
if (!this.many.jsonDeserialize) {
|
||||
return;
|
||||
}
|
||||
JsonParser parser = readJson.getParser();
|
||||
JsonParser parser = readJson.parser();
|
||||
JsonToken event = parser.nextToken();
|
||||
if (JsonToken.VALUE_NULL == event) {
|
||||
return;
|
||||
@@ -50,7 +50,7 @@ class BeanPropertyAssocManyJsonHelp {
|
||||
if (JsonToken.START_ARRAY != event && JsonToken.START_OBJECT != event) {
|
||||
throw new JsonParseException(parser, "Unexpected token " + event + " - expecting start array or object");
|
||||
}
|
||||
if (readJson.isIntercept()) {
|
||||
if (readJson.intercept()) {
|
||||
many.setValueIntercept(parentBean, many.jsonReadCollection(readJson, parentBean));
|
||||
} else {
|
||||
many.setValue(parentBean, many.jsonReadCollection(readJson, parentBean));
|
||||
|
||||
+3
-3
@@ -20,7 +20,7 @@ class BeanPropertyAssocManyJsonTransient {
|
||||
* Use Jackson ObjectMapper to read the transient 'many' property.
|
||||
*/
|
||||
void jsonReadUsingObjectMapper(BeanPropertyAssocMany<?> many, SpiJsonReader readJson, EntityBean parentBean) throws IOException {
|
||||
ObjectMapper mapper = readJson.getObjectMapper();
|
||||
ObjectMapper mapper = readJson.mapper();
|
||||
ManyType manyType = many.manyType();
|
||||
|
||||
Object value;
|
||||
@@ -29,11 +29,11 @@ class BeanPropertyAssocManyJsonTransient {
|
||||
TypeFactory typeFactory = mapper.getTypeFactory();
|
||||
JavaType target = typeFactory.constructType(many.targetType());
|
||||
MapType jacksonType = typeFactory.constructMapType(LinkedHashMap.class, TypeFactory.unknownType(), target);
|
||||
value = mapper.readValue(readJson.getParser(), jacksonType);
|
||||
value = mapper.readValue(readJson.parser(), jacksonType);
|
||||
} else {
|
||||
// read list or set using Jackson object mapper
|
||||
CollectionType jacksonType = mapper.getTypeFactory().constructCollectionType(manyType.getCollectionType(), many.targetType());
|
||||
value = mapper.readValue(readJson.getParser(), jacksonType);
|
||||
value = mapper.readValue(readJson.parser(), jacksonType);
|
||||
}
|
||||
many.setValue(parentBean, value);
|
||||
}
|
||||
|
||||
@@ -768,7 +768,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
if (value == null) {
|
||||
writeJson.writeNullField(name);
|
||||
} else {
|
||||
if (!writeJson.isParentBean(value)) {
|
||||
if (!writeJson.parentBean(value)) {
|
||||
// Hmmm, not writing complex non-entity bean
|
||||
if (value instanceof EntityBean) {
|
||||
writeJson.beginAssocOne(name, bean);
|
||||
@@ -780,12 +780,13 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void jsonRead(SpiJsonReader readJson, EntityBean bean) throws IOException {
|
||||
if (jsonDeserialize && targetDescriptor != null) {
|
||||
T target = (T) value(bean);
|
||||
T assocBean = targetDescriptor.jsonRead(readJson, name, target);
|
||||
if (readJson.isIntercept()) {
|
||||
if (readJson.intercept()) {
|
||||
setValueIntercept(bean, assocBean);
|
||||
} else {
|
||||
setValue(bean, assocBean);
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import io.ebeaninternal.server.deploy.meta.DeployBeanProperty;
|
||||
|
||||
/**
|
||||
* Bean property for synthetic sort order value / order column.
|
||||
*
|
||||
* <p>
|
||||
* The value of which is held on the entity bean intercept.
|
||||
*/
|
||||
public final class BeanPropertyOrderColumn extends BeanProperty {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user