mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Merge branch 'master' into wip/EntityBeanIntercept-interface
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
[](https://github.com/ebean-orm/ebean-datasource/actions/workflows/jdk-ea.yml)
|
||||
[](https://github.com/ebean-orm/ebean-migration/actions/workflows/jdk-ea.yml)
|
||||
[](https://github.com/ebean-orm/ebean-test-docker/actions/workflows/jdk-ea.yml)
|
||||
[](https://github.com/ebean-orm/ebean-agent/actions/workflows/jdk-ea.yml)
|
||||
|
||||
|
||||
# Sponsors
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-clickhouse</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-clickhouse</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-cockroach</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-db2</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-db2</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-h2</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-hana</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-hana</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-mariadb</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mariadb</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-mysql</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mysql</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-nuodb</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-nuodb</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-oracle</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-oracle</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-postgres</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-sqlite</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlite</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-sqlserver</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-yugabyte</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean (all platforms)</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>composites</artifactId>
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
@@ -49,7 +49,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-annotation</artifactId>
|
||||
<version>7.8</version>
|
||||
<version>8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -74,40 +74,16 @@ public interface BeanState {
|
||||
*/
|
||||
Set<String> loadedProps();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to loadedProps().
|
||||
*/
|
||||
@Deprecated
|
||||
default Set<String> getLoadedProps() {
|
||||
return loadedProps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the set of changed properties.
|
||||
*/
|
||||
Set<String> changedProps();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to changedProps().
|
||||
*/
|
||||
@Deprecated
|
||||
default Set<String> getChangedProps() {
|
||||
return changedProps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of the updated properties and their new and old values.
|
||||
*/
|
||||
Map<String, ValuePair> dirtyValues();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to dirtyValues().
|
||||
*/
|
||||
@Deprecated
|
||||
default Map<String, ValuePair> getDirtyValues() {
|
||||
return dirtyValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the bean is readOnly.
|
||||
* <p>
|
||||
@@ -139,24 +115,9 @@ public interface BeanState {
|
||||
*/
|
||||
Map<String, Exception> loadErrors();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to loadErrors().
|
||||
*/
|
||||
@Deprecated
|
||||
default Map<String, Exception> getLoadErrors() {
|
||||
return loadErrors();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the sort order value for an order column.
|
||||
*/
|
||||
int sortOrder();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to sortOrder().
|
||||
*/
|
||||
@Deprecated
|
||||
default int getSortOrder() {
|
||||
return sortOrder();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,9 @@ import java.util.concurrent.Callable;
|
||||
* DB additionally provides a convenient way to use the 'default' Database.
|
||||
* <p>
|
||||
* <h3>Default database</h3>
|
||||
* <p>
|
||||
* One of the Database instances can be registered as the "default database"
|
||||
* and can be obtained using <code>DB.getDefault()</code>
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* Database database = DB.getDefault();
|
||||
@@ -36,7 +35,7 @@ import java.util.concurrent.Callable;
|
||||
* <p>
|
||||
* Multiple database instances can be registered with DB and we can obtain them
|
||||
* using <code>DB.byName()</code>
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* Database hrDatabase = DB.byName("hr");
|
||||
@@ -47,7 +46,6 @@ import java.util.concurrent.Callable;
|
||||
* <p>
|
||||
* DB has methods like {@link #find(Class)} and {@link #save(Object)} which are
|
||||
* just convenience for using the default database.
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
@@ -117,39 +115,26 @@ public final class DB {
|
||||
* build the WHERE and HAVING clauses. Alternatively you can use the
|
||||
* ExpressionFactory directly to create expressions to add to the query where
|
||||
* clause.
|
||||
* </p>
|
||||
* <p>
|
||||
* Alternatively you can use the {@link Expr} as a shortcut to the
|
||||
* ExpressionFactory of the 'Default' database.
|
||||
* </p>
|
||||
* <p>
|
||||
* You generally need to the an ExpressionFactory (or {@link Expr}) to build
|
||||
* an expression that uses OR like Expression e = Expr.or(..., ...);
|
||||
* </p>
|
||||
*/
|
||||
public static ExpressionFactory expressionFactory() {
|
||||
return getDefault().expressionFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to expressionFactory().
|
||||
*/
|
||||
@Deprecated
|
||||
public static ExpressionFactory getExpressionFactory() {
|
||||
return expressionFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the next identity value for a given bean type.
|
||||
* <p>
|
||||
* This will only work when a IdGenerator is on this bean type such as a DB
|
||||
* sequence or UUID.
|
||||
* </p>
|
||||
* <p>
|
||||
* For DB's supporting getGeneratedKeys and sequences such as Oracle10 you do
|
||||
* not need to use this method generally. It is made available for more
|
||||
* complex cases where it is useful to get an ID prior to some processing.
|
||||
* </p>
|
||||
*/
|
||||
public static Object nextId(Class<?> beanType) {
|
||||
return getDefault().nextId(beanType);
|
||||
@@ -159,17 +144,14 @@ public final class DB {
|
||||
* Start a transaction with 'REQUIRED' semantics.
|
||||
* <p>
|
||||
* With REQUIRED semantics if an active transaction already exists that transaction will be used.
|
||||
* </p>
|
||||
* <p>
|
||||
* The transaction is stored in a ThreadLocal variable and typically you only
|
||||
* need to use the returned Transaction <em>IF</em> you wish to do things like
|
||||
* use batch mode, change the transaction isolation level, use savepoints or
|
||||
* log comments to the transaction log.
|
||||
* </p>
|
||||
* <p>
|
||||
* Example of using a transaction to span multiple calls to find(), save()
|
||||
* etc.
|
||||
* </p>
|
||||
* Example of using a transaction to span multiple calls to find(), save() etc.
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* try (Transaction transaction = DB.beginTransaction()) {
|
||||
@@ -187,7 +169,6 @@ public final class DB {
|
||||
* With Database we can pass the transaction to the various find(), save() and execute()
|
||||
* methods. This gives us the ability to create the transactions externally from Ebean
|
||||
* and use the transaction explicitly via the various methods available on Database.
|
||||
* </p>
|
||||
*/
|
||||
public static Transaction beginTransaction() {
|
||||
return getDefault().beginTransaction();
|
||||
@@ -199,7 +180,6 @@ public final class DB {
|
||||
* You will want to do this if you want multiple Transactions in a single
|
||||
* thread or generally use transactions outside of the TransactionThreadLocal
|
||||
* management.
|
||||
* </p>
|
||||
*/
|
||||
public static Transaction createTransaction() {
|
||||
return getDefault().createTransaction();
|
||||
@@ -219,7 +199,6 @@ public final class DB {
|
||||
* <p>
|
||||
* Note that this provides an try finally alternative to using {@link #executeCall(TxScope, Callable)} or
|
||||
* {@link #execute(TxScope, Runnable)}.
|
||||
* </p>
|
||||
* <p>
|
||||
* <h3>REQUIRES_NEW example:</h3>
|
||||
* <pre>{@code
|
||||
@@ -278,7 +257,7 @@ public final class DB {
|
||||
|
||||
/**
|
||||
* Register a TransactionCallback on the currently active transaction.
|
||||
* <p/>
|
||||
* <p>
|
||||
* If there is no currently active transaction then a PersistenceException is thrown.
|
||||
*
|
||||
* @param transactionCallback the transaction callback to be registered with the current transaction
|
||||
@@ -307,14 +286,12 @@ public final class DB {
|
||||
* rollback the transaction.
|
||||
* <p>
|
||||
* It is preferable to use <em>try with resources</em> rather than this.
|
||||
* </p>
|
||||
* <p>
|
||||
* Useful to put in a finally block to ensure the transaction is ended, rather
|
||||
* than a rollbackTransaction() in each catch block.
|
||||
* </p>
|
||||
* <p>
|
||||
* Code example:
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
* DB.beginTransaction();
|
||||
* try {
|
||||
@@ -345,7 +322,6 @@ public final class DB {
|
||||
* <p>
|
||||
* When null is passed in for b, then the 'OldValues' of a is used for the
|
||||
* difference comparison.
|
||||
* </p>
|
||||
*/
|
||||
public static Map<String, ValuePair> diff(Object a, Object b) {
|
||||
return getDefault().diff(a, b);
|
||||
@@ -356,18 +332,15 @@ public final class DB {
|
||||
* <p>
|
||||
* If there is no current transaction one will be created and committed for
|
||||
* you automatically.
|
||||
* </p>
|
||||
* <p>
|
||||
* Save can cascade along relationships. For this to happen you need to
|
||||
* specify a cascade of CascadeType.ALL or CascadeType.PERSIST on the
|
||||
* OneToMany, OneToOne or ManyToMany annotation.
|
||||
* </p>
|
||||
* <p>
|
||||
* When a save cascades via a OneToMany or ManyToMany Ebean will automatically
|
||||
* set the 'parent' object to the 'detail' object. In the example below in
|
||||
* saving the order and cascade saving the order details the 'parent' order
|
||||
* will be set against each order detail when it is saved.
|
||||
* </p>
|
||||
*/
|
||||
public static void save(Object bean) throws OptimisticLockException {
|
||||
getDefault().save(bean);
|
||||
@@ -418,11 +391,9 @@ public final class DB {
|
||||
* <b>Stateless updates:</b> Note that the bean does not have to be previously fetched to call
|
||||
* update().You can create a new instance and set some of its properties programmatically for via
|
||||
* JSON/XML marshalling etc. This is described as a 'stateless update'.
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>Optimistic Locking: </b> Note that if the version property is not set when update() is
|
||||
* called then no optimistic locking is performed (internally ConcurrencyMode.NONE is used).
|
||||
* </p>
|
||||
* <p>
|
||||
* <pre>{@code
|
||||
*
|
||||
@@ -539,20 +510,16 @@ public final class DB {
|
||||
* Delete the bean.
|
||||
* <p>
|
||||
* This will return true if the bean was deleted successfully or JDBC batch is being used.
|
||||
* </p>
|
||||
* <p>
|
||||
* If there is no current transaction one will be created and committed for
|
||||
* you automatically.
|
||||
* </p>
|
||||
* <p>
|
||||
* If the bean is configured with <code>@SoftDelete</code> then this will perform a soft
|
||||
* delete rather than a hard/permanent delete.
|
||||
* </p>
|
||||
* <p>
|
||||
* If the Bean does not have a version property (or loaded version property) and
|
||||
* the bean does not exist then this returns false indicating that nothing was
|
||||
* deleted. Note that, if JDBC batch mode is used then this always returns true.
|
||||
* </p>
|
||||
*/
|
||||
public static boolean delete(Object bean) throws OptimisticLockException {
|
||||
return getDefault().delete(bean);
|
||||
@@ -612,7 +579,6 @@ public final class DB {
|
||||
* <p>
|
||||
* Note that this resets OneToMany and ManyToMany properties so that if they
|
||||
* are accessed a lazy load will refresh the many property.
|
||||
* </p>
|
||||
*/
|
||||
public static void refresh(Object bean) {
|
||||
getDefault().refresh(bean);
|
||||
@@ -620,6 +586,7 @@ public final class DB {
|
||||
|
||||
/**
|
||||
* Refresh a 'many' property of a bean.
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* Order order = ...;
|
||||
@@ -640,7 +607,7 @@ public final class DB {
|
||||
* Get a reference object.
|
||||
* <p>
|
||||
* This is sometimes described as a proxy (with lazy loading).
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* Product product = DB.getReference(Product.class, 1);
|
||||
@@ -661,14 +628,6 @@ public final class DB {
|
||||
return getDefault().reference(beanType, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanId().
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> T getReference(Class<T> beanType, Object id) {
|
||||
return reference(beanType, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the list using the sortByClause which can contain a comma delimited
|
||||
* list of property names and keywords asc, desc, nullsHigh and nullsLow.
|
||||
@@ -684,7 +643,7 @@ public final class DB {
|
||||
* <p>
|
||||
* Note that the sorting uses a Comparator and Collections.sort(); and does
|
||||
* not invoke a DB query.
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* // find orders and their customers
|
||||
@@ -719,9 +678,8 @@ public final class DB {
|
||||
*
|
||||
* }</pre>
|
||||
* <p>
|
||||
* If you want more control over the query then you can use createQuery() and
|
||||
* Query.findOne();
|
||||
* </p>
|
||||
* If you want more control over the query then you can use createQuery() and Query.findOne();
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* // ... additionally fetching customer, customer shipping address,
|
||||
@@ -761,40 +719,25 @@ public final class DB {
|
||||
}
|
||||
|
||||
/**
|
||||
* Look to execute a native sql query that does not returns beans but instead
|
||||
* returns SqlRow or direct access to ResultSet (see {@link SqlQuery#findList(RowMapper)}.
|
||||
*
|
||||
* Look to execute a native sql query that does not return beans but instead
|
||||
* returns SqlRow or uses {@link RowMapper}.
|
||||
* <p>
|
||||
* Refer to {@link DtoQuery} for native sql queries returning DTO beans.
|
||||
* </p>
|
||||
* <p>
|
||||
* Refer to {@link #findNative(Class, String)} for native sql queries returning entity beans.
|
||||
* </p>
|
||||
*/
|
||||
public static SqlQuery sqlQuery(String sql) {
|
||||
return getDefault().sqlQuery(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to sqlQuery().
|
||||
* <p>
|
||||
* This is an alias for {@link #sqlQuery(String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static SqlQuery createSqlQuery(String sql) {
|
||||
return sqlQuery(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Look to execute a native sql insert update or delete statement.
|
||||
* <p>
|
||||
* Use this to execute a Insert Update or Delete statement. The statement will
|
||||
* be native to the database and contain database table and column names.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* See {@link SqlUpdate} for example usage.
|
||||
* </p>
|
||||
*
|
||||
* @return The SqlUpdate instance to set parameters and execute
|
||||
*/
|
||||
@@ -802,16 +745,6 @@ public final class DB {
|
||||
return getDefault().sqlUpdate(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to sqlUpdate().
|
||||
* <p>
|
||||
* This is an alias for {@link #sqlUpdate(String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static SqlUpdate createSqlUpdate(String sql) {
|
||||
return sqlUpdate(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a CallableSql to execute a given stored procedure.
|
||||
*
|
||||
@@ -828,10 +761,9 @@ public final class DB {
|
||||
* <p>
|
||||
* The orm update differs from the sql update in that it you can use the bean
|
||||
* name and bean property names rather than table and column names.
|
||||
* </p>
|
||||
* <p>
|
||||
* An example:
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* // The bean name and properties - "topic","postCount" and "id"
|
||||
@@ -864,7 +796,6 @@ public final class DB {
|
||||
* Create a named query.
|
||||
* <p>
|
||||
* For RawSql the named query is expected to be in ebean.xml.
|
||||
* </p>
|
||||
*
|
||||
* @param beanType The type of entity bean
|
||||
* @param namedQuery The name of the query
|
||||
@@ -880,15 +811,12 @@ public final class DB {
|
||||
* <p>
|
||||
* You can use the methods on the Query object to specify fetch paths,
|
||||
* predicates, order by, limits etc.
|
||||
* </p>
|
||||
* <p>
|
||||
* You then use findList(), findSet(), findMap() and findOne() to execute
|
||||
* the query and return the collection or bean.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note that a query executed by {@link Query#findList()} etc will execute against
|
||||
* the same database from which is was created.
|
||||
* </p>
|
||||
*
|
||||
* @param beanType the class of entity to be fetched
|
||||
* @return A ORM Query for this beanType
|
||||
@@ -940,7 +868,6 @@ public final class DB {
|
||||
* This is actually the same as {@link #createQuery(Class)}. The reason it
|
||||
* exists is that people used to JPA will probably be looking for a
|
||||
* createQuery method (the same as entityManager).
|
||||
* </p>
|
||||
*
|
||||
* @param beanType the type of entity bean to find
|
||||
* @return A ORM Query object for this beanType
|
||||
@@ -953,7 +880,7 @@ public final class DB {
|
||||
* Create a query using native SQL.
|
||||
* <p>
|
||||
* The native SQL can contain named parameters or positioned parameters.
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* String sql = "select c.id, c.name from customer c where c.name like ? order by c.name";
|
||||
@@ -978,7 +905,6 @@ public final class DB {
|
||||
* <p>
|
||||
* DTO beans are just normal bean like classes with public constructor(s) and setters.
|
||||
* They do not need to be registered with Ebean before use.
|
||||
* </p>
|
||||
*
|
||||
* @param dtoType The type of the DTO bean the rows will be mapped into.
|
||||
* @param sql The SQL query to execute.
|
||||
@@ -1015,10 +941,8 @@ public final class DB {
|
||||
* going back to the database.
|
||||
* <p>
|
||||
* This produces and returns a new list with the sort and filters applied.
|
||||
* </p>
|
||||
* <p>
|
||||
* Refer to {@link Filter} for an example of its use.
|
||||
* </p>
|
||||
*/
|
||||
public static <T> Filter<T> filter(Class<T> beanType) {
|
||||
return getDefault().filter(beanType);
|
||||
@@ -1029,7 +953,7 @@ public final class DB {
|
||||
* <p>
|
||||
* The scope can control the transaction type, isolation and rollback
|
||||
* semantics.
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* // set specific transactional scope settings
|
||||
@@ -1053,7 +977,7 @@ public final class DB {
|
||||
* <p>
|
||||
* The default scope runs with REQUIRED and by default will rollback on any
|
||||
* exception (checked or runtime).
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* DB.execute(() -> {
|
||||
@@ -1078,7 +1002,7 @@ public final class DB {
|
||||
* <p>
|
||||
* The scope can control the transaction type, isolation and rollback
|
||||
* semantics.
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* // set specific transactional scope settings
|
||||
@@ -1102,11 +1026,10 @@ public final class DB {
|
||||
* <p>
|
||||
* The default scope runs with REQUIRED and by default will rollback on any
|
||||
* exception (checked or runtime).
|
||||
* </p>
|
||||
* <p>
|
||||
* This is basically the same as TxRunnable except that it returns an Object
|
||||
* (and you specify the return type via generics).
|
||||
* </p>
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* DB.executeCall(() -> {
|
||||
@@ -1135,23 +1058,19 @@ public final class DB {
|
||||
* <p>
|
||||
* If you use DB.execute(UpdateSql) then the table modification information
|
||||
* is automatically deduced and you do not need to call this method yourself.
|
||||
* </p>
|
||||
* <p>
|
||||
* This information is used to invalidate objects out of the cache and
|
||||
* potentially text indexes. This information is also automatically broadcast
|
||||
* across the cluster.
|
||||
* </p>
|
||||
* <p>
|
||||
* If there is a transaction then this information is placed into the current
|
||||
* transactions event information. When the transaction is committed this
|
||||
* information is registered (with the transaction manager). If this
|
||||
* transaction is rolled back then none of the transaction event information
|
||||
* registers including the information you put in via this method.
|
||||
* </p>
|
||||
* <p>
|
||||
* If there is NO current transaction when you call this method then this
|
||||
* information is registered immediately (with the transaction manager).
|
||||
* </p>
|
||||
*
|
||||
* @param tableName the name of the table that was modified
|
||||
* @param inserts true if rows where inserted into the table
|
||||
@@ -1166,20 +1085,11 @@ public final class DB {
|
||||
* Return the BeanState for a given entity bean.
|
||||
* <p>
|
||||
* This will return null if the bean is not an enhanced entity bean.
|
||||
* </p>
|
||||
*/
|
||||
public static BeanState beanState(Object bean) {
|
||||
return getDefault().beanState(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanState().
|
||||
*/
|
||||
@Deprecated
|
||||
public static BeanState getBeanState(Object bean) {
|
||||
return beanState(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the Id property for a given bean.
|
||||
*/
|
||||
@@ -1187,14 +1097,6 @@ public final class DB {
|
||||
return getDefault().beanId(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanId().
|
||||
*/
|
||||
@Deprecated
|
||||
public static Object getBeanId(Object bean) {
|
||||
return beanId(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and lock the bean using {@code select for update}.
|
||||
* <p>
|
||||
@@ -1210,14 +1112,6 @@ public final class DB {
|
||||
getDefault().lock(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to cacheManager().
|
||||
*/
|
||||
@Deprecated
|
||||
public static ServerCacheManager getServerCacheManager() {
|
||||
return getDefault().cacheManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the manager of the level 2 cache ("L2" cache).
|
||||
*/
|
||||
@@ -1233,14 +1127,6 @@ public final class DB {
|
||||
return getDefault().backgroundExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to backgroundExecutor().
|
||||
*/
|
||||
@Deprecated
|
||||
public static BackgroundExecutor getBackgroundExecutor() {
|
||||
return backgroundExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the JsonContext for reading/writing JSON.
|
||||
*/
|
||||
|
||||
@@ -123,81 +123,33 @@ public interface Database {
|
||||
*/
|
||||
AutoTune autoTune();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to autoTune().
|
||||
*/
|
||||
@Deprecated
|
||||
default AutoTune getAutoTune() {
|
||||
return autoTune();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the associated DataSource for this Database instance.
|
||||
*/
|
||||
DataSource dataSource();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to dataSource().
|
||||
*/
|
||||
@Deprecated
|
||||
default DataSource getDataSource() {
|
||||
return dataSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the associated read only DataSource for this Database instance (can be null).
|
||||
*/
|
||||
DataSource readOnlyDataSource();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to readOnlyDataSource().
|
||||
*/
|
||||
@Deprecated
|
||||
default DataSource getReadOnlyDataSource() {
|
||||
return readOnlyDataSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name. This is used with {@link DB#byName(String)} to get a
|
||||
* Database that was registered with the DB singleton.
|
||||
*/
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to name().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ExpressionFactory for this database.
|
||||
*/
|
||||
ExpressionFactory expressionFactory();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to expressionFactory().
|
||||
*/
|
||||
@Deprecated
|
||||
default ExpressionFactory getExpressionFactory() {
|
||||
return expressionFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the MetaInfoManager which is used to get meta data from the Database
|
||||
* such as query execution statistics.
|
||||
*/
|
||||
MetaInfoManager metaInfo();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to metaInfo().
|
||||
*/
|
||||
@Deprecated
|
||||
default MetaInfoManager getMetaInfoManager() {
|
||||
return metaInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the platform used for this database instance.
|
||||
* <p>
|
||||
@@ -217,27 +169,11 @@ public interface Database {
|
||||
*/
|
||||
Platform platform();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to platform().
|
||||
*/
|
||||
@Deprecated
|
||||
default Platform getPlatform() {
|
||||
return platform();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the extended API intended for use by plugins.
|
||||
*/
|
||||
SpiServer pluginApi();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to pluginApi().
|
||||
*/
|
||||
@Deprecated
|
||||
default SpiServer getPluginApi() {
|
||||
return pluginApi();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BeanState for a given entity bean.
|
||||
* <p>
|
||||
@@ -246,27 +182,11 @@ public interface Database {
|
||||
*/
|
||||
BeanState beanState(Object bean);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanState().
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanState getBeanState(Object bean) {
|
||||
return beanState(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the Id property for a given bean.
|
||||
*/
|
||||
Object beanId(Object bean);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanId().
|
||||
*/
|
||||
@Deprecated
|
||||
default Object getBeanId(Object bean) {
|
||||
return beanId(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Id value onto the bean converting the type of the id value if necessary.
|
||||
* <p>
|
||||
@@ -279,14 +199,6 @@ public interface Database {
|
||||
*/
|
||||
Object beanId(Object bean, Object id);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanId().
|
||||
*/
|
||||
@Deprecated
|
||||
default Object setBeanId(Object bean, Object id) {
|
||||
return beanId(bean, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a map of the differences between two objects of the same type.
|
||||
* <p>
|
||||
@@ -588,14 +500,6 @@ public interface Database {
|
||||
*/
|
||||
SqlQuery sqlQuery(String sql);
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to sqlQuery().
|
||||
* <p>
|
||||
* This is an alias for {@link #sqlQuery(String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
SqlQuery createSqlQuery(String sql);
|
||||
|
||||
/**
|
||||
* Look to execute a native sql insert update or delete statement.
|
||||
* <p>
|
||||
@@ -611,14 +515,6 @@ public interface Database {
|
||||
*/
|
||||
SqlUpdate sqlUpdate(String sql);
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to sqlUpdate().
|
||||
* <p>
|
||||
* This is an alias for {@link #sqlUpdate(String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
SqlUpdate createSqlUpdate(String sql);
|
||||
|
||||
/**
|
||||
* Create a CallableSql to execute a given stored procedure.
|
||||
*/
|
||||
@@ -952,14 +848,6 @@ public interface Database {
|
||||
*/
|
||||
<T> T reference(Class<T> beanType, Object id);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to reference().
|
||||
*/
|
||||
@Deprecated
|
||||
default <T> T getReference(Class<T> beanType, Object id) {
|
||||
return reference(beanType, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the extended API for Database.
|
||||
* <p>
|
||||
@@ -1528,28 +1416,12 @@ public interface Database {
|
||||
*/
|
||||
ServerCacheManager cacheManager();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to cacheManager().
|
||||
*/
|
||||
@Deprecated
|
||||
default ServerCacheManager getServerCacheManager() {
|
||||
return cacheManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BackgroundExecutor service for asynchronous processing of
|
||||
* queries.
|
||||
*/
|
||||
BackgroundExecutor backgroundExecutor();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to backgroundExecutor().
|
||||
*/
|
||||
@Deprecated
|
||||
default BackgroundExecutor getBackgroundExecutor() {
|
||||
return backgroundExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the JsonContext for reading/writing JSON.
|
||||
* <p>
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
* methods on the DB singleton such as {@link DB#find(Class)} are just a
|
||||
* convenient way of using the 'default/primary' Database.
|
||||
*/
|
||||
public class DatabaseFactory {
|
||||
public final class DatabaseFactory {
|
||||
|
||||
private static final ReentrantLock lock = new ReentrantLock();
|
||||
private static SpiContainer container;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
* <p/>
|
||||
* Intended for internal use as part of bootup, construction, registration of the default database.
|
||||
*/
|
||||
class DbPrimary {
|
||||
final class DbPrimary {
|
||||
|
||||
private static final ReentrantLock lock = new ReentrantLock();
|
||||
private static String defaultServerName;
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Properties;
|
||||
*
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*/
|
||||
public class EbeanVersion {
|
||||
public final class EbeanVersion {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Map;
|
||||
*
|
||||
* @see Query#where()
|
||||
*/
|
||||
public class Expr {
|
||||
public final class Expr {
|
||||
|
||||
private Expr() {
|
||||
}
|
||||
|
||||
@@ -112,19 +112,6 @@ public interface ExtendedServer {
|
||||
*/
|
||||
<T> Stream<T> findStream(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to findStream().
|
||||
* <p>
|
||||
* Execute the query returning the result as a Stream.
|
||||
* <p>
|
||||
* Note that this can support very large queries iterating any number of results.
|
||||
* To do so internally it can use multiple persistence contexts.
|
||||
* <p>
|
||||
* Note that the stream needs to be closed so use with try with resources.
|
||||
*/
|
||||
@Deprecated
|
||||
<T> Stream<T> findLargeStream(Query<T> query, Transaction transaction);
|
||||
|
||||
/**
|
||||
* Execute the query visiting the each bean one at a time.
|
||||
* <p>
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.io.Serializable;
|
||||
* @author mario
|
||||
* @author rbygrave
|
||||
*/
|
||||
public class FetchConfig implements Serializable {
|
||||
public final class FetchConfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -750,29 +750,6 @@ public interface Query<T> extends CancelableQuery {
|
||||
*/
|
||||
Stream<T> findStream();
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to findStream.
|
||||
* <p>
|
||||
* Execute the query returning the result as a Stream.
|
||||
* <p>
|
||||
* Note that this uses multiple persistence contexts such that we can use
|
||||
* it with a large number of results.
|
||||
* </p>
|
||||
* <pre>{@code
|
||||
*
|
||||
* // use try with resources to ensure Stream is closed
|
||||
*
|
||||
* try (Stream<Customer> stream = query.findLargeStream()) {
|
||||
* stream
|
||||
* .map(...)
|
||||
* .collect(...);
|
||||
* }
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
@Deprecated
|
||||
Stream<T> findLargeStream();
|
||||
|
||||
/**
|
||||
* Execute the query processing the beans one at a time.
|
||||
* <p>
|
||||
|
||||
@@ -74,18 +74,6 @@ public interface SqlQuery extends Serializable, CancelableQuery {
|
||||
@Nullable
|
||||
SqlRow findOne();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to use {@link #mapTo(RowMapper)}
|
||||
*/
|
||||
@Deprecated
|
||||
<T> T findOne(RowMapper<T> mapper);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to use {@link #mapTo(RowMapper)}
|
||||
*/
|
||||
@Deprecated
|
||||
<T> List<T> findList(RowMapper<T> mapper);
|
||||
|
||||
/**
|
||||
* Execute the query reading each row from ResultSet using the RowConsumer.
|
||||
* <p>
|
||||
@@ -121,50 +109,6 @@ public interface SqlQuery extends Serializable, CancelableQuery {
|
||||
*/
|
||||
Optional<SqlRow> findOneOrEmpty();
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to <code>.mapToScalar(attributeType).findOne()</code>.
|
||||
* <pre>{@code
|
||||
*
|
||||
* .mapToScalar(BigDecimal.class)
|
||||
* .findOne();
|
||||
* }
|
||||
*/
|
||||
@Deprecated
|
||||
<T> T findSingleAttribute(Class<T> attributeType);
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to <code>.mapToScalar(BigDecimal.class).findOne()</code>.
|
||||
* <pre>{@code
|
||||
*
|
||||
* .mapToScalar(BigDecimal.class)
|
||||
* .findOne();
|
||||
* }
|
||||
*/
|
||||
@Deprecated
|
||||
BigDecimal findSingleDecimal();
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to <code>.mapToScalar(Long.class).findOne()</code>.
|
||||
* <pre>{@code
|
||||
*
|
||||
* .mapToScalar(Long.class)
|
||||
* .findOne();
|
||||
* }
|
||||
*/
|
||||
@Deprecated
|
||||
Long findSingleLong();
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to <code>.mapToScalar(Long.class).findList()</code>.
|
||||
* <pre>{@code
|
||||
*
|
||||
* .mapToScalar(Long.class)
|
||||
* .findList();
|
||||
* }
|
||||
*/
|
||||
@Deprecated
|
||||
<T> List<T> findSingleAttributeList(Class<T> attributeType);
|
||||
|
||||
/**
|
||||
* Set one of more positioned parameters.
|
||||
* <p>
|
||||
@@ -194,12 +138,6 @@ public interface SqlQuery extends Serializable, CancelableQuery {
|
||||
*/
|
||||
SqlQuery setParameters(Object... values);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to setParameters(Object... values)
|
||||
*/
|
||||
@Deprecated
|
||||
SqlQuery setParams(Object... values);
|
||||
|
||||
/**
|
||||
* Set the next bind parameter by position.
|
||||
* <pre>{@code
|
||||
|
||||
@@ -287,12 +287,6 @@ public interface SqlUpdate {
|
||||
*/
|
||||
SqlUpdate setParameters(Object... values);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to setParameters(Object... values).
|
||||
*/
|
||||
@Deprecated
|
||||
SqlUpdate setParams(Object... values);
|
||||
|
||||
/**
|
||||
* Set the next bind parameter by position.
|
||||
*
|
||||
@@ -300,12 +294,6 @@ public interface SqlUpdate {
|
||||
*/
|
||||
SqlUpdate setParameter(Object value);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to setParameter(value).
|
||||
*/
|
||||
@Deprecated
|
||||
SqlUpdate setNextParameter(Object value);
|
||||
|
||||
/**
|
||||
* Set a parameter via its index position.
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.ServiceLoader;
|
||||
/**
|
||||
* Lookup internal services.
|
||||
*/
|
||||
class XServiceProvider {
|
||||
final class XServiceProvider {
|
||||
|
||||
private static SpiRawSqlService rawSqlService = initRawSql();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.Set;
|
||||
* <em>java.util.Collection</em>. The reason being that java.util.Map is not a
|
||||
* Collection. I realise this makes this name confusing so I apologise for that.
|
||||
*/
|
||||
public interface BeanCollection<E> extends Serializable {
|
||||
public interface BeanCollection<E> extends Serializable, ToStringAware {
|
||||
|
||||
enum ModifyListenMode {
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.io.Serializable;
|
||||
* general application consumption.
|
||||
* </p>
|
||||
*/
|
||||
public interface EntityBean extends Serializable {
|
||||
public interface EntityBean extends Serializable, ToStringAware {
|
||||
|
||||
/**
|
||||
* Return all the property names in defined order.
|
||||
@@ -116,4 +116,8 @@ public interface EntityBean extends Serializable {
|
||||
throw new NotEnhancedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
default void toString(ToStringBuilder builder) {
|
||||
throw new NotEnhancedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package io.ebean.bean;
|
||||
|
||||
/**
|
||||
* A type that can participate in building toString content with ToStringBuilder.
|
||||
*/
|
||||
public interface ToStringAware {
|
||||
|
||||
/**
|
||||
* Append to the ToStringBuilder.
|
||||
*/
|
||||
void toString(ToStringBuilder builder);
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package io.ebean.bean;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.IdentityHashMap;
|
||||
|
||||
/**
|
||||
* Helps build toString content taking into account recursion.
|
||||
* <p>
|
||||
* That is, it detects and handles the case where there are relationships that recurse
|
||||
* and would otherwise become an infinite loop (e.g. bidirectional parent child).
|
||||
*/
|
||||
public final class ToStringBuilder {
|
||||
|
||||
/**
|
||||
* The max number of objects that we allow before stopping content being appended.
|
||||
*/
|
||||
private static final int MAX = 100;
|
||||
|
||||
/**
|
||||
* Max length of content in string form added for any given value.
|
||||
*/
|
||||
private static final int TRIM_LENGTH = 500;
|
||||
|
||||
/**
|
||||
* The max total content after which we stop content being appended.
|
||||
*/
|
||||
private static final int MAX_TOTAL_CONTENT = 2000;
|
||||
|
||||
private final IdentityHashMap<Object, Integer> id = new IdentityHashMap<>();
|
||||
private final StringBuilder sb = new StringBuilder(50);
|
||||
private boolean first = true;
|
||||
private int counter;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set of an object being added.
|
||||
*/
|
||||
public void start(Object bean) {
|
||||
if (counter == 0) {
|
||||
id.putIfAbsent(bean, 0);
|
||||
}
|
||||
if (counter <= MAX) {
|
||||
sb.append(bean.getClass().getSimpleName()).append("@").append(counter).append("(");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a property as name value pair.
|
||||
*/
|
||||
public void add(String name, Object value) {
|
||||
if (value != null && counter <= MAX) {
|
||||
if (value instanceof BeanCollection) {
|
||||
if (((BeanCollection<?>)value).isReference()) {
|
||||
// suppress unloaded bean collections
|
||||
return;
|
||||
}
|
||||
}
|
||||
key(name);
|
||||
value(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add raw content.
|
||||
*/
|
||||
public void addRaw(String content) {
|
||||
sb.append(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* End of an object.
|
||||
*/
|
||||
public void end() {
|
||||
if (counter <= MAX) {
|
||||
sb.append(")");
|
||||
}
|
||||
}
|
||||
|
||||
private void key(String name) {
|
||||
if (counter > MAX) {
|
||||
return;
|
||||
}
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(name).append(":");
|
||||
}
|
||||
|
||||
private void value(Object value) {
|
||||
if (counter > MAX) {
|
||||
return;
|
||||
}
|
||||
if (value instanceof ToStringAware) {
|
||||
if (value instanceof BeanCollection) {
|
||||
((ToStringAware) value).toString(this);
|
||||
} else if (push(value)) {
|
||||
((ToStringAware) value).toString(this);
|
||||
}
|
||||
} else if (value instanceof Collection) {
|
||||
addCollection((Collection<?>) value);
|
||||
} else {
|
||||
String content = String.valueOf(value);
|
||||
if (content.length() > TRIM_LENGTH) {
|
||||
content = content.substring(0, TRIM_LENGTH) + " <trimmed>";
|
||||
}
|
||||
sb.append(content);
|
||||
if (sb.length() >= MAX_TOTAL_CONTENT) {
|
||||
sb.append(" ...");
|
||||
counter += MAX;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a collection of values.
|
||||
*/
|
||||
public void addCollection(Collection<?> c) {
|
||||
if (c == null || c.isEmpty()) {
|
||||
sb.append("[]");
|
||||
return;
|
||||
}
|
||||
boolean firstElement = true;
|
||||
sb.append("[");
|
||||
for (Object o : c) {
|
||||
if (firstElement) {
|
||||
firstElement = false;
|
||||
} else {
|
||||
sb.append(", ");
|
||||
}
|
||||
value(o);
|
||||
if (counter > MAX) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
sb.append("]");
|
||||
}
|
||||
|
||||
private boolean push(Object bean) {
|
||||
if (counter > MAX) {
|
||||
return false;
|
||||
}
|
||||
if (counter == MAX) {
|
||||
sb.append(" ...");
|
||||
counter++;
|
||||
return false;
|
||||
}
|
||||
Integer idx = id.putIfAbsent(bean, counter++);
|
||||
if (idx != null) {
|
||||
--counter;
|
||||
sb.append(bean.getClass().getSimpleName()).append("@").append(idx);
|
||||
return false;
|
||||
}
|
||||
first = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+15
-15
@@ -1,5 +1,6 @@
|
||||
package io.ebean.cache;
|
||||
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -68,40 +69,39 @@ public interface ServerCache {
|
||||
/**
|
||||
* Return the number of entries in the cache.
|
||||
*/
|
||||
int size();
|
||||
default int size() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the hit ratio the cache is currently getting.
|
||||
*/
|
||||
default int hitRatio() {
|
||||
return getHitRatio();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to hitRatio().
|
||||
*/
|
||||
@Deprecated
|
||||
int getHitRatio();
|
||||
|
||||
/**
|
||||
* Return statistics for the cache.
|
||||
*
|
||||
* @param reset if true the statistics are reset.
|
||||
*/
|
||||
@Nullable
|
||||
default ServerCacheStatistics statistics(boolean reset) {
|
||||
return getStatistics(reset);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to statistics().
|
||||
*/
|
||||
@Deprecated
|
||||
ServerCacheStatistics getStatistics(boolean reset);
|
||||
|
||||
/**
|
||||
* Visit the metrics for the cache.
|
||||
*/
|
||||
default void visit(MetricVisitor visitor) {
|
||||
// do nothing by default
|
||||
}
|
||||
|
||||
/**
|
||||
* Unwrap the underlying ServerCache.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
default <T> T unwrap(Class<T> cls) {
|
||||
return (T) this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public class ServerCacheConfig {
|
||||
private final ServerCacheOptions cacheOptions;
|
||||
private final CurrentTenantProvider tenantProvider;
|
||||
private final QueryCacheEntryValidate queryCacheEntryValidate;
|
||||
private final TenantAwareKey tenantAwareKey;
|
||||
|
||||
public ServerCacheConfig(ServerCacheType type, String cacheKey, String shortName, ServerCacheOptions cacheOptions, CurrentTenantProvider tenantProvider, QueryCacheEntryValidate queryCacheEntryValidate) {
|
||||
this.type = type;
|
||||
@@ -21,6 +22,14 @@ public class ServerCacheConfig {
|
||||
this.cacheOptions = cacheOptions;
|
||||
this.tenantProvider = tenantProvider;
|
||||
this.queryCacheEntryValidate = queryCacheEntryValidate;
|
||||
this.tenantAwareKey = (tenantProvider == null) ? null : new TenantAwareKey(tenantProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ServerCache taking into account if multi-tenant is used.
|
||||
*/
|
||||
public ServerCache tenantAware(ServerCache cache) {
|
||||
return tenantAwareKey == null ? cache : new TenantAwareCache(cache, tenantAwareKey);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,14 +23,6 @@ public interface ServerCacheManager {
|
||||
*/
|
||||
boolean localL2Caching();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to localL2Caching().
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean isLocalL2Caching() {
|
||||
return localL2Caching();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the cache regions.
|
||||
*/
|
||||
@@ -46,77 +38,36 @@ public interface ServerCacheManager {
|
||||
*/
|
||||
void enabledRegions(String regions);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to enabledRegions().
|
||||
*/
|
||||
@Deprecated
|
||||
default void setEnabledRegions(String regions) {
|
||||
enabledRegions(regions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable all the cache regions.
|
||||
*/
|
||||
void allRegionsEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to allRegionsEnabled().
|
||||
*/
|
||||
@Deprecated
|
||||
default void setAllRegionsEnabled(boolean enabled) {
|
||||
allRegionsEnabled(enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache region by name. Typically, to enable or disable the region.
|
||||
*/
|
||||
ServerCacheRegion region(String name);
|
||||
|
||||
@Deprecated
|
||||
default ServerCacheRegion getRegion(String name) {
|
||||
return region(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache for mapping natural keys to id values.
|
||||
*/
|
||||
ServerCache naturalKeyCache(Class<?> beanType);
|
||||
|
||||
@Deprecated
|
||||
default ServerCache getNaturalKeyCache(Class<?> beanType) {
|
||||
return naturalKeyCache(beanType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache for beans of a particular type.
|
||||
*/
|
||||
ServerCache beanCache(Class<?> beanType);
|
||||
|
||||
@Deprecated
|
||||
default ServerCache getBeanCache(Class<?> beanType) {
|
||||
return beanCache(beanType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache for associated many properties of a bean type.
|
||||
*/
|
||||
ServerCache collectionIdsCache(Class<?> beanType, String propertyName);
|
||||
|
||||
@Deprecated
|
||||
default ServerCache getCollectionIdsCache(Class<?> beanType, String propertyName) {
|
||||
return collectionIdsCache(beanType, propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cache for query results of a particular type of bean.
|
||||
*/
|
||||
ServerCache queryCache(Class<?> beanType);
|
||||
|
||||
@Deprecated
|
||||
default ServerCache getQueryCache(Class<?> beanType) {
|
||||
return queryCache(beanType);
|
||||
}
|
||||
|
||||
/**
|
||||
* This clears both the bean and query cache for a given type.
|
||||
*/
|
||||
|
||||
@@ -10,14 +10,6 @@ public interface ServerCacheRegion {
|
||||
*/
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to name().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the cache region is enabled.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package io.ebean.cache;
|
||||
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* A ServerCache proxy that is tenant aware.
|
||||
*/
|
||||
public final class TenantAwareCache implements ServerCache {
|
||||
|
||||
private final ServerCache delegate;
|
||||
private final TenantAwareKey tenantAwareKey;
|
||||
|
||||
/**
|
||||
* Create given the TenantAwareKey and delegate cache to proxy to.
|
||||
*
|
||||
* @param delegate The cache to proxy to
|
||||
* @param tenantAwareKey Provides tenant aware keys to use in the cache
|
||||
*/
|
||||
public TenantAwareCache(ServerCache delegate, TenantAwareKey tenantAwareKey) {
|
||||
this.delegate = delegate;
|
||||
this.tenantAwareKey = tenantAwareKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the underlying ServerCache that is being delegated to.
|
||||
*/
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> cls) {
|
||||
return (T)delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(MetricVisitor visitor) {
|
||||
delegate.visit(visitor);
|
||||
}
|
||||
|
||||
private Object key(Object key) {
|
||||
return tenantAwareKey.key(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(Object id) {
|
||||
return delegate.get(key(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(Object id, Object value) {
|
||||
delegate.put(key(id), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Object id) {
|
||||
delegate.remove(key(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
delegate.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return delegate.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hitRatio() {
|
||||
return delegate.hitRatio();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerCacheStatistics statistics(boolean reset) {
|
||||
return delegate.statistics(reset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Object, Object> getAll(Set<Object> keys) {
|
||||
Map<Object, Object> keyMapping = new HashMap<>(keys.size());
|
||||
keys.forEach(k -> keyMapping.put(key(k), k));
|
||||
Map<Object, Object> tmp = delegate.getAll(keyMapping.keySet());
|
||||
Map<Object, Object> ret = new HashMap<>(keys.size());
|
||||
// unwrap tenant info here
|
||||
tmp.forEach((k,v)-> ret.put(((TenantAwareKey.CacheKey) k).key, v));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Map<Object, Object> keyValues) {
|
||||
Map<Object, Object> tmp = new HashMap<>();
|
||||
keyValues.forEach((k, v) -> tmp.put(key(k), v));
|
||||
delegate.putAll(tmp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAll(Set<Object> keys) {
|
||||
delegate.removeAll(keys.stream().map(this::key).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package io.ebean.common;
|
||||
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollectionAdd;
|
||||
import io.ebean.bean.BeanCollectionLoader;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@@ -47,6 +44,11 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
|
||||
super(loader, ownerBean, propertyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toString(ToStringBuilder builder) {
|
||||
builder.addCollection(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(EntityBean ownerBean, String propertyName) {
|
||||
this.ownerBean = ownerBean;
|
||||
@@ -191,18 +193,11 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(50);
|
||||
sb.append("BeanList ");
|
||||
if (isReadOnly()) {
|
||||
sb.append("readOnly ");
|
||||
}
|
||||
if (list == null) {
|
||||
sb.append("deferred ");
|
||||
return "BeanList<deferred>";
|
||||
} else {
|
||||
sb.append("size[").append(list.size()).append("] ");
|
||||
sb.append("list").append(list);
|
||||
return list.toString();
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.ebean.common;
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollectionLoader;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.ToStringBuilder;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -40,6 +41,19 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
|
||||
super(ebeanServer, ownerBean, propertyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toString(ToStringBuilder builder) {
|
||||
if (map == null || map.isEmpty()) {
|
||||
builder.addRaw("{}");
|
||||
} else {
|
||||
builder.addRaw("{");
|
||||
for (Entry<K, E> entry : map.entrySet()) {
|
||||
builder.add(String.valueOf(entry.getKey()), entry.getValue());
|
||||
}
|
||||
builder.addRaw("}");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(EntityBean ownerBean, String propertyName) {
|
||||
this.ownerBean = ownerBean;
|
||||
@@ -183,27 +197,20 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(50);
|
||||
sb.append("BeanMap ");
|
||||
if (isReadOnly()) {
|
||||
sb.append("readOnly ");
|
||||
}
|
||||
if (map == null) {
|
||||
sb.append("deferred ");
|
||||
return "BeanMap<deferred>";
|
||||
} else {
|
||||
sb.append("size[").append(map.size()).append("]");
|
||||
sb.append(" map").append(map);
|
||||
return map.toString();
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Equal if obj is a Map and equal in a Map sense.
|
||||
* Equal if object is a Map and equal in a Map sense.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(Object object) {
|
||||
init();
|
||||
return map.equals(obj);
|
||||
return map.equals(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package io.ebean.common;
|
||||
|
||||
import io.ebean.bean.BeanCollection;
|
||||
import io.ebean.bean.BeanCollectionAdd;
|
||||
import io.ebean.bean.BeanCollectionLoader;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
@@ -41,6 +38,11 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
|
||||
super(loader, ownerBean, propertyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toString(ToStringBuilder builder) {
|
||||
builder.addCollection(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(EntityBean ownerBean, String propertyName) {
|
||||
this.ownerBean = ownerBean;
|
||||
@@ -169,18 +171,11 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(50);
|
||||
sb.append("BeanSet ");
|
||||
if (isReadOnly()) {
|
||||
sb.append("readOnly ");
|
||||
}
|
||||
if (set == null) {
|
||||
sb.append("deferred ");
|
||||
return "BeanSet<deferred>";
|
||||
} else {
|
||||
sb.append("size[").append(set.size()).append("]");
|
||||
sb.append(" set").append(set);
|
||||
return set.toString();
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,14 +25,6 @@ public class QueryPlanCapture {
|
||||
return database;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to database().
|
||||
*/
|
||||
@Deprecated
|
||||
public Database getDatabase() {
|
||||
return database;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the captured query plans.
|
||||
*/
|
||||
@@ -40,11 +32,4 @@ public class QueryPlanCapture {
|
||||
return plans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to plans().
|
||||
*/
|
||||
@Deprecated
|
||||
public List<MetaQueryPlan> getPlans() {
|
||||
return plans;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,4 @@ public interface MetaCountMetric extends MetaMetric {
|
||||
*/
|
||||
long count();
|
||||
|
||||
/**
|
||||
* Migrate to count()
|
||||
*/
|
||||
@Deprecated
|
||||
default long getCount() {
|
||||
return count();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,4 @@ public interface MetaMetric {
|
||||
*/
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Migrate to name().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getName() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,40 +10,16 @@ public interface MetaQueryMetric extends MetaTimedMetric {
|
||||
*/
|
||||
Class<?> type();
|
||||
|
||||
/**
|
||||
* Migrate to type().
|
||||
*/
|
||||
@Deprecated
|
||||
default Class<?> getType() {
|
||||
return type();
|
||||
}
|
||||
|
||||
/**
|
||||
* The label for the query (can be null).
|
||||
*/
|
||||
String label();
|
||||
|
||||
/**
|
||||
* Migrate to label().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getLabel() {
|
||||
return label();
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual SQL of the query.
|
||||
*/
|
||||
String sql();
|
||||
|
||||
/**
|
||||
* Migrate to sql().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getSql() {
|
||||
return sql();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the hash of the plan.
|
||||
*/
|
||||
|
||||
@@ -11,67 +11,26 @@ public interface MetaTimedMetric extends MetaMetric {
|
||||
*/
|
||||
String location();
|
||||
|
||||
/**
|
||||
* Migrate to location()
|
||||
*/
|
||||
@Deprecated
|
||||
default String getLocation() {
|
||||
return location();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the total count.
|
||||
*/
|
||||
long count();
|
||||
|
||||
/**
|
||||
* Migrate to count()
|
||||
*/
|
||||
@Deprecated
|
||||
default long getCount() {
|
||||
return count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the total execution time in micros.
|
||||
*/
|
||||
long total();
|
||||
|
||||
/**
|
||||
* Migrate to total()
|
||||
*/
|
||||
@Deprecated
|
||||
default long getTotal() {
|
||||
return total();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the max execution time in micros.
|
||||
*/
|
||||
long max();
|
||||
|
||||
/**
|
||||
* Migrate to max()
|
||||
*/
|
||||
@Deprecated
|
||||
default long getMax() {
|
||||
return max();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the mean execution time in micros.
|
||||
*/
|
||||
long mean();
|
||||
|
||||
|
||||
/**
|
||||
* Migrate to mean()
|
||||
*/
|
||||
@Deprecated
|
||||
default long getMean() {
|
||||
return mean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is the first metrics collection for this query.
|
||||
* <p>
|
||||
|
||||
@@ -12,37 +12,14 @@ public interface ServerMetrics {
|
||||
*/
|
||||
List<MetaTimedMetric> timedMetrics();
|
||||
|
||||
/**
|
||||
* Migrate to timedMetrics().
|
||||
*/
|
||||
@Deprecated
|
||||
default List<MetaTimedMetric> getTimedMetrics() {
|
||||
return timedMetrics();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the query metrics.
|
||||
*/
|
||||
List<MetaQueryMetric> queryMetrics();
|
||||
|
||||
/**
|
||||
* Migrate to queryMetrics().
|
||||
*/
|
||||
@Deprecated
|
||||
default List<MetaQueryMetric> getQueryMetrics() {
|
||||
return queryMetrics();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Counter metrics.
|
||||
*/
|
||||
List<MetaCountMetric> countMetrics();
|
||||
|
||||
/**
|
||||
* Migrate to countMetrics().
|
||||
*/
|
||||
@Deprecated
|
||||
default List<MetaCountMetric> getCountMetrics() {
|
||||
return countMetrics();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ public interface ServerMetricsAsJson {
|
||||
|
||||
/**
|
||||
* Set the sort property - see SortMetric
|
||||
*
|
||||
* @see SortMetric
|
||||
*/
|
||||
ServerMetricsAsJson withSort(Comparator<MetaTimedMetric> sortBy);
|
||||
@@ -35,9 +36,9 @@ public interface ServerMetricsAsJson {
|
||||
*/
|
||||
ServerMetricsAsJson withHeader(boolean withHeader);
|
||||
|
||||
/**
|
||||
* Collect and write metrics as JSON to the given buffer.
|
||||
*/
|
||||
/**
|
||||
* Collect and write metrics as JSON to the given buffer.
|
||||
*/
|
||||
void write(Appendable buffer);
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Comparator;
|
||||
/**
|
||||
* Comparator for timed metrics sorted by name and then count.
|
||||
*/
|
||||
public class SortMetric {
|
||||
public final class SortMetric {
|
||||
|
||||
public static final Comparator<MetaCountMetric> COUNT_NAME = new CountName();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.ServiceLoader;
|
||||
/**
|
||||
* Lookup MetricFactory service.
|
||||
*/
|
||||
class MetricServiceProvider {
|
||||
final class MetricServiceProvider {
|
||||
|
||||
private static final MetricFactory metricFactory = init();
|
||||
|
||||
|
||||
@@ -12,14 +12,6 @@ public interface QueryPlanMetric {
|
||||
*/
|
||||
TimedMetric metric();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to metric().
|
||||
*/
|
||||
@Deprecated
|
||||
default TimedMetric getMetric() {
|
||||
return metric();
|
||||
}
|
||||
|
||||
/**
|
||||
* Visit the underlying metric.
|
||||
*/
|
||||
|
||||
@@ -16,28 +16,12 @@ public interface BeanDocType<T> {
|
||||
/**
|
||||
* Return the doc store index type for this bean type.
|
||||
*/
|
||||
default String indexType() {
|
||||
return getIndexType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to indexType().
|
||||
*/
|
||||
@Deprecated
|
||||
String getIndexType();
|
||||
String indexType();
|
||||
|
||||
/**
|
||||
* Return the doc store index name for this bean type.
|
||||
*/
|
||||
default String indexName() {
|
||||
return getIndexName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to indexName().
|
||||
*/
|
||||
@Deprecated
|
||||
String getIndexName();
|
||||
String indexName();
|
||||
|
||||
/**
|
||||
* Apply the appropriate fetch path to the query such that the query returns beans matching
|
||||
@@ -48,29 +32,13 @@ public interface BeanDocType<T> {
|
||||
/**
|
||||
* Return the FetchPath for the embedded document.
|
||||
*/
|
||||
default FetchPath embedded(String path) {
|
||||
return getEmbedded(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to embedded().
|
||||
*/
|
||||
@Deprecated
|
||||
FetchPath getEmbedded(String path);
|
||||
FetchPath embedded(String path);
|
||||
|
||||
/**
|
||||
* For embedded 'many' properties we need a FetchPath relative to the root which is used to
|
||||
* build and replace the embedded list.
|
||||
*/
|
||||
default FetchPath embeddedManyRoot(String path) {
|
||||
return getEmbeddedManyRoot(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to embeddedManyRoot().
|
||||
*/
|
||||
@Deprecated
|
||||
FetchPath getEmbeddedManyRoot(String path);
|
||||
FetchPath embeddedManyRoot(String path);
|
||||
|
||||
/**
|
||||
* Return a 'raw' property mapped for the given property.
|
||||
|
||||
@@ -22,53 +22,21 @@ public interface BeanType<T> {
|
||||
*/
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to name().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the full name of the bean type.
|
||||
*/
|
||||
String fullName();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to fullName().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getFullName() {
|
||||
return fullName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class type this BeanDescriptor describes.
|
||||
*/
|
||||
Class<T> type();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to type().
|
||||
*/
|
||||
@Deprecated
|
||||
default Class<T> getBeanType() {
|
||||
return type();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type bean for an OneToMany or ManyToOne or ManyToMany property.
|
||||
*/
|
||||
BeanType<?> beanTypeAtPath(String propertyName);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to beanTypeAtPath().
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanType<?> getBeanTypeAtPath(String propertyName) {
|
||||
return beanTypeAtPath(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the properties for this bean type.
|
||||
*/
|
||||
@@ -79,53 +47,21 @@ public interface BeanType<T> {
|
||||
*/
|
||||
Property idProperty();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to idProperty().
|
||||
*/
|
||||
@Deprecated
|
||||
default Property getIdProperty() {
|
||||
return idProperty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the when modified property if there is one defined.
|
||||
*/
|
||||
Property whenModifiedProperty();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to idProperty().
|
||||
*/
|
||||
@Deprecated
|
||||
default Property getWhenModifiedProperty() {
|
||||
return whenModifiedProperty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the when created property if there is one defined.
|
||||
*/
|
||||
Property whenCreatedProperty();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to idProperty().
|
||||
*/
|
||||
@Deprecated
|
||||
default Property getWhenCreatedProperty() {
|
||||
return whenCreatedProperty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Property to read values from a bean.
|
||||
*/
|
||||
Property property(String propertyName);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to property().
|
||||
*/
|
||||
@Deprecated
|
||||
default Property getProperty(String propertyName) {
|
||||
return property(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ExpressionPath for a given property path.
|
||||
* <p>
|
||||
@@ -134,14 +70,6 @@ public interface BeanType<T> {
|
||||
*/
|
||||
ExpressionPath expressionPath(String path);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to expressionPath().
|
||||
*/
|
||||
@Deprecated
|
||||
default ExpressionPath getExpressionPath(String path) {
|
||||
return expressionPath(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the property is a valid known property or path for the given bean type.
|
||||
*/
|
||||
@@ -177,14 +105,6 @@ public interface BeanType<T> {
|
||||
*/
|
||||
String baseTable();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to baseTable().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getBaseTable() {
|
||||
return baseTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of the bean.
|
||||
*/
|
||||
@@ -195,98 +115,36 @@ public interface BeanType<T> {
|
||||
*/
|
||||
Object id(Object bean);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to id()
|
||||
*/
|
||||
@Deprecated
|
||||
default Object beanId(Object bean) {
|
||||
return id(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated migrate to id()
|
||||
*/
|
||||
@Deprecated
|
||||
Object getBeanId(T bean);
|
||||
|
||||
/**
|
||||
* Set the id value to the bean.
|
||||
*/
|
||||
void setId(T bean, Object idValue);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to setId()
|
||||
*/
|
||||
@Deprecated
|
||||
default void setBeanId(T bean, Object idValue) {
|
||||
setId(bean, idValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the bean persist controller.
|
||||
*/
|
||||
BeanPersistController persistController();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to persistController()
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanPersistController getPersistController() {
|
||||
return persistController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the bean persist listener.
|
||||
*/
|
||||
BeanPersistListener persistListener();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to persistListener()
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanPersistListener getPersistListener() {
|
||||
return persistListener();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the beanFinder. Usually null unless overriding the finder.
|
||||
*/
|
||||
BeanFindController findController();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to findController()
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanFindController getFindController() {
|
||||
return findController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BeanQueryAdapter or null if none is defined.
|
||||
*/
|
||||
BeanQueryAdapter queryAdapter();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to queryAdapter()
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanQueryAdapter getQueryAdapter() {
|
||||
return queryAdapter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the identity generation type.
|
||||
*/
|
||||
IdType idType();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to idType()
|
||||
*/
|
||||
@Deprecated
|
||||
default IdType getIdType() {
|
||||
return idType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this bean type has doc store backing.
|
||||
*/
|
||||
@@ -301,27 +159,11 @@ public interface BeanType<T> {
|
||||
*/
|
||||
DocMapping docMapping();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to docMapping()
|
||||
*/
|
||||
@Deprecated
|
||||
default DocMapping getDocMapping() {
|
||||
return docMapping();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the doc store queueId for this bean type.
|
||||
*/
|
||||
String docStoreQueueId();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to docStoreQueueId()
|
||||
*/
|
||||
@Deprecated
|
||||
default String getDocStoreQueueId() {
|
||||
return docStoreQueueId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the doc store support for this bean type.\
|
||||
*/
|
||||
@@ -353,27 +195,11 @@ public interface BeanType<T> {
|
||||
*/
|
||||
List<BeanType<?>> inheritanceChildren();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to inheritanceChildren()
|
||||
*/
|
||||
@Deprecated
|
||||
default List<BeanType<?>> getInheritanceChildren() {
|
||||
return inheritanceChildren();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent in inheritance hierarchy
|
||||
*/
|
||||
BeanType<?> inheritanceParent();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to inheritanceParent()
|
||||
*/
|
||||
@Deprecated
|
||||
default BeanType<?> getInheritanceParent() {
|
||||
return inheritanceParent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Visit all children recursively
|
||||
*/
|
||||
@@ -384,14 +210,6 @@ public interface BeanType<T> {
|
||||
*/
|
||||
String discColumn();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to discColumn()
|
||||
*/
|
||||
@Deprecated
|
||||
default String getDiscColumn() {
|
||||
return discColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a bean given the discriminator value.
|
||||
*/
|
||||
|
||||
@@ -39,14 +39,6 @@ public interface ExpressionPath {
|
||||
*/
|
||||
StringParser stringParser();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to stringParser().
|
||||
*/
|
||||
@Deprecated
|
||||
default StringParser getStringParser() {
|
||||
return stringParser();
|
||||
}
|
||||
|
||||
/**
|
||||
* For DateTime capable scalar types convert the long systemTimeMillis into
|
||||
* an appropriate java time (Date,Timestamp,Time,Calendar, JODA type etc).
|
||||
@@ -64,14 +56,6 @@ public interface ExpressionPath {
|
||||
*/
|
||||
int jdbcType();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to jdbcType().
|
||||
*/
|
||||
@Deprecated
|
||||
default int getJdbcType() {
|
||||
return jdbcType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is an ManyToOne or OneToOne associated bean property.
|
||||
*/
|
||||
@@ -85,50 +69,19 @@ public interface ExpressionPath {
|
||||
*/
|
||||
String assocIdExpression(String propName, String bindOperator);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to assocIdExpression().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getAssocIdExpression(String propName, String bindOperator) {
|
||||
return assocIdExpression(propName, bindOperator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Id values for the given bean value.
|
||||
*/
|
||||
Object[] assocIdValues(EntityBean bean);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to assocIdValues().
|
||||
*/
|
||||
@Deprecated
|
||||
default Object[] getAssocIdValues(EntityBean bean) {
|
||||
return assocIdValues(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the underlying bean property.
|
||||
*/
|
||||
Property property();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to property().
|
||||
*/
|
||||
@Deprecated
|
||||
default Property getProperty() {
|
||||
return property();
|
||||
}
|
||||
|
||||
/**
|
||||
* The ElPrefix plus name.
|
||||
*/
|
||||
String elName();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to elName().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getElName() {
|
||||
return elName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,40 +10,16 @@ public interface Property {
|
||||
*/
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to name().
|
||||
*/
|
||||
@Deprecated
|
||||
default String getName() {
|
||||
return name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of the property.
|
||||
*/
|
||||
Class<?> type();
|
||||
|
||||
/**
|
||||
* Deprecated migrate to type().
|
||||
*/
|
||||
@Deprecated
|
||||
default Class<?> getPropertyType() {
|
||||
return type();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the property on the given bean.
|
||||
*/
|
||||
Object value(Object bean);
|
||||
|
||||
/**
|
||||
* Deprecated migrate to value().
|
||||
*/
|
||||
@Deprecated
|
||||
default Object getVal(Object bean) {
|
||||
return value(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a OneToMany or ManyToMany property.
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.Set;
|
||||
/**
|
||||
* Annotation utility methods to find annotations.
|
||||
*/
|
||||
public class AnnotationUtil {
|
||||
public final class AnnotationUtil {
|
||||
|
||||
/**
|
||||
* Determine if the supplied {@link Annotation} is defined in the core JDK {@code java.lang.annotation} package.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.ebean.util;
|
||||
|
||||
public class CamelCaseHelper {
|
||||
public final class CamelCaseHelper {
|
||||
|
||||
/**
|
||||
* To underscore from camel case using digits compressed true and force upper case false.
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* Utilities for IO. It uses UTF-8 as encoding when reading/writing and uses
|
||||
* buffered IO for better performance.
|
||||
*/
|
||||
public class IOUtils {
|
||||
public final class IOUtils {
|
||||
|
||||
/**
|
||||
* Read from stream as UTF-8.
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.sql.Statement;
|
||||
/**
|
||||
* Utility for closing raw Jdbc resources.
|
||||
*/
|
||||
public class JdbcClose {
|
||||
public final class JdbcClose {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("io.ebean");
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.ebean.util;
|
||||
/**
|
||||
* Helper for dot notation property paths.
|
||||
*/
|
||||
public class SplitName {
|
||||
public final class SplitName {
|
||||
|
||||
private static final char PERIOD = '.';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.regex.Pattern;
|
||||
/**
|
||||
* Utility String class that supports String manipulation functions.
|
||||
*/
|
||||
public class StringHelper {
|
||||
public final class StringHelper {
|
||||
|
||||
private static final Pattern SPLIT_NAMES = Pattern.compile("[\\s,;]+");
|
||||
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
package io.ebean.bean;
|
||||
|
||||
import io.ebean.common.BeanList;
|
||||
import io.ebean.common.BeanMap;
|
||||
import io.ebean.common.BeanSet;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class ToStringBuilderTest {
|
||||
|
||||
@Test
|
||||
void basic() {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
builder.start(new Object());
|
||||
builder.end();
|
||||
assertThat(builder.toString()).isEqualTo("Object@0()");
|
||||
}
|
||||
|
||||
@Test
|
||||
void fields() {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
builder.start(new Object());
|
||||
builder.add("a", 1);
|
||||
builder.add("b", "B");
|
||||
builder.end();
|
||||
assertThat(builder.toString()).isEqualTo("Object@0(a:1, b:B)");
|
||||
}
|
||||
|
||||
@Test
|
||||
void max100Beans_expect_noMoreContentAfterMax100() {
|
||||
|
||||
String loop100 = addLoopForMaxBeans(100);
|
||||
String loop101 = addLoopForMaxBeans(101);
|
||||
String loop900 = addLoopForMaxBeans(900);
|
||||
|
||||
assertThat(loop100).isEqualTo(loop101);
|
||||
assertThat(loop101).isEqualTo(loop900);
|
||||
}
|
||||
|
||||
private String addLoopForMaxBeans(int loopMax) {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
builder.start(new Object());
|
||||
for (int i = 0; i <= loopMax; i++) {
|
||||
addForMax(builder, i);
|
||||
}
|
||||
builder.end();
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private void addForMax(ToStringBuilder builder, int i) {
|
||||
builder.add("c", new B(i));
|
||||
}
|
||||
|
||||
@Test
|
||||
void maxContent_expect_noMoreContentAfterMax2000() {
|
||||
String loop23 = addContentLoop(23);
|
||||
String loop24 = addContentLoop(24);
|
||||
String loop25 = addContentLoop(25);
|
||||
|
||||
assertThat(loop23).isEqualTo(loop24);
|
||||
assertThat(loop23).isEqualTo(loop25);
|
||||
}
|
||||
|
||||
private String addContentLoop(int loopMax) {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
builder.start(new Object());
|
||||
for (int i = 0; i <= loopMax; i++) {
|
||||
addForMaxContent(builder, i);
|
||||
}
|
||||
builder.end();
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private void addForMaxContent(ToStringBuilder builder, int i) {
|
||||
builder.add("someContentThatAddsUp", new Recurse(i, "SomeContentThatAddsUp_SomeContentThatAddsUp!!"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void add_referenceBeanCollection_expect_nothingAdded() {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
builder.add("ref", new BeanList<>(null));
|
||||
assertThat(builder.toString()).isEqualTo("");
|
||||
}
|
||||
|
||||
@Test
|
||||
void addCollection_some() {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
builder.addCollection( new BeanList<>(List.of("A","B")));
|
||||
assertThat(builder.toString()).isEqualTo("[A, B]");
|
||||
}
|
||||
|
||||
@Test
|
||||
void addCollection_null() {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
builder.addCollection(null);
|
||||
assertThat(builder.toString()).isEqualTo("[]");
|
||||
}
|
||||
|
||||
@Test
|
||||
void addCollection_empty() {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
builder.addCollection(Collections.emptyList());
|
||||
assertThat(builder.toString()).isEqualTo("[]");
|
||||
}
|
||||
|
||||
@Test
|
||||
void flatBean() {
|
||||
Recurse instance0 = new Recurse(42, "java");
|
||||
assertThat(instance0.toString()).isEqualTo("Recurse@0(id:42, nm:java)");
|
||||
}
|
||||
|
||||
@Test
|
||||
void recursive_expect_reference() {
|
||||
Recurse instance0 = new Recurse(42, "java");
|
||||
instance0.other = instance0;
|
||||
|
||||
assertThat(instance0.toString()).isEqualTo("Recurse@0(id:42, nm:java, other:Recurse@0)");
|
||||
}
|
||||
|
||||
@Test
|
||||
void notRecursive() {
|
||||
Recurse instance0 = new Recurse(42, "java");
|
||||
instance0.other = new Recurse(43, "jvm");
|
||||
assertThat(instance0.toString()).isEqualTo("Recurse@0(id:42, nm:java, other:Recurse@1(id:43, nm:jvm))");
|
||||
}
|
||||
|
||||
@Test
|
||||
void beanList_null_empty() {
|
||||
assertThat(toStringFor(new BeanList<String>(null))).isEqualTo("[]");
|
||||
assertThat(toStringFor(new BeanList<String>(Collections.emptyList()))).isEqualTo("[]");
|
||||
}
|
||||
|
||||
@Test
|
||||
void beanSet_null_empty() {
|
||||
assertThat(toStringFor(new BeanSet<String>(null))).isEqualTo("[]");
|
||||
assertThat(toStringFor(new BeanSet<String>(Collections.emptySet()))).isEqualTo("[]");
|
||||
}
|
||||
|
||||
@Test
|
||||
void beanMap_null_empty() {
|
||||
assertThat(toStringFor(new BeanMap<String, String>(null))).isEqualTo("{}");
|
||||
assertThat(toStringFor(new BeanMap<String, String>(Collections.emptyMap()))).isEqualTo("{}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void beanList_some() {
|
||||
BeanList<Recurse> list = new BeanList<>(List.of(new Recurse(1, "a"), new Recurse(2, "b")));
|
||||
assertThat(toStringFor(list)).isEqualTo("[Recurse@1(id:1, nm:a), Recurse@2(id:2, nm:b)]");
|
||||
}
|
||||
|
||||
@Test
|
||||
void beanSet_some() {
|
||||
BeanSet<Recurse> list = new BeanSet<>(new LinkedHashSet<>(List.of(new Recurse(1, "a"), new Recurse(2, "b"))));
|
||||
assertThat(toStringFor(list)).isEqualTo("[Recurse@1(id:1, nm:a), Recurse@2(id:2, nm:b)]");
|
||||
}
|
||||
|
||||
@Test
|
||||
void beanMap_some() {
|
||||
Map<String, Recurse> under = new LinkedHashMap<>();
|
||||
under.put("a", new Recurse(1, "a"));
|
||||
under.put("b", new Recurse(2, "b"));
|
||||
BeanMap<String, Recurse> list = new BeanMap<>(under);
|
||||
assertThat(toStringFor(list)).isEqualTo("{a:Recurse@1(id:1, nm:a), b:Recurse@2(id:2, nm:b)}");
|
||||
}
|
||||
|
||||
private String toStringFor(ToStringAware aware) {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
aware.toString(builder);
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
static final class Recurse implements ToStringAware {
|
||||
|
||||
final int id;
|
||||
final String nm;
|
||||
Recurse other;
|
||||
|
||||
Recurse(int id, String nm) {
|
||||
this.id = id;
|
||||
this.nm = nm;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
toString(builder);
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toString(ToStringBuilder builder) {
|
||||
builder.start(this);
|
||||
builder.add("id", id);
|
||||
builder.add("nm", nm);
|
||||
builder.add("other", other);
|
||||
builder.end();
|
||||
}
|
||||
}
|
||||
|
||||
static final class B implements ToStringAware {
|
||||
|
||||
final int id;
|
||||
|
||||
B(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
ToStringBuilder builder = new ToStringBuilder();
|
||||
toString(builder);
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toString(ToStringBuilder builder) {
|
||||
builder.start(this);
|
||||
builder.add("b", id);
|
||||
builder.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package io.ebean.cache;
|
||||
|
||||
import io.ebean.cache.TenantAwareKey.CacheKey;
|
||||
import io.ebean.config.CurrentTenantProvider;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class TenantAwareCacheTest {
|
||||
|
||||
ServerCache serverCache;
|
||||
TenantAwareCache cache;
|
||||
|
||||
TenantAwareCacheTest() {
|
||||
TenantAwareKey key = new TenantAwareKey(new TenantProv());
|
||||
this.serverCache = new Cache();
|
||||
this.cache = new TenantAwareCache(serverCache, key);
|
||||
}
|
||||
|
||||
@Test
|
||||
void put_get_remove() {
|
||||
cache.put("A", "a");
|
||||
Object val = cache.get("A");
|
||||
assertThat(val).isEqualTo("a");
|
||||
|
||||
CacheKey cacheKey = new CacheKey("A", 42);
|
||||
Object val2 = serverCache.get(cacheKey);
|
||||
assertThat(val2).isEqualTo("a");
|
||||
|
||||
cache.put("B", "bb");
|
||||
assertThat(cache.size()).isEqualTo(2);
|
||||
cache.remove("A");
|
||||
assertThat(cache.get("A")).isNull();
|
||||
assertThat(cache.size()).isEqualTo(1);
|
||||
|
||||
cache.clear();
|
||||
assertThat(cache.size()).isEqualTo(0);
|
||||
assertThat(cache.get("B")).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void putAll_getAll_removeAll() {
|
||||
Map<Object, Object> map = new HashMap<>();
|
||||
map.put("A", "a");
|
||||
map.put("B", "b");
|
||||
map.put("C", "c");
|
||||
|
||||
cache.putAll(map);
|
||||
assertThat(cache.size()).isEqualTo(3);
|
||||
assertThat(cache.get("A")).isEqualTo("a");
|
||||
assertThat(serverCache.get(new CacheKey("A", 42))).isEqualTo("a");
|
||||
|
||||
|
||||
Map<Object, Object> result = cache.getAll(Set.of("A", "B", "C", "D"));
|
||||
assertThat(result).hasSize(3);
|
||||
assertThat(result).containsOnlyKeys("A", "B", "C");
|
||||
assertThat(result.values()).containsOnly("a", "b", "c");
|
||||
|
||||
cache.removeAll(Set.of("A", "C", "D"));
|
||||
assertThat(cache.size()).isEqualTo(1);
|
||||
|
||||
assertThat(cache.get("B")).isEqualTo("b");
|
||||
assertThat(serverCache.get(new CacheKey("B", 42))).isEqualTo("b");
|
||||
|
||||
cache.remove("B");
|
||||
assertThat(cache.size()).isEqualTo(0);
|
||||
}
|
||||
|
||||
|
||||
static class TenantProv implements CurrentTenantProvider {
|
||||
|
||||
@Override
|
||||
public Object currentId() {
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
static class Cache implements ServerCache {
|
||||
|
||||
Map<Object, Object> map = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public Object get(Object id) {
|
||||
return map.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(Object id, Object value) {
|
||||
map.put(id, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Object id) {
|
||||
map.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
map.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return map.size();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+7
-12
@@ -1,4 +1,4 @@
|
||||
package io.ebean.xtest.config;
|
||||
package io.ebean.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.ebean.annotation.MutationDetection;
|
||||
@@ -17,11 +17,10 @@ import java.util.Properties;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class DatabaseConfigTest {
|
||||
class DatabaseConfigTest {
|
||||
|
||||
@Test
|
||||
public void testLoadFromEbeanProperties() {
|
||||
|
||||
void testLoadFromEbeanProperties() {
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
config.loadFromProperties();
|
||||
|
||||
@@ -30,8 +29,7 @@ public class DatabaseConfigTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void evalPropertiesInput() {
|
||||
|
||||
void evalPropertiesInput() {
|
||||
String home = System.getProperty("user.home");
|
||||
String fileSeparator = System.getProperty("file.separator");
|
||||
|
||||
@@ -46,8 +44,7 @@ public class DatabaseConfigTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadWithProperties() {
|
||||
|
||||
void testLoadWithProperties() {
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
config.setPersistBatch(PersistBatch.NONE);
|
||||
config.setPersistBatchOnCascade(PersistBatch.NONE);
|
||||
@@ -154,8 +151,7 @@ public class DatabaseConfigTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_defaults() {
|
||||
|
||||
void test_defaults() {
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
assertTrue(config.isIdGeneratorAutomatic());
|
||||
assertTrue(config.isDefaultServer());
|
||||
@@ -186,8 +182,7 @@ public class DatabaseConfigTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_putServiceObject() {
|
||||
|
||||
void test_putServiceObject() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
DatabaseConfig config = new DatabaseConfig();
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<!-- <parent>-->
|
||||
<!-- <groupId>org.avaje</groupId>-->
|
||||
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.ebean.tile:enhancement:13.0.1-RC1</tile>
|
||||
<tile>io.ebean.tile:enhancement:13.3.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
+15
-15
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
@@ -71,88 +71,88 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-xml</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-autotune</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
+7
-7
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core</artifactId>
|
||||
@@ -41,19 +41,19 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -144,21 +144,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -2,14 +2,7 @@ package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* List of changes to be applied to L2 cache.
|
||||
|
||||
+1
-6
@@ -3,12 +3,7 @@ package io.ebeaninternal.server.cache;
|
||||
import io.ebean.annotation.Cache;
|
||||
import io.ebean.annotation.CacheBeanTuning;
|
||||
import io.ebean.annotation.CacheQueryTuning;
|
||||
import io.ebean.cache.QueryCacheEntryValidate;
|
||||
import io.ebean.cache.ServerCache;
|
||||
import io.ebean.cache.ServerCacheConfig;
|
||||
import io.ebean.cache.ServerCacheFactory;
|
||||
import io.ebean.cache.ServerCacheOptions;
|
||||
import io.ebean.cache.ServerCacheType;
|
||||
import io.ebean.cache.*;
|
||||
import io.ebean.config.CurrentTenantProvider;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
import io.ebean.util.AnnotationUtil;
|
||||
|
||||
+10
-25
@@ -3,7 +3,6 @@ package io.ebeaninternal.server.cache;
|
||||
import io.ebean.BackgroundExecutor;
|
||||
import io.ebean.cache.ServerCache;
|
||||
import io.ebean.cache.ServerCacheStatistics;
|
||||
import io.ebean.cache.TenantAwareKey;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
import io.ebean.metric.CountMetric;
|
||||
import io.ebean.metric.MetricFactory;
|
||||
@@ -12,11 +11,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -52,14 +47,12 @@ public class DefaultServerCache implements ServerCache {
|
||||
private final int trimFrequency;
|
||||
private final int maxIdleSecs;
|
||||
private final int maxSecsToLive;
|
||||
private final TenantAwareKey tenantAwareKey;
|
||||
|
||||
public DefaultServerCache(DefaultServerCacheConfig config) {
|
||||
this.name = config.getName();
|
||||
this.shortName = config.getShortName();
|
||||
this.map = config.getMap();
|
||||
this.maxSize = config.getMaxSize();
|
||||
this.tenantAwareKey = new TenantAwareKey(config.getTenantProvider());
|
||||
this.maxIdleSecs = config.getMaxIdleSecs();
|
||||
this.maxSecsToLive = config.getMaxSecsToLive();
|
||||
this.trimFrequency = config.determineTrimFrequency();
|
||||
@@ -92,7 +85,7 @@ public class DefaultServerCache implements ServerCache {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerCacheStatistics getStatistics(boolean reset) {
|
||||
public ServerCacheStatistics statistics(boolean reset) {
|
||||
ServerCacheStatistics cacheStats = new ServerCacheStatistics();
|
||||
cacheStats.setCacheName(name);
|
||||
cacheStats.setMaxSize(maxSize);
|
||||
@@ -121,7 +114,7 @@ public class DefaultServerCache implements ServerCache {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHitRatio() {
|
||||
public int hitRatio() {
|
||||
long mc = missCount.get(false);
|
||||
long hc = hitCount.get(false);
|
||||
long totalCount = hc + mc;
|
||||
@@ -152,19 +145,12 @@ public class DefaultServerCache implements ServerCache {
|
||||
map.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the tenant aware key.
|
||||
*/
|
||||
protected Object key(Object id) {
|
||||
return tenantAwareKey.key(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a value from the cache.
|
||||
*/
|
||||
@Override
|
||||
public Object get(Object id) {
|
||||
CacheEntry entry = getCacheEntry(id);
|
||||
public Object get(Object key) {
|
||||
CacheEntry entry = getCacheEntry(key);
|
||||
if (entry == null) {
|
||||
missCount.increment();
|
||||
return null;
|
||||
@@ -184,8 +170,8 @@ public class DefaultServerCache implements ServerCache {
|
||||
/**
|
||||
* Get the cache entry - override for query cache to validate dependent tables.
|
||||
*/
|
||||
protected CacheEntry getCacheEntry(Object id) {
|
||||
final SoftReference<CacheEntry> ref = map.get(key(id));
|
||||
protected CacheEntry getCacheEntry(Object key) {
|
||||
final SoftReference<CacheEntry> ref = map.get(key);
|
||||
return ref != null ? ref.get() : null;
|
||||
}
|
||||
|
||||
@@ -198,8 +184,7 @@ public class DefaultServerCache implements ServerCache {
|
||||
* Put a value into the cache.
|
||||
*/
|
||||
@Override
|
||||
public void put(Object id, Object value) {
|
||||
Object key = key(id);
|
||||
public void put(Object key, Object value) {
|
||||
map.put(key, new SoftReference<>(new CacheEntry(key, value)));
|
||||
putCount.increment();
|
||||
}
|
||||
@@ -208,8 +193,8 @@ public class DefaultServerCache implements ServerCache {
|
||||
* Remove an entry from the cache.
|
||||
*/
|
||||
@Override
|
||||
public void remove(Object id) {
|
||||
SoftReference<CacheEntry> entry = map.remove(key(id));
|
||||
public void remove(Object key) {
|
||||
SoftReference<CacheEntry> entry = map.remove(key);
|
||||
if (entry != null && entry.get() != null) {
|
||||
removeCount.increment();
|
||||
}
|
||||
|
||||
-5
@@ -3,7 +3,6 @@ package io.ebeaninternal.server.cache;
|
||||
import io.ebean.cache.QueryCacheEntryValidate;
|
||||
import io.ebean.cache.ServerCacheConfig;
|
||||
import io.ebean.cache.ServerCacheOptions;
|
||||
import io.ebean.config.CurrentTenantProvider;
|
||||
import io.ebeaninternal.server.cache.DefaultServerCache.CacheEntry;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
@@ -34,10 +33,6 @@ public final class DefaultServerCacheConfig {
|
||||
this.maxSize = options.getMaxSize();
|
||||
}
|
||||
|
||||
public CurrentTenantProvider getTenantProvider() {
|
||||
return config.getTenantProvider();
|
||||
}
|
||||
|
||||
public QueryCacheEntryValidate getQueryCacheEntryValidate() {
|
||||
return config.getQueryCacheEntryValidate();
|
||||
}
|
||||
|
||||
+2
-6
@@ -1,11 +1,7 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.ebean.BackgroundExecutor;
|
||||
import io.ebean.cache.ServerCache;
|
||||
import io.ebean.cache.ServerCacheConfig;
|
||||
import io.ebean.cache.ServerCacheFactory;
|
||||
import io.ebean.cache.ServerCacheNotification;
|
||||
import io.ebean.cache.ServerCacheNotify;
|
||||
import io.ebean.cache.*;
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,7 +37,7 @@ final class DefaultServerCacheFactory implements ServerCacheFactory {
|
||||
if (executor != null) {
|
||||
cache.periodicTrim(executor);
|
||||
}
|
||||
return cache;
|
||||
return config.tenantAware(cache);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-5
@@ -10,11 +10,7 @@ import io.ebeaninternal.server.deploy.DCacheRegion;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Manages the bean and query caches.
|
||||
|
||||
+1
-2
@@ -27,8 +27,7 @@ public class DefaultServerQueryCache extends DefaultServerCache {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CacheEntry getCacheEntry(Object id) {
|
||||
Object key = key(id);
|
||||
protected CacheEntry getCacheEntry(Object key) {
|
||||
final SoftReference<CacheEntry> ref = map.get(key);
|
||||
CacheEntry entry = ref != null ? ref.get() : null;
|
||||
if (entry == null) {
|
||||
|
||||
@@ -978,21 +978,11 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
return new DefaultRelationalQuery(this, sql.trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlQuery createSqlQuery(String sql) {
|
||||
return sqlQuery(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlUpdate sqlUpdate(String sql) {
|
||||
return new DefaultSqlUpdate(this, sql.trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlUpdate createSqlUpdate(String sql) {
|
||||
return sqlUpdate(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallableSql createCallableSql(String sql) {
|
||||
return new DefaultCallableSql(this, sql.trim());
|
||||
@@ -1376,11 +1366,6 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Stream<T> findLargeStream(Query<T> query, Transaction transaction) {
|
||||
return findStream(query, transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Stream<T> findStream(Query<T> query, Transaction transaction) {
|
||||
return toStream(findIterate(query, transaction));
|
||||
|
||||
@@ -261,16 +261,6 @@ public final class DefaultSqlUpdate implements Serializable, SpiSqlUpdate {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlUpdate setParams(Object... values) {
|
||||
return setParameters(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlUpdate setNextParameter(Object value) {
|
||||
return setParameter(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlUpdate setParameters(Object... values) {
|
||||
for (Object value : values) {
|
||||
|
||||
@@ -2114,10 +2114,10 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
return getId((EntityBean) bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBeanId(T bean) {
|
||||
return getId((EntityBean) bean);
|
||||
}
|
||||
// @Override
|
||||
// public Object beanId(T bean) {
|
||||
// return getId((EntityBean) bean);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return the Id value for the bean with embeddedId beans converted into maps.
|
||||
|
||||
+1
-3
@@ -219,9 +219,7 @@ public class DeployBeanProperty {
|
||||
return (AnnotationUtil.has(field, WhenCreated.class)
|
||||
|| AnnotationUtil.has(field, WhenModified.class)
|
||||
|| AnnotationUtil.has(field, WhoModified.class)
|
||||
|| AnnotationUtil.has(field, WhoCreated.class)
|
||||
|| AnnotationUtil.has(field, UpdatedTimestamp.class)
|
||||
|| AnnotationUtil.has(field, CreatedTimestamp.class));
|
||||
|| AnnotationUtil.has(field, WhoCreated.class));
|
||||
}
|
||||
|
||||
public String getFullBeanName() {
|
||||
|
||||
+4
-52
@@ -1,38 +1,7 @@
|
||||
package io.ebeaninternal.server.deploy.parse;
|
||||
|
||||
import io.ebean.annotation.Aggregation;
|
||||
import io.ebean.annotation.CreatedTimestamp;
|
||||
import io.ebean.annotation.DbArray;
|
||||
import io.ebean.annotation.DbComment;
|
||||
import io.ebean.annotation.DbDefault;
|
||||
import io.ebean.annotation.DbJson;
|
||||
import io.ebean.annotation.DbJsonB;
|
||||
import io.ebean.annotation.DbMap;
|
||||
import io.ebean.annotation.DbMigration;
|
||||
import io.ebean.annotation.DocCode;
|
||||
import io.ebean.annotation.DocEmbedded;
|
||||
import io.ebean.annotation.DocProperty;
|
||||
import io.ebean.annotation.DocSortable;
|
||||
import io.ebean.annotation.Draft;
|
||||
import io.ebean.annotation.DraftDirty;
|
||||
import io.ebean.annotation.DraftOnly;
|
||||
import io.ebean.annotation.DraftReset;
|
||||
import io.ebean.annotation.Encrypted;
|
||||
import io.ebean.annotation.Expose;
|
||||
import io.ebean.annotation.Formula;
|
||||
import io.ebean.annotation.HistoryExclude;
|
||||
import io.ebean.annotation.Identity;
|
||||
import io.ebean.annotation.Index;
|
||||
import io.ebean.annotation.JsonIgnore;
|
||||
import io.ebean.annotation.Length;
|
||||
import io.ebean.annotation.SoftDelete;
|
||||
import io.ebean.annotation.TenantId;
|
||||
import io.ebean.annotation.UnmappedJson;
|
||||
import io.ebean.annotation.UpdatedTimestamp;
|
||||
import io.ebean.annotation.WhenCreated;
|
||||
import io.ebean.annotation.WhenModified;
|
||||
import io.ebean.annotation.WhoCreated;
|
||||
import io.ebean.annotation.WhoModified;
|
||||
import io.ebean.annotation.*;
|
||||
import io.ebean.config.EncryptDeploy;
|
||||
import io.ebean.config.EncryptDeploy.Mode;
|
||||
import io.ebean.config.dbplatform.DbEncrypt;
|
||||
@@ -51,24 +20,7 @@ import io.ebeaninternal.server.type.ScalarTypeBytesBase;
|
||||
import io.ebeaninternal.server.type.ScalarTypeBytesEncrypted;
|
||||
import io.ebeaninternal.server.type.ScalarTypeEncryptedWrapper;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
import javax.persistence.Version;
|
||||
import javax.persistence.*;
|
||||
import java.sql.Types;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
@@ -339,10 +291,10 @@ final class AnnotationFields extends AnnotationParser {
|
||||
}
|
||||
|
||||
private void initWhen(DeployBeanProperty prop) {
|
||||
if (has(prop, WhenCreated.class) || has(prop, CreatedTimestamp.class)) {
|
||||
if (has(prop, WhenCreated.class)) {
|
||||
generatedPropFactory.setInsertTimestamp(prop);
|
||||
}
|
||||
if (has(prop, WhenModified.class) || has(prop, UpdatedTimestamp.class)) {
|
||||
if (has(prop, WhenModified.class)) {
|
||||
generatedPropFactory.setUpdateTimestamp(prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ final class DCountMetric implements CountMetric {
|
||||
|
||||
@Override
|
||||
public void visit(MetricVisitor visitor) {
|
||||
|
||||
long val = visitor.reset() ? count.sumThenReset() : count.sum();
|
||||
if (val > 0) {
|
||||
visitor.visitCount(new DCountMetricStats(name, val));
|
||||
|
||||
@@ -251,11 +251,6 @@ final class DefaultFetchGroupQuery<T> implements SpiFetchGroupQuery<T>, SpiQuery
|
||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<T> findLargeStream() {
|
||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findEach(Consumer<T> consumer) {
|
||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||
|
||||
@@ -1456,11 +1456,6 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
||||
return server.findStream(this, transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<T> findLargeStream() {
|
||||
return server.findLargeStream(this, transaction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Version<T>> findVersions() {
|
||||
this.temporalMode = TemporalMode.VERSIONS;
|
||||
|
||||
+8
-37
@@ -10,7 +10,6 @@ import io.ebeaninternal.api.BindParams;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import io.ebeaninternal.api.SpiSqlQuery;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
@@ -56,36 +55,6 @@ public final class DefaultRelationalQuery extends AbstractQuery implements SpiSq
|
||||
return server.findList(this, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal findSingleDecimal() {
|
||||
return server.findSingleAttribute(this, BigDecimal.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long findSingleLong() {
|
||||
return server.findSingleAttribute(this, Long.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T findSingleAttribute(Class<T> cls) {
|
||||
return server.findSingleAttribute(this, cls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<T> findSingleAttributeList(Class<T> cls) {
|
||||
return server.findSingleAttributeList(this, cls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T findOne(RowMapper<T> mapper) {
|
||||
return server.findOneMapper(this, mapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<T> findList(RowMapper<T> mapper) {
|
||||
return server.findListMapper(this, mapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findEachRow(RowConsumer consumer) {
|
||||
server.findEachRow(this, consumer);
|
||||
@@ -101,12 +70,6 @@ public final class DefaultRelationalQuery extends AbstractQuery implements SpiSq
|
||||
return Optional.ofNullable(findOne());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public DefaultRelationalQuery setParams(Object... values) {
|
||||
return setParameters(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultRelationalQuery setParameters(Object... values) {
|
||||
bindParams.setNextParameters(values);
|
||||
@@ -237,6 +200,14 @@ public final class DefaultRelationalQuery extends AbstractQuery implements SpiSq
|
||||
return new Mapper(mapper);
|
||||
}
|
||||
|
||||
private <T> T findSingleAttribute(Class<T> cls) {
|
||||
return server.findSingleAttribute(this, cls);
|
||||
}
|
||||
|
||||
private <T> List<T> findSingleAttributeList(Class<T> cls) {
|
||||
return server.findSingleAttributeList(this, cls);
|
||||
}
|
||||
|
||||
private class Scalar<T> implements SqlQuery.TypeQuery<T> {
|
||||
|
||||
private final Class<T> type;
|
||||
|
||||
@@ -54,14 +54,13 @@ public interface DocStoreBeanAdapter<T> extends BeanDocType<T> {
|
||||
/**
|
||||
* Return the index type for this bean type.
|
||||
*/
|
||||
@Override
|
||||
String getIndexType();
|
||||
String indexType();
|
||||
|
||||
/**
|
||||
* Return the index name for this bean type.
|
||||
*/
|
||||
@Override
|
||||
String getIndexName();
|
||||
String indexName();
|
||||
|
||||
/**
|
||||
* Process a delete by id of a given document.
|
||||
|
||||
+4
-15
@@ -102,7 +102,6 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
|
||||
private boolean registerPaths;
|
||||
|
||||
public DocStoreBeanBaseAdapter(BeanDescriptor<T> desc, DeployBeanDescriptor<T> deploy) {
|
||||
|
||||
this.desc = desc;
|
||||
this.server = desc.ebeanServer();
|
||||
this.mapped = deploy.isDocStoreMapped();
|
||||
@@ -123,7 +122,6 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
|
||||
|
||||
@Override
|
||||
public DocumentMapping createDocMapping() {
|
||||
|
||||
if (documentMapping != null) {
|
||||
return documentMapping;
|
||||
}
|
||||
@@ -143,12 +141,12 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIndexType() {
|
||||
public String indexType() {
|
||||
return indexType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIndexName() {
|
||||
public String indexName() {
|
||||
return indexName;
|
||||
}
|
||||
|
||||
@@ -159,7 +157,6 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
|
||||
|
||||
@Override
|
||||
public String rawProperty(String property) {
|
||||
|
||||
String rawProperty = sortableMap.get(property);
|
||||
return rawProperty == null ? property : rawProperty;
|
||||
}
|
||||
@@ -192,7 +189,6 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
|
||||
*/
|
||||
@Override
|
||||
public void registerInvalidationPath(String queueId, String path, Set<String> properties) {
|
||||
|
||||
if (!mapped) {
|
||||
if (update == DocStoreMode.IGNORE) {
|
||||
// bean type not mapped but is included as nested document
|
||||
@@ -207,7 +203,6 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
|
||||
* Return the DsInvalidationListener based on the properties, path.
|
||||
*/
|
||||
protected DocStoreEmbeddedInvalidation getEmbeddedInvalidation(String queueId, String path, Set<String> properties) {
|
||||
|
||||
if (properties.contains("*")) {
|
||||
return new DocStoreEmbeddedInvalidation(queueId, path);
|
||||
} else {
|
||||
@@ -245,19 +240,15 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
|
||||
* This can add derived/embedded/nested parts to the document.
|
||||
*/
|
||||
protected DocStructure derivePathProperties(PathProperties pathProps) {
|
||||
|
||||
boolean includeByDefault = (pathProps == null);
|
||||
if (pathProps == null) {
|
||||
pathProps = new PathProperties();
|
||||
}
|
||||
|
||||
return getDocStructure(pathProps, includeByDefault);
|
||||
}
|
||||
|
||||
protected DocStructure getDocStructure(PathProperties pathProps, final boolean includeByDefault) {
|
||||
|
||||
final DocStructure docStructure = new DocStructure(pathProps);
|
||||
|
||||
BeanProperty[] properties = desc.propertiesNonTransient();
|
||||
for (BeanProperty property : properties) {
|
||||
property.docStoreInclude(includeByDefault, docStructure);
|
||||
@@ -271,17 +262,16 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return docStructure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FetchPath getEmbedded(String path) {
|
||||
public FetchPath embedded(String path) {
|
||||
return docStructure.getEmbedded(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FetchPath getEmbeddedManyRoot(String path) {
|
||||
public FetchPath embeddedManyRoot(String path) {
|
||||
return docStructure.getEmbeddedManyRoot(path);
|
||||
}
|
||||
|
||||
@@ -297,7 +287,6 @@ public abstract class DocStoreBeanBaseAdapter<T> implements DocStoreBeanAdapter<
|
||||
|
||||
@Override
|
||||
public DocStoreMode getMode(PersistRequest.Type persistType, DocStoreMode txnMode) {
|
||||
|
||||
if (txnMode == null) {
|
||||
return getMode(persistType);
|
||||
} else if (txnMode == DocStoreMode.IGNORE) {
|
||||
|
||||
+14
-27
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.ebean.cache.ServerCache;
|
||||
import io.ebean.cache.ServerCacheFactory;
|
||||
import io.ebean.cache.ServerCacheOptions;
|
||||
import io.ebean.cache.ServerCacheType;
|
||||
@@ -12,7 +13,7 @@ import org.tests.model.basic.Customer;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
public class DefaultCacheHolderTest {
|
||||
class DefaultCacheHolderTest {
|
||||
|
||||
private final ThreadLocal<String> tenantId = new ThreadLocal<>();
|
||||
|
||||
@@ -25,42 +26,30 @@ public class DefaultCacheHolderTest {
|
||||
.with(cacheFactory, new TableModState());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getCache_normal() {
|
||||
|
||||
void getCache_normal() {
|
||||
DefaultCacheHolder holder = new DefaultCacheHolder(options());
|
||||
|
||||
DefaultServerCache cache = cache(holder, Customer.class);
|
||||
assertThat(cache.getName()).isEqualTo("org.tests.model.basic.Customer_B");
|
||||
assertThat(cache.getShortName()).isEqualTo("Customer_B");
|
||||
|
||||
DefaultServerCache cache1 = cache(holder, Customer.class);
|
||||
ServerCache cache = cache(holder, Customer.class);
|
||||
ServerCache cache1 = cache(holder, Customer.class);
|
||||
assertThat(cache1).isSameAs(cache);
|
||||
|
||||
DefaultServerCache cache2 = cache(holder, Contact.class);
|
||||
ServerCache cache2 = cache(holder, Contact.class);
|
||||
assertThat(cache1).isNotSameAs(cache2);
|
||||
assertThat(cache2.getName()).isEqualTo("org.tests.model.basic.Contact_B");
|
||||
assertThat(cache2.getShortName()).isEqualTo("Contact_B");
|
||||
|
||||
}
|
||||
|
||||
private DefaultServerCache cache(DefaultCacheHolder holder, Class<?> type) {
|
||||
return (DefaultServerCache) holder.getCache(type, ServerCacheType.BEAN);
|
||||
private ServerCache cache(DefaultCacheHolder holder, Class<?> type) {
|
||||
return holder.getCache(type, ServerCacheType.BEAN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCache_multiTenant() throws Exception {
|
||||
|
||||
void getCache_multiTenant() throws Exception {
|
||||
CacheManagerOptions builder = options().with(tenantId::get);
|
||||
|
||||
DefaultCacheHolder holder = new DefaultCacheHolder(builder);
|
||||
|
||||
tenantId.set("ten_1");
|
||||
DefaultServerCache cache = cache(holder, Customer.class);
|
||||
assertThat(cache.getName()).isEqualTo("org.tests.model.basic.Customer_B");
|
||||
assertThat(cache.getShortName()).isEqualTo("Customer_B");
|
||||
|
||||
ServerCache cache = cache(holder, Customer.class);
|
||||
cache.put("1", "value-for-tenant1");
|
||||
cache.put("2", "an other value-for-tenant1");
|
||||
|
||||
@@ -109,10 +98,9 @@ public class DefaultCacheHolderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clearAll() {
|
||||
|
||||
void clearAll() {
|
||||
DefaultCacheHolder holder = new DefaultCacheHolder(options());
|
||||
DefaultServerCache cache = cache(holder, Customer.class);
|
||||
ServerCache cache = cache(holder, Customer.class);
|
||||
cache.put("foo", "foo");
|
||||
assertThat(cache.size()).isEqualTo(1);
|
||||
holder.clearAll();
|
||||
@@ -121,12 +109,11 @@ public class DefaultCacheHolderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clearAll_multiTenant() {
|
||||
|
||||
void clearAll_multiTenant() {
|
||||
CacheManagerOptions options = options().with(tenantId::get);
|
||||
|
||||
DefaultCacheHolder holder = new DefaultCacheHolder(options);
|
||||
DefaultServerCache cache = cache(holder, Customer.class);
|
||||
ServerCache cache = cache(holder, Customer.class);
|
||||
cache.put("foo", "foo");
|
||||
assertThat(cache.size()).isEqualTo(1);
|
||||
|
||||
|
||||
+41
-47
@@ -1,5 +1,6 @@
|
||||
package io.ebeaninternal.server.cache;
|
||||
|
||||
import io.ebean.cache.ServerCache;
|
||||
import io.ebean.config.ContainerConfig;
|
||||
import io.ebean.config.CurrentTenantProvider;
|
||||
import io.ebean.config.DatabaseConfig;
|
||||
@@ -11,7 +12,7 @@ import org.tests.model.basic.Customer;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class DefaultServerCacheManagerTest {
|
||||
class DefaultServerCacheManagerTest {
|
||||
|
||||
private final ThreadLocal<String> tenantId = new ThreadLocal<>();
|
||||
|
||||
@@ -29,7 +30,7 @@ public class DefaultServerCacheManagerTest {
|
||||
|
||||
private final DefaultServerCacheManager multiTenantManager;
|
||||
|
||||
public DefaultServerCacheManagerTest(){
|
||||
DefaultServerCacheManagerTest(){
|
||||
CacheManagerOptions builder = new CacheManagerOptions(clusterManager, new DatabaseConfig(), true);
|
||||
builder.with(new TdTenPro());
|
||||
this.multiTenantManager = new DefaultServerCacheManager(builder);
|
||||
@@ -37,86 +38,79 @@ public class DefaultServerCacheManagerTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void getCache_normal() {
|
||||
void getCache_normal() {
|
||||
ServerCache cache = cache(manager, Customer.class);
|
||||
DefaultServerCache dsc = cache.unwrap(DefaultServerCache.class);
|
||||
assertThat(dsc.getName()).isEqualTo("org.tests.model.basic.Customer_B");
|
||||
assertThat(dsc.getShortName()).isEqualTo("Customer_B");
|
||||
|
||||
DefaultServerCache cache = cache(manager, Customer.class);
|
||||
assertThat(cache.getName()).isEqualTo("org.tests.model.basic.Customer_B");
|
||||
assertThat(cache.getShortName()).isEqualTo("Customer_B");
|
||||
|
||||
DefaultServerCache cache1 = cache(manager, Customer.class);
|
||||
ServerCache cache1 = cache(manager, Customer.class);
|
||||
assertThat(cache1).isSameAs(cache);
|
||||
|
||||
DefaultServerCache cache2 = cache(manager, Contact.class);
|
||||
ServerCache cache2 = cache(manager, Contact.class);
|
||||
assertThat(cache1).isNotSameAs(cache2);
|
||||
assertThat(cache2.getName()).isEqualTo("org.tests.model.basic.Contact_B");
|
||||
assertThat(cache2.getShortName()).isEqualTo("Contact_B");
|
||||
DefaultServerCache dsc2 = cache2.unwrap(DefaultServerCache.class);
|
||||
assertThat(dsc2.getName()).isEqualTo("org.tests.model.basic.Contact_B");
|
||||
assertThat(dsc2.getShortName()).isEqualTo("Contact_B");
|
||||
|
||||
|
||||
DefaultServerCache natKeyCache = (DefaultServerCache) manager.getNaturalKeyCache(Customer.class);
|
||||
assertThat(natKeyCache.getName()).isEqualTo("org.tests.model.basic.Customer_N");
|
||||
assertThat(natKeyCache.getShortName()).isEqualTo("Customer_N");
|
||||
ServerCache natKeyCache = manager.getNaturalKeyCache(Customer.class);
|
||||
DefaultServerCache dscNatKey = natKeyCache.unwrap(DefaultServerCache.class);
|
||||
assertThat(dscNatKey.getName()).isEqualTo("org.tests.model.basic.Customer_N");
|
||||
assertThat(dscNatKey.getShortName()).isEqualTo("Customer_N");
|
||||
|
||||
DefaultServerCache queryCache = (DefaultServerCache) manager.getQueryCache(Customer.class);
|
||||
assertThat(queryCache.getName()).isEqualTo("org.tests.model.basic.Customer_Q");
|
||||
assertThat(queryCache.getShortName()).isEqualTo("Customer_Q");
|
||||
ServerCache queryCache = manager.getQueryCache(Customer.class);
|
||||
DefaultServerCache dscQueryCache = queryCache.unwrap(DefaultServerCache.class);
|
||||
assertThat(dscQueryCache.getName()).isEqualTo("org.tests.model.basic.Customer_Q");
|
||||
assertThat(dscQueryCache.getShortName()).isEqualTo("Customer_Q");
|
||||
|
||||
DefaultServerCache collCache = (DefaultServerCache) manager.getCollectionIdsCache(Customer.class, "contacts");
|
||||
assertThat(collCache.getName()).isEqualTo("org.tests.model.basic.Customer.contacts_C");
|
||||
assertThat(collCache.getShortName()).isEqualTo("Customer.contacts_C");
|
||||
ServerCache collCache = manager.getCollectionIdsCache(Customer.class, "contacts");
|
||||
DefaultServerCache dscCollCache = collCache.unwrap(DefaultServerCache.class);
|
||||
assertThat(dscCollCache.getName()).isEqualTo("org.tests.model.basic.Customer.contacts_C");
|
||||
assertThat(dscCollCache.getShortName()).isEqualTo("Customer.contacts_C");
|
||||
|
||||
cache.clearCount.reset();
|
||||
collCache.clearCount.reset();
|
||||
queryCache.clearCount.reset();
|
||||
natKeyCache.clearCount.reset();
|
||||
cache.statistics(true);
|
||||
collCache.statistics(true);
|
||||
queryCache.statistics(true);
|
||||
natKeyCache.statistics(true);
|
||||
|
||||
manager.clear(Customer.class);
|
||||
|
||||
assertThat(cache.clearCount.get(true)).isEqualTo(1);
|
||||
assertThat(natKeyCache.clearCount.get(true)).isEqualTo(1);
|
||||
assertThat(queryCache.clearCount.get(true)).isEqualTo(1);
|
||||
assertThat(collCache.clearCount.get(true)).isEqualTo(1);
|
||||
assertThat(cache.statistics(true).getClearCount()).isEqualTo(1);
|
||||
assertThat(natKeyCache.statistics(true).getClearCount()).isEqualTo(1);
|
||||
assertThat(queryCache.statistics(true).getClearCount()).isEqualTo(1);
|
||||
assertThat(collCache.statistics(true).getClearCount()).isEqualTo(1);
|
||||
}
|
||||
|
||||
private DefaultServerCache cache(DefaultServerCacheManager manager, Class<?> beanType) {
|
||||
return (DefaultServerCache) manager.getBeanCache(beanType);
|
||||
private ServerCache cache(DefaultServerCacheManager manager, Class<?> beanType) {
|
||||
return manager.getBeanCache(beanType);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCache_multiTenant() {
|
||||
|
||||
void getCache_multiTenant() {
|
||||
tenantId.set("ten1");
|
||||
DefaultServerCache cache = cache(multiTenantManager, Customer.class);
|
||||
assertThat(cache.getName()).isEqualTo("org.tests.model.basic.Customer_B");
|
||||
ServerCache cache = cache(multiTenantManager, Customer.class);
|
||||
cache.put("1", "tenant1");
|
||||
|
||||
tenantId.set("ten2");
|
||||
|
||||
assertThat(cache.get("1")).isNull();
|
||||
|
||||
tenantId.set("ten1");
|
||||
|
||||
assertThat(cache.get("1")).isNotNull();
|
||||
|
||||
assertThat(cache.get("1")).isEqualTo("tenant1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCache_singleTenant() {
|
||||
|
||||
void getCache_singleTenant() {
|
||||
ServerCache cache = cache(manager, Customer.class);
|
||||
tenantId.set("ten1");
|
||||
DefaultServerCache cache = cache(manager, Customer.class);
|
||||
assertThat(cache.getName()).isEqualTo("org.tests.model.basic.Customer_B");
|
||||
|
||||
cache.put("1", "tenant1");
|
||||
|
||||
tenantId.set("ten2");
|
||||
|
||||
assertThat(cache.get("1")).isEqualTo("tenant1");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isLocalL2Caching() {
|
||||
|
||||
void isLocalL2Caching() {
|
||||
assertTrue(manager.isLocalL2Caching());
|
||||
assertTrue(multiTenantManager.isLocalL2Caching());
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Contact {
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
List<ContactNote> notes;
|
||||
|
||||
@CreatedTimestamp
|
||||
@WhenCreated
|
||||
Timestamp cretime;
|
||||
|
||||
@Version
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Product implements Serializable {
|
||||
|
||||
String name;
|
||||
|
||||
@CreatedTimestamp
|
||||
@WhenCreated
|
||||
Timestamp cretime;
|
||||
|
||||
@Version
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean ddl generation</name>
|
||||
@@ -28,14 +28,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean external mapping api</name>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<scm>
|
||||
@@ -28,7 +28,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-externalmapping-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -61,21 +61,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<configuration>
|
||||
<tiles>
|
||||
<!-- other tiles ... -->
|
||||
<tile>io.ebean.tile:enhancement:13.0.1-RC1</tile>
|
||||
<tile>io.ebean.tile:enhancement:13.3.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.ebean.tile:enhancement:13.0.1-RC1</tile>
|
||||
<tile>io.ebean.tile:enhancement:13.3.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean postgis</name>
|
||||
@@ -22,14 +22,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- provided scope -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.ebean.tile:enhancement:13.0.1-RC1</tile>
|
||||
<tile>io.ebean.tile:enhancement:13.3.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean querybean</name>
|
||||
@@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -63,21 +63,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.ebean.tile:enhancement:13.0.1-RC1</tile>
|
||||
<tile>io.ebean.tile:enhancement:13.3.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -1646,14 +1646,6 @@ public abstract class TQRootBean<T, R> {
|
||||
return query.findStream();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated - migrate to findStream().
|
||||
*/
|
||||
@Deprecated
|
||||
public Stream<T> findLargeStream() {
|
||||
return query.findLargeStream();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the query returning the set of objects.
|
||||
* <p>
|
||||
|
||||
@@ -270,6 +270,12 @@ public class QCustomerTest {
|
||||
|
||||
assertThat(foo).hasSize(1);
|
||||
}
|
||||
|
||||
Customer customer = DB.find(Customer.class, cust.getId());
|
||||
assert customer != null;
|
||||
String customerToString = customer.toString();
|
||||
assertThat(customerToString).contains("Customer@0(id:");
|
||||
assertThat(customerToString).contains(", status:GOOD, inactive:false, name:usingConnection, version:1, whenCreated:");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -387,24 +393,6 @@ public class QCustomerTest {
|
||||
assertThat(sb.toString()).isEqualTo("stream1|stream2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindLargeStream() {
|
||||
insertCustomer("largeStream1");
|
||||
insertCustomer("largeStream2");
|
||||
insertCustomer("largeStream3");
|
||||
|
||||
StringJoiner sb = new StringJoiner("|");
|
||||
try (Stream<Customer> stream = new QCustomer()
|
||||
.name.startsWith("largeStream")
|
||||
.id.asc()
|
||||
.findLargeStream()) {
|
||||
|
||||
stream.forEach(it -> sb.add(it.getName()));
|
||||
}
|
||||
|
||||
assertThat(sb.toString()).isEqualTo("largeStream1|largeStream2|largeStream3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilterMany() {
|
||||
|
||||
|
||||
+8
-8
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
@@ -16,41 +16,41 @@
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>4.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.0.1-SNAPSHOT</version>
|
||||
<version>13.3.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<tiles>
|
||||
<tile>io.ebean.tile:enhancement:13.0.1-RC1</tile>
|
||||
<tile>io.ebean.tile:enhancement:13.3.0</tile>
|
||||
</tiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user