Compare commits

...
Author SHA1 Message Date
Rob Bygrave 7e3d39ac1a [maven-release-plugin] prepare release ebean-parent-13.6.5 2022-07-06 20:59:04 +12:00
Rob Bygrave ce19837649 Bump avaje-lang to 1.1 with the only change being the removal of maven pom descriptors from META-INF/maven 2022-07-06 20:49:49 +12:00
Rob Bygrave 11e20edb59 #2741 - Bump avaje-config to 2.1 and modify ebean-test to support use of ${docker.host} in test container jdbc urls 2022-07-06 20:47:54 +12:00
Rob Bygrave 88b6a60feb #2730 - Secondary @OneToMany fetch query is not happening if the same Entity type is fetched 2022-07-06 20:19:41 +12:00
Rob Bygrave 43dac07d5b #2740 - Bump ebean-test-containers to 6.2 2022-07-06 14:41:24 +12:00
Rob Bygrave 04434215d0 #2740 - Bump ebean-test-containers to 6.2 2022-07-06 14:27:28 +12:00
Rob Bygrave 52e6c0c625 #2736 - findDto nonsupport setter chain (accessor style setters, both fluid style and non fluid style) 2022-07-05 10:37:55 +12:00
Rob Bygrave 745fbe883e #2737 - Mapping of TimeZone doesn't have enough characters 2022-07-05 09:05:13 +12:00
Rob Bygrave 283e0b66fa #2734 - maven build - excluding maven descriptor (pom and properties) from built artifacts 2022-07-04 17:53:28 +12:00
Rob Bygrave 523deb20f4 #2732 - ebean-agent - skip transactional profiling aware enhancement on query beans 2022-07-04 17:05:25 +12:00
Rob Bygrave 23d52ca192 #2731 - Change ebean-querybean annotations from Retention RUNTIME to CLASS 2022-07-04 16:58:06 +12:00
Rob Bygrave d20d276d56 #2728 - Fix for stateless update with orphanRemoval=true and softDelete 2022-07-04 12:22:27 +12:00
Rob Bygrave 5b92ac6e02 Merge branch 'deleted_one_to_many_children_bug' of https://github.com/Ichtil/ebean into Ichtil-deleted_one_to_many_children_bug 2022-07-01 17:12:45 +12:00
Jan Klička 6392f90f32 Add more failing test cases 2022-06-29 18:41:19 +02:00
Jan Klička bb8f3831b8 Testcase demonstrating stateless update resulting in a delete 2022-06-29 16:09:51 +02:00
Rob Bygrave 4bb43814b7 Run build with -T 8 2022-06-28 10:30:30 +12:00
Rob Bygrave 95c1554642 Run build with -T 8, clean test only for main build 2022-06-28 10:24:35 +12:00
Rob Bygrave 2cd59c5166 Run build with -T 8 2022-06-28 09:59:37 +12:00
Rob Bygrave afdb1df7ce Testing nuodb 4.3.2, but it isn't supporting getGeneratedKeys for jdbc batch inserts
That breaks a lot of tests
2022-06-16 23:32:04 +12:00
Rob Bygrave fa6fdf124d Fix test BasicProfileLocationTest 2022-06-16 13:52:27 +12:00
Rob Bygrave 1e044f03ed Adjust test DefaultPersistenceContextTest 2022-06-15 22:25:46 +12:00
Rob Bygrave 7989fcd6ce Bump to 13.6.5-SNAPSHOT after release 2022-06-15 22:22:04 +12:00
Rob Bygrave a5256df6f2 [maven-release-plugin] prepare for next development iteration 2022-06-14 16:14:25 +12:00
Rob Bygrave fa11dac2b2 [maven-release-plugin] prepare release ebean-parent-13.6.4 2022-06-14 16:14:18 +12:00
Rob Bygrave c40ca2fad7 Bump agent to 13.6.4 (no effective change) 2022-06-14 16:09:13 +12:00
Rob BygraveandGitHub 5b9359f509 Merge pull request #2719 from ebean-orm/feature/postgres-default-table-partition-refactor
DDL - Refactor DDL for Postgres and YugabyteDB to just create a default partition table
2022-06-14 16:08:28 +12:00
Rob Bygrave 403556d8b2 DDL - Refactor DDL for Postgres and YugabyteDB to just create a default partition table
Removes the need and use of  PostgresPlatform.tablePartitionsExist() and PostgresPlatform.tablePartitionInit() altogether.
2022-06-14 16:00:54 +12:00
Rob Bygrave 06ad2edfc1 #2718 - [Yugabyte] Fix such that builtin table partition functions are included in DDL (when we use table partitioning) 2022-06-14 15:39:34 +12:00
Rob BygraveandGitHub 16e2489ba0 Merge pull request #2717 from ebean-orm/feature/string-jsonb
Support Postgres JSONB/JSON with String - @DbJsonb String content;
2022-06-14 15:09:05 +12:00
Rob Bygrave 162b3449e8 Put ebean.properties back to default to h2 2022-06-14 15:03:35 +12:00
Rob Bygrave 8c3ed6996e Put postgresql jdbc back to 42.3.3 2022-06-14 14:59:39 +12:00
Rob Bygrave 583c5f74eb Support Postgres JSONB/JSON with String - @DbJsonb String content; 2022-06-14 14:57:50 +12:00
Rob Bygrave ab047996d2 Add build badge for Oracle 2022-06-14 09:18:17 +12:00
Rob Bygrave 239f87bb5d Rename Oracle GH WF build 2022-06-13 22:39:35 +12:00
Rob Bygrave 5be3b7717c #2716 - Refactor ScalarType interface to make use of default methods 2022-06-13 22:38:15 +12:00
Rob Bygrave e29d83a379 #2710 - Update PersistRequestBean with checkAllMutableProperties() and checkAnyMutableProperties() 2022-06-13 18:58:38 +12:00
Rob Bygrave 8301fd5e74 #2710 - JSONB fields are not considered dirty after modified in BeanPersistController preUpdate 2022-06-13 18:35:42 +12:00
Rob Bygrave 3e3647816d #2715 - [ebean-test-containers] Fix for Postgis to support extraDb (second database), Update Oracle container 2022-06-13 15:44:52 +12:00
Rob Bygrave 9aa7ae79e2 #2713 - Improve javadoc of Finder, BeanFinder, BeanRepository - deprecate use of BeanFinder server field (migrate to database) 2022-06-09 13:26:48 +12:00
Rob Bygrave 168c940b79 #2712 - Bump jedis to 4.2.3 (from 4.2.2) 2022-06-09 12:29:52 +12:00
Rob Bygrave 1ee18a1823 #2711 - Gradle: Change querybean generator from isolating to aggregating 2022-06-09 12:26:36 +12:00
Rob BygraveandGitHub c02ab7340c Merge pull request #2708 from FOCONIS/fix-localtime
Part 1: Fix read/write/query LocalTime values
2022-06-09 12:00:06 +12:00
Rob BygraveandGitHub c67773505d Merge pull request #2706 from FOCONIS/findsingleattributeset
ENH: Add support for findSingleAttributeSet()
2022-06-09 11:50:04 +12:00
Noemi Praml 9c354919e5 refactoring
(cherry picked from commit 43e28c4f5c747cdda2e3547a8db593eab490ceec)
2022-05-31 10:49:09 +02:00
Noemi Praml c8be59fd95 it fixes the test
(cherry picked from commit d2e21aa3dcbd4ae59dd8d1ff5404d94c298f087b)
2022-05-31 10:47:32 +02:00
Noemi Praml d1a40b4739 failing test 2022-05-31 10:47:08 +02:00
Noemi Praml bb9cfe9d0f add support for findSingleAttributeSet 2022-05-24 11:09:56 +02:00
Rob Bygrave ede2ad4d54 Bump test modules to 13.6.4-SNAPSHOT after release 2022-05-24 14:01:05 +12:00
Rob Bygrave 1060503fe1 [maven-release-plugin] prepare for next development iteration 2022-05-24 13:46:16 +12:00
Rob Bygrave 2edfc33d00 [maven-release-plugin] prepare release ebean-parent-13.6.3 2022-05-24 13:46:09 +12:00
Rob Bygrave 37902c75eb Bump ebean-agent to 13.6.3 2022-05-24 13:41:13 +12:00
Rob BygraveandGitHub 14abb34739 Merge pull request #2704 from ebean-orm/feature/2702-renameTable
#2702 - IllegalArgumentException: No rule for io.ebeaninternal.dbmigration.migration.RenameTable
2022-05-24 10:55:11 +12:00
Rob Bygrave 68680ffd34 #2702 - IllegalArgumentException: No rule for io.ebeaninternal.dbmigration.migration.RenameTable
Add support for applying the RenameTable change to the model.
2022-05-24 10:48:38 +12:00
Rob Bygrave 8106ffd73d #2703 - Bump ebean-test-containers to 6.0 (Java 11 and System.Logger) 2022-05-24 10:20:04 +12:00
Rob BygraveandGitHub d00cb854fc Merge pull request #2703 from ebean-orm/feature/ebean-test-containers
ebean-test-docker was renamed to ebean-test-containers
2022-05-24 09:03:22 +12:00
Rob Bygrave ca445b5226 ebean-test-docker was renamed to ebean-test-containers
- Migrate from io.ebean:ebean-test-docker -> io.ebean:ebean-test-containers
- Migrate (with 5.8) package from io.ebean.docker.commands -> io.ebean.test.containers
2022-05-24 08:54:58 +12:00
Rob Bygrave 74b4994221 #2701 -[DDL] Postgres DDL generation for table partitioning with schema - helper method to add partitions does not work
This also removes the helper partition_init() stored function as it isn't really needed now that postgres has default partition support (since PG11 actually, partition_init predates PG11).
2022-05-23 20:39:45 +12:00
Rob Bygrave 62106935f4 Bump test modules to 13.6.3-SNAPSHOT after release 2022-05-18 21:01:40 +12:00
Rob Bygrave bf034eb2a1 Bump test modules to 13.6.3-SNAPSHOT after release 2022-05-18 20:26:30 +12:00
Rob Bygrave c5e980991e [maven-release-plugin] prepare for next development iteration 2022-05-18 20:11:18 +12:00
Rob Bygrave 1004675a0b [maven-release-plugin] prepare release ebean-parent-13.6.2 2022-05-18 20:11:12 +12:00
Rob Bygrave 12e508ab48 Merge branch 'master' of github.com:ebean-orm/ebean 2022-05-18 18:25:38 +12:00
Rob Bygrave be0e1116a7 Bump ebean-agent to 13.6.2 2022-05-18 18:25:24 +12:00
Rob BygraveandGitHub 4b03c8a00a Merge pull request #2698 from ebean-orm/feature/tidy-beancollection
No effective change - tidy BeanList etc, BeanCollectionHelpFactory to use specific CQueryCollectionAdd for List and Set
2022-05-18 18:03:09 +12:00
Rob Bygrave 0db93bc82d No effective change - tidy BeanList etc, BeanCollectionHelpFactory to use specific CQueryCollectionAdd for List and Set 2022-05-18 17:33:08 +12:00
Rob Bygrave e04a1baabe Bump tile enhancement to 13.6.0 2022-05-18 15:35:38 +12:00
Rob BygraveandGitHub 506e2f5625 Merge pull request #2697 from ebean-orm/feature/postgres-table-partitioning-pk
Postgres DDL - With Postgres table partitioning, add partition column to primary key
2022-05-17 22:18:55 +12:00
Rob Bygrave 7fbc1f8111 Postgres DDL - With Postgres table partitioning, add partition column to primary key
- Postgres DDL generation
- Using table partitioning
- There is a primary key defined that doesn't contain the partition column

In DDL generation, automatically add the partition column to the DB primary key.
2022-05-17 21:39:06 +12:00
Rob Bygrave 4f3c9adf6f #2695 - DDL Generation for @UniqueConstraint ignores the name - should be the index name when given 2022-05-16 22:06:14 +12:00
Rob Bygrave ceac2d12b1 #2694 - Postgres DDL - For Postgres table partitioning, remove the "suppressPrimaryKeyOnPartition" mode 2022-05-16 21:48:19 +12:00
Rob Bygrave cc7f3d49a4 No effective change, tidy whitespace 2022-05-16 21:35:46 +12:00
Rob BygraveandGitHub 091c40867e Merge pull request #2693 from ebean-orm/feature/add-schema-support
DDL - Add support for creating schema via database migrations (and create all ddl)
2022-05-16 21:28:59 +12:00
Rob Bygrave 71b7aa5946 DDL - Add support for creating schema via database migrations (and create all ddl)
Initially for H2 and Postgres, with commented out DDL for other platforms.
2022-05-16 21:17:41 +12:00
Rob Bygrave 9dea51b7a0 #2692 - [querybean generation] Compile error, incorrect generation with nested inner class/record @Embeddable and @IdClass 2022-05-16 18:48:42 +12:00
Rob Bygrave b7d6374370 Improve error message when no platform providers are in the classpath 2022-05-16 18:47:48 +12:00
Rob Bygrave 195cb9c86c Adjust postgis build test container - use specific containerName 2022-05-16 16:36:32 +12:00
Rob Bygrave 1329a4775c Bump test modules to 13.6.2-SNAPSHOT after release 2022-05-16 12:35:41 +12:00
Rob Bygrave cc91ca5c2a [maven-release-plugin] prepare for next development iteration 2022-05-16 12:22:31 +12:00
264 changed files with 3863 additions and 2733 deletions
+1 -1
View File
@@ -36,5 +36,5 @@ jobs:
# - name: Maven single test
# run: mvn --batch-mode clean verify -Dtest="io.ebeaninternal.server.core.DefaultServer_getReferenceTest" -DfailIfNoTests=false
- name: Build with Maven
run: mvn clean package
run: mvn -T 8 clean test
+1 -1
View File
@@ -35,4 +35,4 @@ jobs:
~/.m2
key: build-${{ env.cache-name }}
- name: db2
run: mvn clean test -Dprops.file=testconfig/ebean-db2.properties
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-db2.properties
+1 -1
View File
@@ -37,5 +37,5 @@ jobs:
- name: Maven version
run: mvn --version
- name: H2Database
run: mvn clean package
run: mvn -T 8 clean package
+1 -1
View File
@@ -35,5 +35,5 @@ jobs:
~/.m2
key: build-${{ env.cache-name }}
- name: Build with Maven
run: mvn package
run: mvn -T 8 test
+1 -1
View File
@@ -39,5 +39,5 @@ jobs:
- name: Maven version
run: mvn --version
- name: Build with Maven
run: mvn package
run: mvn -T 8 test
+1 -1
View File
@@ -35,4 +35,4 @@ jobs:
~/.m2
key: build-${{ env.cache-name }}
- name: mariadb 10.6
run: mvn clean test -Dprops.file=testconfig/ebean-mariadb.properties
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-mariadb.properties
+1 -1
View File
@@ -35,4 +35,4 @@ jobs:
~/.m2
key: build-${{ env.cache-name }}
- name: mysql
run: mvn clean test -Dprops.file=testconfig/ebean-mysql.properties
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-mysql.properties
@@ -1,5 +1,5 @@
name: Oracle18
name: Oracle
on:
workflow_dispatch:
@@ -35,4 +35,4 @@ jobs:
~/.m2
key: build-${{ env.cache-name }}
- name: oracle
run: mvn clean test -Dprops.file=testconfig/ebean-oracle.properties
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-oracle.properties
+1 -1
View File
@@ -35,4 +35,4 @@ jobs:
~/.m2
key: build-${{ env.cache-name }}
- name: postgres
run: mvn clean test -Dprops.file=testconfig/ebean-postgres.properties
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-postgres.properties
+1 -1
View File
@@ -35,4 +35,4 @@ jobs:
~/.m2
key: build-${{ env.cache-name }}
- name: sqlserver 2017
run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver17.properties
run: mvn -T 8 clean test -Dprops.file=testconfig/ebean-sqlserver17.properties
+1
View File
@@ -8,6 +8,7 @@
[![Postgres](https://github.com/ebean-orm/ebean/actions/workflows/postgres.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/postgres.yml)
[![MySql](https://github.com/ebean-orm/ebean/actions/workflows/mysql.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/mysql.yml)
[![MariaDB](https://github.com/ebean-orm/ebean/actions/workflows/mariadb.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/mariadb.yml)
[![Oracle](https://github.com/ebean-orm/ebean/actions/workflows/oracle.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/oracle.yml)
[![SqlServer](https://github.com/ebean-orm/ebean/actions/workflows/sqlserver.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/sqlserver.yml)
[![Yugabyte](https://github.com/ebean-orm/ebean/actions/workflows/yugabyte.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/yugabyte.yml)
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-clickhouse</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-clickhouse</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-cockroach</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-db2</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-db2</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-h2</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-hana</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-hana</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-mariadb</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-mariadb</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-mysql</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-mysql</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-nuodb</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-nuodb</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-oracle</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-oracle</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-postgres</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-sqlite</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlite</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-sqlserver</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlserver</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean-yugabyte</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean (all platforms)</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-all</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
</project>
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<artifactId>composites</artifactId>
+22 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean api</name>
@@ -27,7 +27,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-config</artifactId>
<version>2.0</version>
<version>2.1</version>
</dependency>
<!--
@@ -37,7 +37,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-lang</artifactId>
<version>1.0</version>
<version>1.1</version>
</dependency>
<dependency>
@@ -103,4 +103,23 @@
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/ebean-maven-version.txt</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/ebean-maven-version.txt</exclude>
</excludes>
</resource>
</resources>
</build>
</project>
@@ -12,6 +12,7 @@ import java.util.Optional;
* </p>
* <pre>{@code
*
* @Component
* public class CustomerFinder extends BeanFinder<Long,Customer> {
*
* @Inject
@@ -26,29 +27,37 @@ import java.util.Optional;
*
* @param <I> The ID type
* @param <T> The Bean type
*
* @see BeanRepository
*/
@NonNullApi
public abstract class BeanFinder<I,T> {
/**
* Migrate to using database rather than server.
*/
@Deprecated
protected final Database server;
protected final Database database;
protected final Class<T> type;
/**
* Create with the given bean type and Database instance.
*
* @param type The bean type
* @param server The Database instance typically created via Spring factory or equivalent.
* @param database The Database instance typically created via Spring factory or equivalent.
*/
protected BeanFinder(Class<T> type, Database server) {
protected BeanFinder(Class<T> type, Database database) {
this.type = type;
this.server = server;
this.database = database;
this.server = database;
}
/**
* Return the Database to use.
*/
public Database db() {
return server;
return database;
}
/**
@@ -70,10 +79,10 @@ public abstract class BeanFinder<I,T> {
* <p>
* This is equivalent to {@link DB#byName(String)}
*
* @param server The name of the Database. If this is null then the default Database is returned.
* @param name The name of the Database. If this is null then the default Database is returned.
*/
public Database db(String server) {
return DB.byName(server);
public Database db(String name) {
return DB.byName(name);
}
/**
@@ -6,11 +6,15 @@ import io.ebean.bean.EntityBean;
import java.util.Collection;
/**
* Provides finder functionality for use with "Dependency Injection style" use of Ebean.
* Provides find and persist functionality for use with "Dependency Injection style" use of Ebean.
* <p>
* Extend the BeanRepository with additional finder and persisting methods as needed by the
* application. The intention is to keep all the related logic together, for example, all the
* persisting and finding logic for Customer would be in CustomerRepository.
*
* <pre>{@code
*
* @Repository
* @Component
* public class CustomerRepository extends BeanRepository<Long,Customer> {
*
* @Inject
@@ -50,10 +54,10 @@ public abstract class BeanRepository<I, T> extends BeanFinder<I, T> {
* }</pre>
*
* @param type The bean type
* @param server The Database instance typically created via Spring factory or equivalent
* @param database The Database instance typically created via Spring factory or equivalent
*/
protected BeanRepository(Class<T> type, Database server) {
super(type, server);
protected BeanRepository(Class<T> type, Database database) {
super(type, database);
}
/**
@@ -122,8 +126,8 @@ public abstract class BeanRepository<I, T> extends BeanFinder<I, T> {
/**
* Save all the beans in the collection.
*/
public int saveAll(Collection<T> bean) {
return db().saveAll(bean);
public int saveAll(Collection<T> beans) {
return db().saveAll(beans);
}
/**
@@ -3,8 +3,7 @@ package io.ebean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.util.Properties;
/**
@@ -29,9 +28,11 @@ public final class EbeanVersion {
private static void readVersion() {
try {
try (InputStream in = ClassLoader.getSystemResourceAsStream("META-INF/maven/io.ebean/ebean-api/pom.properties")) {
try (InputStream in = ClassLoader.getSystemResourceAsStream("META-INF/ebean-maven-version.txt")) {
if (in != null) {
version = readVersion(in);
try (LineNumberReader reader = new LineNumberReader(new InputStreamReader(in))) {
version = reader.readLine();
}
}
}
log.info("ebean version: {}", version);
@@ -88,7 +89,7 @@ public final class EbeanVersion {
}
/**
* Returns the ebean version (read from /META-INF/maven/io.ebean/ebean/pom.properties)
* Returns the ebean version (read from META-INF/ebean-maven-version.txt)
*/
public static String getVersion() {
return version;
@@ -383,6 +383,15 @@ public interface ExpressionList<T> {
*/
<A> List<A> findSingleAttributeList();
/**
* Executes the query returning a set of values for a single property.
*
* This can be used to cache sets.
*
* @return a HashSet of values for the selegted property
*/
<A> Set<A> findSingleAttributeSet();
/**
* Execute a query returning a single value of a single property/column.
* <pre>{@code
@@ -368,6 +368,11 @@ public interface ExtendedServer {
*/
<A, T> List<A> findSingleAttributeList(Query<T> query, Transaction transaction);
/**
* Execute the query returning a hashset of values for a single property.
*/
<A, T> Set<A> findSingleAttributeSet(Query<T> query, Transaction transaction);
/**
* Execute the query returning at most one entity bean or null (if no matching
* bean is found).
@@ -8,6 +8,9 @@ import java.util.List;
* Intended to be used as a base class for 'Finder' implementations that can then
* be injected or used as public static fields on the associated entity bean.
* <p>
* When using dependency injection {@link BeanRepository} and {@link BeanFinder}
* are expected to be used rather than this Finder.
* <p>
* These 'finders' are a place to organise all the finder methods for that bean type
* and specific finder methods are expected to be added (find by unique properties etc).
* </p>
@@ -54,6 +57,8 @@ import java.util.List;
*
* }</pre>
*
* @see BeanRepository
* @see BeanFinder
*/
@NonNullApi
public class Finder<I, T> {
@@ -925,6 +925,11 @@ public interface Query<T> extends CancelableQuery {
*/
<A> List<A> findSingleAttributeList();
/**
* Execute the query returning a hashset of values for a single property.
*/
<A> Set<A> findSingleAttributeSet();
/**
* Execute a query returning a single value of a single property/column.
* <p>
@@ -17,39 +17,28 @@ abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
private static final long serialVersionUID = 3365725236140187588L;
protected final ReentrantLock lock = new ReentrantLock();
protected boolean readOnly;
protected boolean disableLazyLoad;
/**
* The Database this is associated with. (used for lazy fetch).
*/
protected transient BeanCollectionLoader loader;
protected transient ExpressionList<?> filterMany;
/**
* Flag set when registered with the batch loading context.
*/
protected boolean registeredWithLoadContext;
protected String ebeanServerName;
/**
* The owning bean (used for lazy fetch).
*/
protected EntityBean ownerBean;
/**
* The name of this property in the owning bean (used for lazy fetch).
*/
protected String propertyName;
protected ModifyHolder<E> modifyHolder;
protected ModifyListenMode modifyListenMode;
protected boolean modifyListening;
/**
@@ -126,8 +115,7 @@ abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
void checkReadOnly() {
if (readOnly) {
String msg = "This collection is in ReadOnly mode";
throw new IllegalStateException(msg);
throw new IllegalStateException("This collection is in ReadOnly mode");
}
}
@@ -11,7 +11,7 @@ import java.util.List;
import java.util.ListIterator;
/**
* List capable of lazy loading.
* List capable of lazy loading and modification awareness.
*/
public final class BeanList<E> extends AbstractBeanCollection<E> implements List<E>, BeanCollectionAdd {
@@ -150,7 +150,6 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
* Set the actual underlying list.
* <p>
* This is primarily for the deferred fetching function.
* </p>
*/
@SuppressWarnings("unchecked")
public void setActualList(List<?> list) {
@@ -206,12 +205,11 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
* Specifically obj does not need to be a BeanList but any list. This does not
* use the FindMany, fetchedMaxRows or finishedFetch properties in the equals
* test.
* </p>
*/
@Override
public boolean equals(Object obj) {
public boolean equals(Object other) {
init();
return list.equals(obj);
return list.equals(other);
}
@Override
@@ -244,40 +242,40 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
}
@Override
public boolean add(E o) {
public boolean add(E bean) {
checkReadOnly();
init();
if (modifyListening) {
if (list.add(o)) {
modifyAddition(o);
if (list.add(bean)) {
modifyAddition(bean);
return true;
} else {
return false;
}
}
return list.add(o);
return list.add(bean);
}
@Override
public boolean addAll(Collection<? extends E> c) {
public boolean addAll(Collection<? extends E> beans) {
checkReadOnly();
init();
if (modifyListening) {
// all elements in c are added (no contains checking)
getModifyHolder().modifyAdditionAll(c);
getModifyHolder().modifyAdditionAll(beans);
}
return list.addAll(c);
return list.addAll(beans);
}
@Override
public boolean addAll(int index, Collection<? extends E> c) {
public boolean addAll(int index, Collection<? extends E> beans) {
checkReadOnly();
init();
if (modifyListening) {
// all elements in c are added (no contains checking)
getModifyHolder().modifyAdditionAll(c);
getModifyHolder().modifyAdditionAll(beans);
}
return list.addAll(index, c);
return list.addAll(index, beans);
}
@Override
@@ -287,23 +285,23 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
// and fetch just the Id's
initClear();
if (modifyListening) {
for (E aList : list) {
getModifyHolder().modifyRemoval(aList);
for (E element : list) {
getModifyHolder().modifyRemoval(element);
}
}
list.clear();
}
@Override
public boolean contains(Object o) {
public boolean contains(Object bean) {
init();
return list.contains(o);
return list.contains(bean);
}
@Override
public boolean containsAll(Collection<?> c) {
public boolean containsAll(Collection<?> beans) {
init();
return list.containsAll(c);
return list.containsAll(beans);
}
@Override
@@ -313,9 +311,9 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
}
@Override
public int indexOf(Object o) {
public int indexOf(Object bean) {
init();
return list.indexOf(o);
return list.indexOf(bean);
}
@Override
@@ -327,31 +325,29 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
@Override
public Iterator<E> iterator() {
init();
if (isReadOnly()) {
if (readOnly) {
return new ReadOnlyListIterator<>(list.listIterator());
}
if (modifyListening) {
Iterator<E> it = list.iterator();
return new ModifyIterator<>(this, it);
return new ModifyIterator<>(this, list.iterator());
}
return list.iterator();
}
@Override
public int lastIndexOf(Object o) {
public int lastIndexOf(Object bean) {
init();
return list.lastIndexOf(o);
return list.lastIndexOf(bean);
}
@Override
public ListIterator<E> listIterator() {
init();
if (isReadOnly()) {
if (readOnly) {
return new ReadOnlyListIterator<>(list.listIterator());
}
if (modifyListening) {
ListIterator<E> it = list.listIterator();
return new ModifyListIterator<>(this, it);
return new ModifyListIterator<>(this, list.listIterator());
}
return list.listIterator();
}
@@ -359,12 +355,11 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
@Override
public ListIterator<E> listIterator(int index) {
init();
if (isReadOnly()) {
if (readOnly) {
return new ReadOnlyListIterator<>(list.listIterator(index));
}
if (modifyListening) {
ListIterator<E> it = list.listIterator(index);
return new ModifyListIterator<>(this, it);
return new ModifyListIterator<>(this, list.listIterator(index));
}
return list.listIterator(index);
}
@@ -389,17 +384,17 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
}
@Override
public boolean remove(Object o) {
public boolean remove(Object bean) {
checkReadOnly();
init();
if (modifyListening) {
boolean isRemove = list.remove(o);
boolean isRemove = list.remove(bean);
if (isRemove) {
modifyRemoval(o);
modifyRemoval(bean);
}
return isRemove;
}
return list.remove(o);
return list.remove(bean);
}
@Override
@@ -463,7 +458,7 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
@Override
public List<E> subList(int fromIndex, int toIndex) {
init();
if (isReadOnly()) {
if (readOnly) {
return Collections.unmodifiableList(list.subList(fromIndex, toIndex));
}
if (modifyListening) {
@@ -479,13 +474,13 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
}
@Override
public <T> T[] toArray(T[] a) {
public <T> T[] toArray(T[] array) {
init();
//noinspection SuspiciousToArrayCall
return list.toArray(a);
return list.toArray(array);
}
private static class ReadOnlyListIterator<E> implements ListIterator<E>, Serializable {
private static final class ReadOnlyListIterator<E> implements ListIterator<E>, Serializable {
private static final long serialVersionUID = 3097271091406323699L;
@@ -12,7 +12,7 @@ import java.util.Map;
import java.util.Set;
/**
* Map capable of lazy loading.
* Map capable of lazy loading and modification aware.
*/
public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Map<K, E> {
@@ -247,7 +247,7 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
@Override
public Set<Entry<K, E>> entrySet() {
init();
if (isReadOnly()) {
if (readOnly) {
return Collections.unmodifiableSet(map.entrySet());
}
return modifyListening ? new ModifyEntrySet<>(this, map.entrySet()) : map.entrySet();
@@ -268,7 +268,7 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
@Override
public Set<K> keySet() {
init();
if (isReadOnly()) {
if (readOnly) {
return Collections.unmodifiableSet(map.keySet());
}
return modifyListening ? new ModifyKeySet<>(this, map.keySet()) : map.keySet();
@@ -339,7 +339,7 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
@Override
public Collection<E> values() {
init();
if (isReadOnly()) {
if (readOnly) {
return Collections.unmodifiableCollection(map.values());
}
return modifyListening ? new ModifyCollection<>(this, map.values()) : map.values();
@@ -9,7 +9,7 @@ import java.util.LinkedHashSet;
import java.util.Set;
/**
* Set capable of lazy loading.
* Set capable of lazy loading and modification aware.
*/
public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E>, BeanCollectionAdd {
@@ -210,27 +210,27 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
// -----------------------------------------------------//
@Override
public boolean add(E o) {
public boolean add(E bean) {
checkReadOnly();
init();
if (modifyListening) {
if (set.add(o)) {
modifyAddition(o);
if (set.add(bean)) {
modifyAddition(bean);
return true;
} else {
return false;
}
}
return set.add(o);
return set.add(bean);
}
@Override
public boolean addAll(Collection<? extends E> addCollection) {
public boolean addAll(Collection<? extends E> beans) {
checkReadOnly();
init();
if (modifyListening) {
boolean changed = false;
for (E bean : addCollection) {
for (E bean : beans) {
if (set.add(bean)) {
// register the addition of the bean
modifyAddition(bean);
@@ -239,7 +239,7 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
}
return changed;
}
return set.addAll(addCollection);
return set.addAll(beans);
}
@Override
@@ -255,15 +255,15 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
}
@Override
public boolean contains(Object o) {
public boolean contains(Object bean) {
init();
return set.contains(o);
return set.contains(bean);
}
@Override
public boolean containsAll(Collection<?> c) {
public boolean containsAll(Collection<?> beans) {
init();
return set.containsAll(c);
return set.containsAll(beans);
}
@Override
@@ -275,7 +275,7 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
@Override
public Iterator<E> iterator() {
init();
if (isReadOnly()) {
if (readOnly) {
return new ReadOnlyIterator<>(set.iterator());
}
if (modifyListening) {
@@ -285,17 +285,17 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
}
@Override
public boolean remove(Object o) {
public boolean remove(Object bean) {
checkReadOnly();
init();
if (modifyListening) {
if (set.remove(o)) {
modifyRemoval(o);
if (set.remove(bean)) {
modifyRemoval(bean);
return true;
}
return false;
}
return set.remove(o);
return set.remove(bean);
}
@Override
@@ -349,13 +349,13 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
}
@Override
public <T> T[] toArray(T[] a) {
public <T> T[] toArray(T[] array) {
init();
//noinspection SuspiciousToArrayCall
return set.toArray(a);
return set.toArray(array);
}
private static class ReadOnlyIterator<E> implements Iterator<E>, Serializable {
private static final class ReadOnlyIterator<E> implements Iterator<E>, Serializable {
private static final long serialVersionUID = 2577697326745352605L;
@@ -802,20 +802,6 @@ public class DatabasePlatform {
}
}
/**
* Return true if partitions exist for the given table.
*/
public boolean tablePartitionsExist(Connection connection, String table) throws SQLException {
return true;
}
/**
* Return the SQL to create an initial partition for the given table.
*/
public String tablePartitionInit(String tableName, PartitionMode mode, String property, String singlePrimaryKey) {
return null;
}
/**
* Escapes the like string for this DB-Platform
*/
@@ -63,7 +63,6 @@ public final class SplitName {
}
private static String[] split(String name, boolean last) {
int pos = last ? name.lastIndexOf('.') : name.indexOf('.');
if (pos == -1) {
if (last) {
@@ -0,0 +1 @@
${project.version}
+5 -5
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<!-- <parent>-->
<!-- <groupId>org.avaje</groupId>-->
@@ -14,7 +14,7 @@
<scm>
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
<name>ebean autotune</name>
@@ -26,7 +26,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
<scope>provided</scope>
</dependency>
@@ -55,7 +55,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
<scope>test</scope>
</dependency>
@@ -70,7 +70,7 @@
<extensions>true</extensions>
<configuration>
<tiles>
<tile>io.ebean.tile:enhancement:13.3.0</tile>
<tile>io.ebean.tile:enhancement:13.6.5</tile>
</tiles>
</configuration>
</plugin>
@@ -143,6 +143,7 @@ public class BaseQueryTuner {
switch (type) {
case COUNT:
case ATTRIBUTE:
case ATTRIBUTE_SET:
case ID_LIST:
case UPDATE:
case DELETE:
+17 -17
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<name>ebean bom</name>
@@ -62,8 +62,8 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test-docker</artifactId>
<version>${ebean-test-docker.version}</version>
<artifactId>ebean-test-containers</artifactId>
<version>${ebean-test-containers.version}</version>
</dependency>
<!-- modules -->
@@ -71,88 +71,88 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-ddl-generator</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-xml</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-autotune</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>querybean-generator</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>kotlin-querybean-generator</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-postgis</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-redis</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
</dependencies>
+2 -2
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<artifactId>ebean-core-type</artifactId>
@@ -16,7 +16,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -16,25 +16,24 @@ import java.sql.SQLException;
* <p>
* Scalar in the sense that the types are not compound types. Scalar types only
* map to a single database column.
* </p>
* <p>
* These types fall into two categories. Types that are mapped natively to JDBC
* types and the rest. Types that map to native JDBC types do not require any
* data type conversion to be persisted to the database. These are java types
* that map via java.sql.Types.
* </p>
* <p>
* Types that are not native to JDBC require some conversion. These include some
* common java types such as java.util.Date, java.util.Calendar,
* java.math.BigInteger.
* </p>
* <p>
* Note that Booleans may be native for some databases and require conversion on
* other databases.
* </p>
*/
public interface ScalarType<T> extends StringParser, StringFormatter, ScalarDataReader<T> {
/**
* Return true for types that do mutation detection based on json content.
*/
default boolean isJsonMapper() {
return false;
}
@@ -43,38 +42,40 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
* Return true if this is a binary type and can not support parse() and format() from/to string.
* This allows Ebean to optimise marshalling types to string.
*/
boolean isBinaryType();
default boolean isBinaryType() {
return false;
}
/**
* Return true if this is a mutable scalar type (like hstore).
*/
boolean isMutable();
default boolean isMutable() {
return false;
}
/**
* For mutable scalarType's return true if the value is dirty.
* Non-dirty properties may be excluded from updates.
*/
boolean isDirty(Object value);
default boolean isDirty(Object value) {
return false;
}
/**
* Return the default DB column length for this type.
* <p>
* If a BeanProperty has no explicit length defined then this length should
* be assigned.
* </p>
* <p>
* This is primarily to support defining a length on Enum types (to
* supplement defining the length on the BeanProperty directly).
* </p>
*/
int getLength();
default int getLength() {
return 0;
}
/**
* Return true if the type is native to JDBC.
* <p>
* If it is native to JDBC then its values/instances do not need to be
* converted to and from an associated JDBC type.
* </p>
*/
boolean isJdbcNative();
@@ -83,16 +84,13 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
* <p>
* This type should be consistent with the toJdbcType() method in converting
* the type to the appropriate type for binding to preparedStatements.
* </p>
*/
int getJdbcType();
/**
* Return the type that matches the bean property type.
* <p>
* This represents the 'logical' type rather than the JDBC type this maps
* to.
* </p>
* This represents the 'logical' type rather than the JDBC type this maps to.
*/
Class<T> getType();
@@ -104,7 +102,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
T read(DataReader reader) throws SQLException;
/**
* Ignore the reading of this value. Typically this means moving the index
* Ignore the reading of this value. Typically, this means moving the index
* position in the ResultSet.
*/
void loadIgnore(DataReader reader);
@@ -114,20 +112,16 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
* <p>
* value may need to be converted from the logical bean property type to the
* JDBC type.
* </p>
*/
void bind(DataBinder binder, T value) throws SQLException;
/**
* Convert the value as necessary to the JDBC type.
* <p>
* Note that this should also match the type as per the getJdbcType()
* method.
* </p>
* Note that this should also match the type as per the getJdbcType() method.
* <p>
* This is typically used when the matching type is used in a where clause
* and we use this to ensure it is an appropriate jdbc type.
* </p>
*/
Object toJdbcType(Object value);
@@ -135,19 +129,14 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
* Convert the value as necessary to the logical Bean type.
* <p>
* The type as per the bean property.
* </p>
* <p>
* This is used to automatically convert id values (typically from a string
* to a int, long or UUID).
* </p>
*/
T toBeanType(Object value);
/**
* Convert the type into a string representation.
* <p>
* Reciprocal of parse().
* </p>
*/
String formatValue(T value);
@@ -155,10 +144,8 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
* Convert the type into a string representation.
* <p>
* This assumes the value is of the correct type.
* </p>
* <p>
* This is so that ScalarType also implements the StringFormatter interface.
* </p>
*/
@Override
String format(Object value);
@@ -167,10 +154,6 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
* Convert the string value to the appropriate java object.
* <p>
* Mostly used to support CSV, JSON and XML parsing.
* </p>
* <p>
* Reciprocal of formatValue().
* </p>
*/
@Override
T parse(String value);
@@ -183,29 +166,32 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
/**
* Return true if the type can accept long systemTimeMillis input.
* <p>
* This is used to determine if is is sensible to use the
* This is used to determine if it is sensible to use the
* {@link #convertFromMillis(long)} method.
* </p>
* <p>
* This includes the Date, Calendar, sql Date, Time, Timestamp, JODA types
* as well as Long, BigDecimal and String (although it generally is not
* expected to parse systemTimeMillis to a String or BigDecimal).
* </p>
*/
boolean isDateTimeCapable();
default boolean isDateTimeCapable() {
return false;
}
/**
* Convert the value into a long version value.
*/
long asVersion(T value);
default long asVersion(T value) {
throw new UnsupportedOperationException();
}
/**
* Convert the systemTimeMillis into the appropriate java object.
* <p>
* For non dateTime types this will throw an exception.
* </p>
*/
T convertFromMillis(long dateTime);
default T convertFromMillis(long dateTime) {
throw new UnsupportedOperationException();
}
/**
* Read the value from binary input.
@@ -215,7 +201,7 @@ public interface ScalarType<T> extends StringParser, StringFormatter, ScalarData
/**
* Write the value to binary output.
*/
void writeData(DataOutput dataOutput, T v) throws IOException;
void writeData(DataOutput dataOutput, T value) throws IOException;
/**
* Read the value from JsonParser.
+8 -8
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.6.1</version>
<version>13.6.5</version>
</parent>
<artifactId>ebean-core</artifactId>
@@ -15,7 +15,7 @@
<scm>
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
<tag>ebean-parent-13.6.1</tag>
<tag>ebean-parent-13.6.5</tag>
</scm>
<dependencies>
@@ -41,19 +41,19 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-api</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
</dependency>
<dependency>
@@ -144,21 +144,21 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlserver</artifactId>
<version>13.6.1</version>
<version>13.6.5</version>
<scope>test</scope>
</dependency>
@@ -92,6 +92,11 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
*/
ATTRIBUTE(FIND_ATTRIBUTE, "findAttribute", false, false),
/**
* Find single attribute set.
*/
ATTRIBUTE_SET(FIND_ATTRIBUTE_SET, "findAttributeSet", false, false),
/**
* Find rowCount.
*/
@@ -28,6 +28,7 @@ public interface TxnProfileEventCodes {
String FIND_ID_LIST = "fi";
String FIND_EXISTS = "ex";
String FIND_ATTRIBUTE = "fa";
String FIND_ATTRIBUTE_SET = "fas";
String FIND_COUNT = "fc";
String FIND_SUBQUERY = "fs";
@@ -93,6 +93,11 @@ public class DatabasePlatformFactory {
return provider.create(majorVersion, minorVersion, metaData, connection);
}
}
if (providers.isEmpty()) {
throw new IllegalStateException("There are no ebean platform providers in the classpath. " +
"Add a missing dependency like ebean-h2, ebean-postgres, ebean-mysql etc to support the database [" + dbProductName
+ "]. Adding a dependency on io.ebean:ebean will add support for all platforms.");
}
throw new IllegalStateException("Unable to determine the appropriate ebean platform given database product name [" + dbProductName
+ "] and ebean platform providers " + providers + ". With ebean 13+ we now have separate platforms (ebean-postgres, ebean-mysql etc)"
+ " and should use database specific platform dependency like ebean-postgres. Note that we can use ebean-platform-all to include"
@@ -1193,7 +1193,23 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
try {
request.initTransIfRequired();
return request.findSingleAttributeList();
return request.findSingleAttributeCollection(new ArrayList<>());
} finally {
request.endTransIfRequired();
}
}
@Override
@SuppressWarnings("unchecked")
public <A, T> Set<A> findSingleAttributeSet(Query<T> query, Transaction transaction) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.ATTRIBUTE_SET, query, transaction);
Object result = request.getFromQueryCache();
if (result != null) {
return (Set<A>) result;
}
try {
request.initTransIfRequired();
return request.findSingleAttributeCollection(new LinkedHashSet<>());
} finally {
request.endTransIfRequired();
}
@@ -6,6 +6,7 @@ import io.ebean.bean.BeanCollection;
import javax.persistence.PersistenceException;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
/**
@@ -29,9 +30,9 @@ public interface OrmQueryEngine {
<T> BeanCollection<T> findMany(OrmQueryRequest<T> request);
/**
* Execute the findSingleAttributeList query.
* Execute the findSingleAttributeCollection query.
*/
<A> List<A> findSingleAttributeList(OrmQueryRequest<?> request);
<A extends Collection<?>> A findSingleAttributeCollection(OrmQueryRequest<?> request, A collection);
/**
* Execute the findVersions query.
@@ -431,8 +431,8 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
}
@Override
public <A> List<A> findSingleAttributeList() {
return queryEngine.findSingleAttributeList(this);
public <A extends Collection<?>> A findSingleAttributeCollection(A collection) {
return queryEngine.findSingleAttributeCollection(this, collection);
}
/**
@@ -77,8 +77,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
*/
private List<BeanPropertyAssocMany<?>> updatedManys;
/**
* Need to get and store the updated properties because the persist listener is notified
* later on a different thread and the bean has been reset at that point.
* Store the updated properties to notify persist listener.
*/
private Set<String> updatedProperties;
/**
@@ -122,7 +121,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
*/
private boolean complete;
/**
* Many to many intersection table changes that are held for later batch processing.
* Many-to-many intersection table changes that are held for later batch processing.
*/
private List<SaveMany> saveMany;
@@ -148,9 +147,10 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
// 'stateless update' - set loaded properties as dirty
intercept.setNewBeanForUpdate();
statelessUpdate = true;
} else if (!intercept.isDirty()) {
// check if any mutable scalar properties are dirty
beanDescriptor.checkAnyMutableProperties(intercept);
}
// Mark Mutable scalar properties (like Hstore) as dirty where necessary
beanDescriptor.checkMutableProperties(intercept);
}
this.concurrencyMode = beanDescriptor.concurrencyMode(intercept);
this.publish = Flags.isPublish(flags);
@@ -726,10 +726,6 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
executeInsert();
return -1;
case UPDATE:
if (beanPersistListener != null) {
// store the updated properties for sending later
updatedProperties = updatedProperties();
}
executeUpdate();
return -1;
case DELETE_SOFT:
@@ -1208,6 +1204,11 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
private void executeUpdate() {
setTenantId();
if (controller == null || controller.preUpdate(this)) {
// check dirty state for all mutable scalar properties (like DbJson, Hstore)
beanDescriptor.checkAllMutableProperties(intercept);
if (beanPersistListener != null) {
updatedProperties = updatedProperties();
}
postControllerPrepareUpdate();
beanManager.getBeanPersister().update(this);
}
@@ -7,6 +7,7 @@ import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import io.ebeanservice.docstore.api.DocQueryRequest;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -122,7 +123,7 @@ public interface SpiOrmQueryRequest<T> extends BeanQueryRequest<T>, DocQueryRequ
/**
* Execute the findSingleAttributeList query.
*/
<A> List<A> findSingleAttributeList();
<A extends Collection<?>> A findSingleAttributeCollection(A collection);
/**
* Execute returning the ResultSet.
@@ -13,11 +13,10 @@ public interface DataTimeZone {
Calendar getTimeZone();
/**
* Return the Calendar to use for Timezone information when reading/writing date.
* A 'date' only value has normally no timezone information, but some platforms (like MySQL)
* reqire this.
* Return the Calendar to use for Timezone information when reading/writing a time component (date only/time only).
* A time component has normally no timezone information, but some platforms (like MySQL) reqire this.
*/
default Calendar getDateTimeZone() {
default Calendar getTimeComponentTimeZone() {
return null;
}
}
@@ -19,7 +19,7 @@ public class MySqlDataTimeZone implements DataTimeZone {
}
@Override
public Calendar getDateTimeZone() {
public Calendar getTimeComponentTimeZone() {
return zone;
}
}
@@ -1,5 +1,9 @@
package io.ebeaninternal.server.deploy;
import io.ebean.bean.BeanCollection;
import io.ebean.bean.EntityBean;
import io.ebean.common.BeanList;
import io.ebean.common.BeanSet;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.server.core.OrmQueryRequest;
import io.ebeaninternal.server.el.ElPropertyValue;
@@ -12,18 +16,17 @@ import io.ebeaninternal.server.query.CQueryCollectionAdd;
public final class BeanCollectionHelpFactory {
@SuppressWarnings("rawtypes")
private static final BeanListHelp LIST_HELP = new BeanListHelp();
private static final CQueryCollectionAdd LIST_HELP = new ListAdd();
@SuppressWarnings("rawtypes")
private static final BeanSetHelp SET_HELP = new BeanSetHelp();
private static final CQueryCollectionAdd SET_HELP = new SetAdd();
/**
* Create the helper based on the many property.
*/
public static <T> BeanCollectionHelp<T> create(BeanPropertyAssocMany<T> many) {
boolean elementCollection = many.isElementCollection();
ManyType manyType = many.manyType();
switch (manyType) {
switch (many.manyType()) {
case LIST:
return elementCollection ? new BeanListHelpElement<>(many) : new BeanListHelp<>(many);
case SET:
@@ -31,7 +34,7 @@ public final class BeanCollectionHelpFactory {
case MAP:
return elementCollection ? new BeanMapHelpElement<>(many) : new BeanMapHelp<>(many);
default:
throw new RuntimeException("Invalid type " + manyType);
throw new RuntimeException("Invalid type " + many.manyType());
}
}
@@ -53,4 +56,30 @@ public final class BeanCollectionHelpFactory {
}
}
private static final class ListAdd<T> implements CQueryCollectionAdd<T> {
@Override
public BeanCollection<T> createEmptyNoParent() {
return new BeanList<>();
}
@Override
public void add(BeanCollection<?> collection, EntityBean bean, boolean withCheck) {
collection.internalAdd(bean);
}
}
private static final class SetAdd<T> implements CQueryCollectionAdd<T> {
@Override
public BeanCollection<T> createEmptyNoParent() {
return new BeanSet<>();
}
@Override
public void add(BeanCollection<?> collection, EntityBean bean, boolean withCheck) {
collection.internalAdd(bean);
}
}
}
@@ -3140,9 +3140,9 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
}
/**
* Check for mutable scalar types and mark as dirty if necessary.
* Check all mutable scalar types and mark as dirty if necessary.
*/
public void checkMutableProperties(EntityBeanIntercept ebi) {
public void checkAllMutableProperties(EntityBeanIntercept ebi) {
for (BeanProperty beanProperty : propertiesMutable) {
int propertyIndex = beanProperty.propertyIndex();
if (ebi.isLoadedProperty(propertyIndex)) {
@@ -3156,6 +3156,23 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
}
}
/**
* Return true if any mutable properties are dirty.
*/
public boolean checkAnyMutableProperties(EntityBeanIntercept ebi) {
for (BeanProperty beanProperty : propertiesMutable) {
int propertyIndex = beanProperty.propertyIndex();
if (ebi.isLoadedProperty(propertyIndex)) {
Object value = beanProperty.getValue(ebi.getOwner());
if (beanProperty.checkMutable(value, ebi.isDirtyProperty(propertyIndex), ebi)) {
ebi.markPropertyAsChanged(propertyIndex);
return true;
}
}
}
return false;
}
public ConcurrencyMode concurrencyMode(EntityBeanIntercept ebi) {
if (!hasVersionProperty(ebi)) {
return ConcurrencyMode.NONE;
@@ -6,7 +6,6 @@ import io.ebean.bean.EntityBeanIntercept;
import io.ebean.bean.PersistenceContext;
import io.ebean.core.type.DataReader;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.server.query.STreePropertyAssocMany;
import java.util.Map;
@@ -70,11 +69,6 @@ public interface DbReadContext {
*/
void register(BeanPropertyAssocMany<?> many, BeanCollection<?> bc);
/**
* Return the property that is associated with the many. There can only be
* one. This can be null.
*/
STreePropertyAssocMany getManyProperty();
/**
* Set back the bean that has just been loaded with its id.
@@ -29,10 +29,10 @@ public final class IndexDefinition {
/**
* Create a unique constraint given the column names.
*/
public IndexDefinition(String[] columns) {
public IndexDefinition(String name, String[] columns) {
this.columns = columns;
this.unique = true;
this.name = null;
this.name = name;
this.platforms = null;
this.concurrent = false;
this.definition = null;
@@ -16,11 +16,17 @@ public final class PartitionMeta {
return mode;
}
/**
* Originally the property name but replaced with the db column.
*/
public String getProperty() {
return property;
}
public void setProperty(String dbColumn) {
/**
* Set the db column being partitioned on.
*/
public void setColumn(String dbColumn) {
this.property = dbColumn;
}
}
@@ -249,12 +249,12 @@ public class DeployBeanDescriptor<T> {
if (partitionMeta != null) {
DeployBeanProperty beanProperty = getBeanProperty(partitionMeta.getProperty());
if (beanProperty != null) {
partitionMeta.setProperty(beanProperty.getDbColumn());
partitionMeta.setColumn(beanProperty.getDbColumn());
}
}
return partitionMeta;
}
public void setTablespaceMeta(TablespaceMeta tablespaceMeta) {
this.tablespaceMeta = tablespaceMeta;
}
@@ -135,7 +135,7 @@ final class AnnotationClass extends AnnotationParser {
UniqueConstraint uc = typeGet(cls, UniqueConstraint.class);
if (uc != null) {
descriptor.addIndex(new IndexDefinition(convertColumnNames(uc.columnNames())));
descriptor.addIndex(new IndexDefinition(uc.name(), convertColumnNames(uc.columnNames())));
}
View view = typeGet(cls, View.class);
if (view != null) {
@@ -145,7 +145,7 @@ final class AnnotationClass extends AnnotationParser {
if (table != null) {
UniqueConstraint[] uniqueConstraints = table.uniqueConstraints();
for (UniqueConstraint c : uniqueConstraints) {
descriptor.addIndex(new IndexDefinition(convertColumnNames(c.columnNames())));
descriptor.addIndex(new IndexDefinition(c.name(), convertColumnNames(c.columnNames())));
}
}
StorageEngine storage = typeGet(cls, StorageEngine.class);
@@ -46,20 +46,29 @@ final class DtoMetaBuilder {
}
static String propertyName(String methodName) {
final String name = methodName.substring(3);
return Character.toLowerCase(name.charAt(0)) + name.substring(1);
if (isTraditionalSetterMethod(methodName)) {
final String name = methodName.substring(3);
return Character.toLowerCase(name.charAt(0)) + name.substring(1);
} else {
// accessor style setter method
return methodName;
}
}
private static boolean isTraditionalSetterMethod(String methodName) {
return methodName.startsWith("set") && methodName.length() > 3 && Character.isUpperCase(methodName.charAt(3));
}
/**
* Include a public "setter" method - 1 argument, returns void.
*/
static boolean includeMethod(Method method) {
String name = method.getName();
final int modifiers = method.getModifiers();
return Modifier.isPublic(modifiers)
&& !Modifier.isStatic(modifiers)
&& Void.TYPE.equals(method.getReturnType())
&& method.getParameterTypes().length == 1
&& method.getName().startsWith("set") && method.getName().length() > 3;
&& (!name.equals("wait") && !name.equals("equals"));
}
private void readConstructors() {
@@ -467,6 +467,11 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
return query.findSingleAttributeList();
}
@Override
public <A> Set<A> findSingleAttributeSet() {
return query.findSingleAttributeSet();
}
@Override
public boolean exists() {
return query.exists();
@@ -464,6 +464,11 @@ final class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expr
return exprList.findSingleAttributeList();
}
@Override
public <A> Set<A> findSingleAttributeSet() {
return exprList.findSingleAttributeSet();
}
@Override
public PagedList<T> findPagedList() {
return exprList.findPagedList();
@@ -126,7 +126,7 @@ final class SaveManyBeans extends SaveManyBase {
// performance optimisation for large collections
targetDescriptor.preAllocateIds(collection.size());
}
if (!insertedParent && many.isOrphanRemoval() && request.isForcedUpdate()) {
if (forcedUpdateOrphanRemoval()) {
// collect the Id's (to exclude from deleteManyDetails)
List<Object> detailIds = collectIds(collection, targetDescriptor, isMap);
// deleting missing children - children not in our collected detailIds
@@ -140,6 +140,10 @@ final class SaveManyBeans extends SaveManyBase {
transaction.depth(-1);
}
private boolean forcedUpdateOrphanRemoval() {
return !insertedParent && many.isOrphanRemoval() && request.isForcedUpdate();
}
private void saveAllBeans(final BeanProperty orderColumn) {
Object mapKeyValue = null;
boolean skipSavingThisBean;
@@ -340,7 +344,7 @@ final class SaveManyBeans extends SaveManyBase {
return;
}
if (!(value instanceof BeanCollection<?>)) {
if (!insertedParent && cascade && isChangedProperty()) {
if (!forcedUpdateOrphanRemoval() && (!insertedParent && cascade && isChangedProperty())) {
persister.addToFlushQueue(many.deleteByParentId(request.beanId(), null), transaction, 0);
insertAllChildren = true;
}
@@ -605,14 +605,6 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
return logWhereSql;
}
/**
* Return the property that is associated with the many. There can only be one
* per SqlSelect. This can be null.
*/
@Override
public STreePropertyAssocMany getManyProperty() {
return manyProperty;
}
public String getBindLog() {
return bindLog;
@@ -24,11 +24,7 @@ import org.slf4j.Logger;
import javax.persistence.PersistenceException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* Handles the Object Relational fetching.
@@ -91,16 +87,16 @@ public final class CQueryEngine {
/**
* Build and execute the findSingleAttributeList query.
*/
public <A> List<A> findSingleAttributeList(OrmQueryRequest<?> request) {
public <A extends Collection<?>> A findSingleAttributeList(OrmQueryRequest<?> request, A collection) {
CQueryFetchSingleAttribute rcQuery = queryBuilder.buildFetchAttributeQuery(request);
request.setCancelableQuery(rcQuery);
return findAttributeList(request, rcQuery);
return findAttributeCollection(request, rcQuery, collection);
}
@SuppressWarnings("unchecked")
private <A> List<A> findAttributeList(OrmQueryRequest<?> request, CQueryFetchSingleAttribute rcQuery) {
private <A extends Collection<?>> A findAttributeCollection(OrmQueryRequest<?> request, CQueryFetchSingleAttribute rcQuery, A collection) {
try {
List<A> list = (List<A>) rcQuery.findList();
rcQuery.findCollection(collection);
if (request.logSql()) {
logGeneratedSql(request, rcQuery.getGeneratedSql(), rcQuery.getBindLog(), rcQuery.micros());
}
@@ -109,13 +105,21 @@ public final class CQueryEngine {
}
if (request.isQueryCachePut()) {
request.addDependentTables(rcQuery.getDependentTables());
list = Collections.unmodifiableList(list);
request.putToQueryCache(list);
if (Boolean.FALSE.equals(request.query().isReadOnly())) {
list = new ArrayList<>(list);
if (collection instanceof List) {
collection = (A) Collections.unmodifiableList((List<?>) collection);
request.putToQueryCache(collection);
if (Boolean.FALSE.equals(request.query().isReadOnly())) {
collection = (A) new ArrayList<>(collection);
}
} else if (collection instanceof Set) {
collection = (A) Collections.unmodifiableSet((Set<?>) collection);
request.putToQueryCache(collection);
if (Boolean.FALSE.equals(request.query().isReadOnly())) {
collection = (A) new LinkedHashSet<>(collection);
}
}
}
return list;
return collection;
} catch (SQLException e) {
throw translate(request, rcQuery.getBindLog(), rcQuery.getGeneratedSql(), e);
}
@@ -144,7 +148,7 @@ public final class CQueryEngine {
public <A> List<A> findIds(OrmQueryRequest<?> request) {
CQueryFetchSingleAttribute rcQuery = queryBuilder.buildFetchIdsQuery(request);
request.setCancelableQuery(rcQuery);
return findAttributeList(request, rcQuery);
return findAttributeCollection(request, rcQuery, new ArrayList<>());
}
private <T> void logGeneratedSql(OrmQueryRequest<T> request, String sql, String bindLog, long micros) {
@@ -16,6 +16,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
@@ -76,11 +77,10 @@ final class CQueryFetchSingleAttribute implements SpiProfileTransactionEvent, Ca
/**
* Execute the query returning the row count.
*/
List<Object> findList() throws SQLException {
void findCollection(Collection result) throws SQLException {
long startNano = System.nanoTime();
try {
prepareExecute();
List<Object> result = new ArrayList<>();
while (dataReader.next()) {
Object value = reader.read(dataReader);
if (containsCounts) {
@@ -95,7 +95,6 @@ final class CQueryFetchSingleAttribute implements SpiProfileTransactionEvent, Ca
queryPlan.captureBindForQueryPlan(predicates, executionTimeMicros);
}
getTransaction().profileEvent(this);
return result;
} finally {
close();
}
@@ -286,6 +286,11 @@ final class DefaultFetchGroupQuery<T> implements SpiFetchGroupQuery<T>, SpiQuery
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
}
@Override
public <A> Set<A> findSingleAttributeSet() {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
}
@Override
public <A> A findSingleAttribute() {
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
@@ -17,6 +17,7 @@ import javax.persistence.PersistenceException;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* Main Finder implementation.
@@ -97,9 +98,9 @@ public final class DefaultOrmQueryEngine implements OrmQueryEngine {
}
@Override
public <A> List<A> findSingleAttributeList(OrmQueryRequest<?> request) {
public <A extends Collection<?>> A findSingleAttributeCollection(OrmQueryRequest<?> request, A collection) {
flushJdbcBatchOnQuery(request);
return queryEngine.findSingleAttributeList(request);
return queryEngine.findSingleAttributeList(request, collection);
}
@Override
@@ -36,6 +36,7 @@ class SqlTreeLoadBean implements SqlTreeLoad {
private final SpiQuery.TemporalMode temporalMode;
private final boolean temporalVersions;
final IdBinder lazyLoadParentIdBinder;
private final STreePropertyAssocMany loadingChildProperty;
SqlTreeLoadBean(SqlTreeNodeBean node) {
this.lazyLoadParent = node.lazyLoadParent;
@@ -55,6 +56,16 @@ class SqlTreeLoadBean implements SqlTreeLoad {
this.properties = node.properties;
this.pathMap = node.pathMap;
this.children = node.createLoadChildren();
this.loadingChildProperty = loadingChildProperty();
}
private STreePropertyAssocMany loadingChildProperty() {
for (SqlTreeLoad child : children) {
if (child instanceof SqlTreeLoadManyRoot) {
return ((SqlTreeLoadManyRoot) child).manyProp();
}
}
return null;
}
boolean isRoot() {
@@ -280,10 +291,9 @@ class SqlTreeLoadBean implements SqlTreeLoad {
* included in the actual query.
*/
private void createListProxies() {
STreePropertyAssocMany fetchedMany = ctx.getManyProperty();
boolean forceNewReference = queryMode == Mode.REFRESH_BEAN;
for (STreePropertyAssocMany many : localDesc.propsMany()) {
if (many != fetchedMany) {
if (many != loadingChildProperty) {
if (readOnlyNoIntercept) {
many.createEmptyReference(localBean);
} else {
@@ -14,6 +14,10 @@ final class SqlTreeLoadManyRoot extends SqlTreeLoadBean {
this.manyProp = node.manyProp;
}
STreePropertyAssocMany manyProp() {
return manyProp;
}
@Override
public EntityBean load(DbReadContext cquery, EntityBean parentBean, EntityBean contextParent) throws SQLException {
// pass in null for parentBean because added to a collection rather than set to the parentBean
@@ -1498,6 +1498,10 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
return (List<A>) server.findSingleAttributeList(this, transaction);
}
@Override
public final <A> Set<A> findSingleAttributeSet() {
return (Set<A>) server.findSingleAttributeSet(this, transaction);
}
@Override
public final <A> A findSingleAttribute() {
List<A> list = findSingleAttributeList();
@@ -158,7 +158,7 @@ public class DataBind implements DataBinder {
@Override
public final void setDate(java.sql.Date v) throws SQLException {
Calendar timeZone = dataTimeZone.getDateTimeZone();
Calendar timeZone = dataTimeZone.getTimeComponentTimeZone();
if (timeZone != null) {
pstmt.setDate(++pos, v, timeZone);
} else {
@@ -178,7 +178,7 @@ public class DataBind implements DataBinder {
@Override
public final void setTime(Time v) throws SQLException {
Calendar timeZone = dataTimeZone.getTimeZone();
Calendar timeZone = dataTimeZone.getTimeComponentTimeZone();
if (timeZone != null) {
pstmt.setTime(++pos, v, timeZone);
} else {
@@ -353,6 +353,9 @@ public final class DefaultTypeManager implements TypeManager {
Type genericType = prop.getGenericType();
boolean hasJacksonAnnotations = objectMapperPresent && checkJacksonAnnotations(prop);
if (type.equals(String.class)) {
return ScalarTypeJsonString.typeFor(postgres, dbType);
}
if (type.equals(List.class)) {
DocPropertyType docType = getDocType(genericType);
if (!hasJacksonAnnotations && isValueTypeSimple(genericType)) {
@@ -107,7 +107,7 @@ public class RsetDataReader implements DataReader {
@Override
public final Date getDate() throws SQLException {
Calendar cal = dataTimeZone.getDateTimeZone();
Calendar cal = dataTimeZone.getTimeComponentTimeZone();
if (cal != null) {
return rset.getDate(pos(), cal);
} else {
@@ -156,7 +156,7 @@ public class RsetDataReader implements DataReader {
@Override
public final Time getTime() throws SQLException {
Calendar cal = dataTimeZone.getTimeZone();
Calendar cal = dataTimeZone.getTimeComponentTimeZone();
if (cal != null) {
return rset.getTime(pos(), cal);
} else {
@@ -18,41 +18,6 @@ abstract class ScalarTypeBase<T> implements ScalarType<T> {
this.jdbcType = jdbcType;
}
@Override
public long asVersion(T value) {
throw new RuntimeException("not supported");
}
@Override
public boolean isBinaryType() {
// override for binary/byte based types
return false;
}
/**
* Default implementation of mutable false.
*/
@Override
public boolean isMutable() {
return false;
}
/**
* Default to true.
*/
@Override
public boolean isDirty(Object value) {
return true;
}
/**
* Just return 0.
*/
@Override
public int getLength() {
return 0;
}
@Override
public boolean isJdbcNative() {
return jdbcNative;
@@ -88,16 +88,6 @@ abstract class ScalarTypeBaseVarchar<T> extends ScalarTypeBase<T> {
return format(value);
}
@Override
public T convertFromMillis(long systemTimeMillis) {
throw new TextException("Not Supported");
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
@SuppressWarnings("unchecked")
public String format(Object value) {
@@ -234,7 +234,6 @@ public final class ScalarTypeBoolean {
@Override
public int getLength() {
// typically this will return 1
return Math.max(trueValue.length(), falseValue.length());
}
@@ -329,16 +328,6 @@ public final class ScalarTypeBoolean {
return Boolean.valueOf(value);
}
@Override
public Boolean convertFromMillis(long systemTimeMillis) {
throw new TextException("Not Supported");
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public Boolean readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -85,16 +85,6 @@ final class ScalarTypeByte extends ScalarTypeBase<Byte> {
throw new TextException("Not supported");
}
@Override
public Byte convertFromMillis(long systemTimeMillis) {
throw new TextException("Not Supported");
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public Byte readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -59,16 +59,6 @@ public abstract class ScalarTypeBytesBase extends ScalarTypeBase<byte[]> {
throw new TextException("Not supported");
}
@Override
public byte[] convertFromMillis(long systemTimeMillis) {
throw new TextException("Not supported");
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public byte[] readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -26,26 +26,11 @@ public final class ScalarTypeBytesEncrypted implements ScalarType<byte[]> {
this.dataEncryptSupport = dataEncryptSupport;
}
@Override
public long asVersion(byte[] value) {
throw new RuntimeException("not supported");
}
@Override
public boolean isBinaryType() {
return true;
}
@Override
public boolean isMutable() {
return false;
}
@Override
public boolean isDirty(Object value) {
return false;
}
@Override
public void bind(DataBinder binder, byte[] value) throws SQLException {
value = dataEncryptSupport.encrypt(value);
@@ -93,16 +93,6 @@ class ScalarTypeDuration extends ScalarTypeBase<Duration> {
return Duration.parse(value);
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public Duration convertFromMillis(long systemTimeMillis) {
throw new TextException("Not Supported");
}
@Override
public Duration jsonRead(JsonParser parser) throws IOException {
return Duration.parse(parser.getValueAsString());
@@ -30,11 +30,6 @@ public final class ScalarTypeEncryptedWrapper<T> implements ScalarType<T>, Local
return dataEncryptSupport.encryptObject(formatValue);
}
@Override
public long asVersion(T value) {
throw new RuntimeException("not supported");
}
@Override
public boolean isBinaryType() {
return wrapped.isBinaryType();
@@ -229,16 +229,6 @@ final class ScalarTypeEnumStandard {
return Enum.valueOf(enumType, value);
}
@Override
public Object convertFromMillis(long systemTimeMillis) {
throw new TextException("Not Supported");
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public Object jsonRead(JsonParser parser) throws IOException {
if (parser.getCodec() != null) {
@@ -39,16 +39,6 @@ class ScalarTypeEnumWithMapping extends ScalarTypeEnumStandard.EnumBase implemen
return enumType == null;
}
@Override
public long asVersion(Object value) {
throw new RuntimeException("not supported");
}
@Override
public boolean isBinaryType() {
return false;
}
/**
* Return the IN values for DB constraint construction.
*/
@@ -129,16 +129,6 @@ final class ScalarTypeFile extends ScalarTypeBase<File> {
throw new TextException("Not supported");
}
@Override
public File convertFromMillis(long systemTimeMillis) {
throw new TextException("Not supported");
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public File readData(DataInput dataInput) throws IOException {
// skip reading large file
@@ -80,16 +80,6 @@ abstract class ScalarTypeJsonCollection<T> extends ScalarTypeBase<T> implements
return docPropertyType;
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public T convertFromMillis(long dateTime) {
return null;
}
@Override
public T readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -215,16 +215,6 @@ abstract class ScalarTypeJsonMap extends ScalarTypeBase<Map> {
}
}
@Override
public final Map convertFromMillis(long dateTime) {
throw new RuntimeException("Should never be called");
}
@Override
public final boolean isDateTimeCapable() {
return false;
}
@Override
public final Map readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -167,16 +167,6 @@ abstract class ScalarTypeJsonNode extends ScalarTypeBase<JsonNode> {
}
}
@Override
public JsonNode convertFromMillis(long dateTime) {
throw new RuntimeException("Should never be called");
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public JsonNode readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -55,16 +55,6 @@ final class ScalarTypeJsonObjectMapper {
NoMutationDetection(TypeJsonManager jsonManager, AnnotatedField field, int dbType, DocPropertyType docType) {
super(Object.class, jsonManager, field, dbType, docType);
}
@Override
public boolean isMutable() {
return false;
}
@Override
public boolean isDirty(Object value) {
return false;
}
}
/**
@@ -79,6 +69,11 @@ final class ScalarTypeJsonObjectMapper {
this.jsonb = "jsonb".equals(pgType);
}
@Override
public boolean isMutable() {
return true;
}
@Override
public boolean isJsonMapper() {
return true;
@@ -144,11 +139,6 @@ final class ScalarTypeJsonObjectMapper {
this.objectWriter = helper.objectWriter();
}
@Override
public boolean isMutable() {
return true;
}
@Override
public T read(DataReader reader) throws SQLException {
String json = reader.getString();
@@ -212,16 +202,6 @@ final class ScalarTypeJsonObjectMapper {
return docType;
}
@Override
public final boolean isDateTimeCapable() {
return false;
}
@Override
public final T convertFromMillis(long dateTime) {
throw new IllegalStateException("Not supported");
}
@Override
public final T jsonRead(JsonParser parser) throws IOException {
return objectReader.readValue(parser, deserType);
@@ -0,0 +1,41 @@
package io.ebeaninternal.server.type;
import io.ebean.config.dbplatform.DbPlatformType;
import io.ebean.config.dbplatform.ExtraDbTypes;
import io.ebean.core.type.DataBinder;
import io.ebean.core.type.ScalarType;
import java.sql.SQLException;
final class ScalarTypeJsonString {
static final Postgres JSONB = new Postgres(ExtraDbTypes.JSONB, PostgresHelper.JSONB_TYPE);
static final Postgres JSON = new Postgres(ExtraDbTypes.JSON, PostgresHelper.JSON_TYPE);
static ScalarType<?> typeFor(boolean postgres, int dbType) {
if (postgres) {
switch (dbType) {
case DbPlatformType.JSONB:
return JSONB;
case DbPlatformType.JSON:
return JSON;
}
}
return ScalarTypeString.INSTANCE;
}
private static class Postgres extends ScalarTypeStringBase {
final String postgresType;
Postgres(int jdbcType, String postgresType) {
super(true, jdbcType);
this.postgresType = postgresType;
}
@Override
public void bind(DataBinder binder, String rawJson) throws SQLException {
binder.setObject(PostgresHelper.asObject(postgresType, rawJson));
}
}
}
@@ -78,16 +78,6 @@ final class ScalarTypeMonthDay extends ScalarTypeBase<MonthDay> {
return MonthDay.parse(value);
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public MonthDay convertFromMillis(long dateTime) {
throw new RuntimeException("Not supported on this type");
}
@Override
public MonthDay readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -22,25 +22,6 @@ class ScalarTypeNotFound implements ScalarType<Void> {
public static final ScalarTypeNotFound INSTANCE = new ScalarTypeNotFound();
private ScalarTypeNotFound() { }
@Override
public boolean isBinaryType() {
throw new UnsupportedOperationException();
}
@Override
public boolean isMutable() {
throw new UnsupportedOperationException();
}
@Override
public boolean isDirty(Object value) {
throw new UnsupportedOperationException();
}
@Override
public int getLength() {
throw new UnsupportedOperationException();
}
@Override
public boolean isJdbcNative() {
@@ -102,21 +83,6 @@ class ScalarTypeNotFound implements ScalarType<Void> {
throw new UnsupportedOperationException();
}
@Override
public boolean isDateTimeCapable() {
throw new UnsupportedOperationException();
}
@Override
public long asVersion(Void value) {
throw new UnsupportedOperationException();
}
@Override
public Void convertFromMillis(long dateTime) {
throw new UnsupportedOperationException();
}
@Override
public Void readData(DataInput dataInput) throws IOException {
throw new UnsupportedOperationException();
@@ -82,16 +82,6 @@ final class ScalarTypePostgresHstore extends ScalarTypeBase<Map> {
}
}
@Override
public Map convertFromMillis(long dateTime) {
throw new RuntimeException("Should never be called");
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public Map readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -57,16 +57,6 @@ final class ScalarTypeShort extends ScalarTypeBase<Short> {
return Short.valueOf(value);
}
@Override
public Short convertFromMillis(long systemTimeMillis) {
throw new TextException("Not Supported");
}
@Override
public boolean isDateTimeCapable() {
return false;
}
@Override
public Short readData(DataInput dataInput) throws IOException {
if (!dataInput.readBoolean()) {
@@ -13,7 +13,7 @@ final class ScalarTypeTimeZone extends ScalarTypeBaseVarchar<TimeZone> {
@Override
public int getLength() {
return 20;
return 32;
}
@Override

Some files were not shown because too many files have changed in this diff Show More