Compare commits

...
Author SHA1 Message Date
Rob Bygrave ac3f4ca369 [maven-release-plugin] prepare release ebean-parent-13.11.1 2023-01-09 10:45:29 +13:00
Rob Bygrave 10133e6040 Bump agent to 13.11.1 2023-01-09 10:40:40 +13:00
Rob BygraveandGitHub 321fb26df3 Merge pull request #2927 from FOCONIS/findset-beancache
NEW: BeanCache for findSet
2023-01-09 10:29:15 +13:00
Rob BygraveandGitHub 28bd018d1f Merge pull request #2926 from FOCONIS/prepare-query
FIX: prepare FindMap query for proper bean cache / DB access
2023-01-09 10:28:09 +13:00
Rob BygraveandGitHub cceb29313b Merge pull request #2928 from ebean-orm/feature/2918-findEach-EmbeddedId-Memory
Fix memory leak with streaming queries with Id Embedded
2023-01-09 10:25:39 +13:00
Rob Bygrave 530bfa982e Fix memory leak with streaming queries with Id Embedded
- The Id Embedded beans do not need the embeddedOwner to be set. They do not need to propagate dirty state back to the owner.
2023-01-05 23:27:22 +13:00
Rob BygraveandGitHub 3cfa636e88 Merge pull request #2925 from FOCONIS/exclude-from-cp-scan
Ignore private/package private classes from CP-scan / FIX: Order of runServerConfigStartup
2023-01-05 20:16:40 +13:00
Roland Praml a2e8f098cf NEW: BeanCache for findSet 2023-01-04 17:11:24 +01:00
Roland Praml 9e42cfd7d7 FIX: prepare FindMap query for proper bean cache access 2023-01-04 16:59:31 +01:00
Roland Praml a3c54d4d20 FIX: Order of runServerConfigStartup 2023-01-04 14:00:16 +01:00
Roland Praml 1d48e2afb3 Ignore private/package private classes from CP-scan 2023-01-04 13:59:51 +01:00
Rob Bygrave d84c9dc1a9 Bump versions in test modules after release 2022-12-08 18:00:24 +13:00
Rob Bygrave 6165bf5a6c Bump versions in test modules after release 2022-12-08 17:06:41 +13:00
Rob Bygrave 712d3ea78f [maven-release-plugin] prepare for next development iteration 2022-12-08 15:31:04 +13:00
Rob Bygrave 96e3c95c29 [maven-release-plugin] prepare release ebean-parent-13.11.0 2022-12-08 15:30:51 +13:00
Rob Bygrave e6e25b979f Bump to 13.11.0-SNAPSHOT 2022-12-08 15:21:16 +13:00
Rob Bygrave 50fd0f6b1a Bump ebean-agent to 13.11.0 2022-12-08 15:19:30 +13:00
Rob Bygrave 0e9b83a1ce #2914 - Refactor ProcessingContext.getPropertyType() internals and whitespace 2022-12-08 11:37:10 +13:00
Rob Bygrave d2f629e7bb #2914 - Query bean generation support for @ElementCollection with validaiton annotations - NPE NullPointerException 2022-12-08 11:10:23 +13:00
Rob Bygrave e290f68b29 Revert "#2908 - Fix tests for Oracle and DB2 with maxRows and forUpdate() 2022-12-01 22:58:30 +13:00
Rob Bygrave a17e62b491 Revert "#2908 - [Oracle] Change OraclePlatform to use AnsiSqlLimiter (noting Oracle does not support FOR UPDATE with FETCH/OFFSET"
This reverts commit 62ed5a9f
2022-12-01 22:51:37 +13:00
Rob Bygrave 928db1f0f6 #2909 - [Hana] Replace HanaSqlLimitSqlLimiter with standard LimitOffsetSqlLimiter 2022-12-01 22:42:42 +13:00
Rob Bygrave c317092dc5 #2907 - Promote Db2SqlLimiter to be AnsiSqlRowsLimiter and move to ebean-api module 2022-12-01 22:40:13 +13:00
Rob Bygrave 95512d4851 #2906 - Tidy LimitOffsetSqlLimiter 2022-12-01 22:27:57 +13:00
Rob Bygrave 62ed5a9f2b #2908 - [Oracle] Change OraclePlatform to use AnsiSqlLimiter (noting Oracle does not support FOR UPDATE with FETCH/OFFSET 2022-12-01 22:24:35 +13:00
Rob Bygrave 37ba0b63e4 #2907 - Promote Db2SqlLimiter to be AnsiSqlRowsLimiter and move to ebean-api module 2022-12-01 22:18:16 +13:00
Rob Bygrave 22a5bd9b9d #2906 - Refactor tidy SqlLimiter implementations 2022-12-01 21:39:00 +13:00
Rob Bygrave 45529958ef #2904 MySql and MariaDB do not support OFFSET without LIMIT, ignore them for these tests 2022-12-01 21:27:44 +13:00
Rob Bygrave 7aa64f47c8 Fix test TestQueryCache for Oracle (not supporting READ_UNCOMMITTED as expected) 2022-12-01 10:46:26 +13:00
Rob BygraveandGitHub 919adf331a Merge pull request #2866 from FOCONIS/fix-formula-match-base-platform
FIX: @Formula / @Where Annotations should also match on base platform
2022-12-01 08:56:13 +13:00
Rob BygraveandGitHub 9f229e3cc2 Merge pull request #2904 from serg1236/bugfix/offset_without_limit
Fixed mandatory LIMIT generation in case of firstRow>0
2022-12-01 08:45:18 +13:00
Serhii Dakhnii 3277fe81a1 Fixed mandatory LIMIT generation in case of firstRow>0 2022-11-30 21:36:08 +02:00
Rob BygraveandGitHub 6c6ec3663a Merge pull request #2896 from ebean-orm/dependabot/maven/ebean-core/org.postgresql-postgresql-42.5.1
Bump postgresql from 42.5.0 to 42.5.1 in /ebean-core
2022-11-24 11:40:45 +13:00
Rob BygraveandGitHub 0461580d1c Merge pull request #2897 from ebean-orm/dependabot/maven/ebean-test/org.postgresql-postgresql-42.5.1
Bump postgresql from 42.5.0 to 42.5.1 in /ebean-test
2022-11-24 11:40:28 +13:00
Rob BygraveandGitHub 75dbb58c85 Merge pull request #2898 from ebean-orm/dependabot/maven/ebean-postgis/org.postgresql-postgresql-42.5.1
Bump postgresql from 42.5.0 to 42.5.1 in /ebean-postgis
2022-11-24 11:40:09 +13:00
Rob BygraveandGitHub 808f69cac1 Merge pull request #2899 from ebean-orm/dependabot/maven/platforms/postgres/org.postgresql-postgresql-42.5.1
Bump postgresql from 42.5.0 to 42.5.1 in /platforms/postgres
2022-11-24 11:39:52 +13:00
Rob BygraveandGitHub 974953a376 Merge pull request #2900 from ebean-orm/dependabot/maven/ebean-core-type/org.postgresql-postgresql-42.4.3
Bump postgresql from 42.4.1 to 42.4.3 in /ebean-core-type
2022-11-24 11:38:55 +13:00
dependabot[bot]andGitHub f85a367e98 Bump postgresql from 42.4.1 to 42.4.3 in /ebean-core-type
Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.4.1 to 42.4.3.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.4.1...REL42.4.3)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-23 22:27:09 +00:00
dependabot[bot]andGitHub 87a3c58d93 Bump postgresql from 42.5.0 to 42.5.1 in /platforms/postgres
Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.5.0 to 42.5.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.5.0...REL42.5.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-23 22:24:12 +00:00
dependabot[bot]andGitHub 1d1aea77d0 Bump postgresql from 42.5.0 to 42.5.1 in /ebean-test
Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.5.0 to 42.5.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.5.0...REL42.5.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-23 22:21:01 +00:00
dependabot[bot]andGitHub 2a02935cee Bump postgresql from 42.5.0 to 42.5.1 in /ebean-postgis
Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.5.0 to 42.5.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.5.0...REL42.5.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-23 22:21:01 +00:00
dependabot[bot]andGitHub fd2e5c0fc7 Bump postgresql from 42.5.0 to 42.5.1 in /ebean-core
Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.5.0 to 42.5.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.5.0...REL42.5.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-23 22:21:00 +00:00
Rob Bygrave 6d6b07bf87 Bump avaje-config to version 2.4 2022-11-23 08:35:04 +13:00
Rob Bygrave 2cac3cd0bb Bump test modules to 13.10.3-SNAPSHOT after release 2022-11-22 08:26:56 +13:00
Rob Bygrave d56098dbf0 [maven-release-plugin] prepare for next development iteration 2022-11-22 08:09:45 +13:00
Rob Bygrave 07682c97a7 [maven-release-plugin] prepare release ebean-parent-13.10.2 2022-11-22 08:09:37 +13:00
Rob Bygrave 331a9152aa Bump ebean-datasource to 8.4 and ebean-agent to 13.10.2 2022-11-21 17:49:01 +13:00
Rob Bygrave e87a06a713 #2894 - Lack of setNullParameter() functionality on io.ebean.DtoQuery interface 2022-11-21 17:00:55 +13:00
Rob Bygrave 3b5393dca6 Merge branch 'pen4-oscs_fix_cdsc95oau51t49so8cag' 2022-11-21 14:59:43 +13:00
Rob Bygrave 101c5e52b1 #2893 - Bump jackson-databind to 2.14.0 2022-11-21 14:59:27 +13:00
pen4 5d3bcf4008 update com.fasterxml.jackson.core:jackson-databind 2.13.3 to 2.14.0-rc1 2022-11-19 19:57:18 +08:00
Rob Bygrave dd7605ac3a #2888 - DatabaseFactory.create() fails with java.lang.InstantiationError: io.ebean.bean.EntityBeanIntercept in multi-module gradle setup 2022-11-15 14:50:34 +13:00
Rob Bygrave 47dfbb6157 #2864 - Not advertise services configurable via DatabaseConfig.putServiceObject() that are "internal"
"internal" meaning that in terms of module-path they are not in a properly exported package. For example,
they are in a subpackage of io.ebeaninternal
2022-11-10 13:11:08 +13:00
Rob BygraveandGitHub 013123c1a7 Merge pull request #2864 from FOCONIS/feature/override-service-objects
NEW: Override service objects with DatabaseConfig.putServiceObject
2022-11-10 13:05:22 +13:00
Rob Bygrave cbc463cd10 Merge branch 'FOCONIS-bug/transactional-affects-query-cache' 2022-11-10 12:32:49 +13:00
Rob Bygrave 6e9a8704b4 #2887 - Fix for Setting isolation level disables query cache
Use getInternalConnection() in order to set the queryOnly = false flag
which is done via connection()
2022-11-10 12:32:23 +13:00
Roland Praml 0fd2f34ed0 Possible bug: Setting isolation level disables query cache 2022-11-09 09:46:51 +01:00
Rob Bygrave 72f1ab18cc No effective change - rename parameter names only 2022-11-08 14:16:12 +13:00
Rob Bygrave b1bba9da5d #2774 - Tidy InExpression adding check and block for prop != null wrt prop.isDbEncrypted() and prop.isLocalEncrypted() 2022-11-08 11:12:46 +13:00
Rob Bygrave 8966faeb7e #2774 - Postgres ANY / MultiValueSupport with byte[]/binary data
Tidy up MultiValueBind.toArray() only
2022-11-08 09:33:09 +13:00
Rob Bygrave fed4413259 Merge branch 'master' of github.com:ebean-orm/ebean 2022-11-07 22:26:19 +13:00
Rob Bygrave 14dddb4866 #2774 - Postgres ANY / MultiValueSupport with byte[]/binary data
Add Postgres specific support for binding an array of byte[] with ANY(?)
which is used as with client side encryption where the bind values are
implicitly converted to byte[].

Fixes Postgres specific failure running TestEncryptClientSide.java
2022-11-07 22:25:32 +13:00
Rob BygraveandGitHub d7d6082038 Merge pull request #2885 from MarcusDunn/patch-1
Added platforms to BOM
2022-11-07 12:31:11 +13:00
Marcus DunnandGitHub c96357377b Added platforms to BOM
fixes #2884 

I'm a complete maven (especially bom) novice - but thought I could take a stab at making the change.
I also see you auto generate these with an action, is there anything needed there?
Feel free to completely disregard if this or the issue itself is way off the mark.
2022-11-04 11:56:48 -07:00
Rob Bygrave 2789d0f97c Bump snapshot version in test modules after release 2022-11-03 00:50:30 +13:00
Rob Bygrave 79cd1da9a4 [maven-release-plugin] prepare for next development iteration 2022-11-03 00:27:30 +13:00
Roland Praml 359f8b41fe FIX: @Formula / @Where Annotations should also match on base platform
A property annotated with
```java
@Formula(select = "...", platforms = SQLSERVER)
```
should match for SQLSERVER17 and SQLSERVER19
2022-10-25 10:55:23 +02:00
Roland Praml f8c6a3c960 NEW: Ovverride service objects with DatabaseConfig.putServiceObject 2022-10-25 10:28:55 +02:00
105 changed files with 1017 additions and 611 deletions
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-clickhouse</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-clickhouse</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-cockroach</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-db2</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-db2</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-h2</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-hana</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-hana</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-mariadb</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-mariadb</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-mysql</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-mysql</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-nuodb</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-nuodb</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-oracle</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-oracle</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-postgres</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-sqlite</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlite</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-sqlserver</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlserver</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean-yugabyte</name>
@@ -16,13 +16,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -35,18 +35,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+9 -9
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>composites</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean (all platforms)</name>
@@ -16,31 +16,31 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-joda-time</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-jackson-jsonnode</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-jackson-mapper</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -53,18 +53,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-all</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>composites</artifactId>
+2 -2
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean api</name>
@@ -29,7 +29,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-config</artifactId>
<version>2.2</version>
<version>2.4</version>
</dependency>
<!--
@@ -129,6 +129,11 @@ public interface DtoQuery<T> extends CancelableQuery {
*/
DtoQuery<T> setParameter(String name, Object value);
/**
* Bind the named parameter to SQL NULL.
*/
DtoQuery<T> setNullParameter(String name, int jdbcType);
/**
* Bind the named multi-value array parameter which we would use with Postgres ANY.
* <p>
@@ -141,6 +146,11 @@ public interface DtoQuery<T> extends CancelableQuery {
*/
DtoQuery<T> setParameter(int position, Object value);
/**
* Set a positioned parameter to SQL NULL.
*/
DtoQuery<T> setNullParameter(int position, int jdbcType);
/**
* Set the index of the first row of the results to return.
*/
@@ -6,7 +6,6 @@ import java.util.Set;
* Notification event that dependent tables have been modified.
* <p>
* This is sent to other interested servers (in the cluster).
* </p>
*/
public class ServerCacheNotification {
@@ -6,7 +6,6 @@ import io.ebean.config.DatabaseConfig;
* Plugin that provides a ServerCacheNotify implementation.
* <p>
* Is supplied this will be used to send the ServerCacheNotification event to other cluster members.
* </p>
*/
public interface ServerCacheNotifyPlugin {
@@ -32,13 +32,11 @@ import java.util.function.Function;
* <p>
* Used to programmatically construct an Database and optionally register it
* with the DB singleton.
* </p>
* <p>
* If you just use DB thout this programmatic configuration Ebean will read
* the application.properties file and take the configuration from there. This usually
* includes searching the class path and automatically registering any entity
* classes and listeners etc.
* </p>
* <pre>{@code
*
* DatabaseConfig config = new DatabaseConfig();
@@ -58,7 +56,6 @@ import java.util.function.Function;
* <p>
* Note that DatabaseConfigProvider provides a standard Java ServiceLoader mechanism that can
* be used to apply configuration to the DatabaseConfig.
* </p>
*
* @author emcgreal
* @author rbygrave
@@ -615,7 +612,7 @@ public class DatabaseConfig {
}
/**
* Put a service object into configuration such that it can be passed to a plugin.
* Put a service object into configuration such that it can be used by ebean or a plugin.
* <p>
* For example, put IgniteConfiguration in to be passed to the Ignite plugin.
*/
@@ -623,6 +620,23 @@ public class DatabaseConfig {
serviceObject.put(key, configObject);
}
/**
* Put a service object into configuration such that it can be used by ebean or a plugin.
* <p>
* For example, put IgniteConfiguration in to be passed to the Ignite plugin.
* You can also override some SPI objects that should be used for that Database. Currently, the following
* objects are possible.
* <ul>
* <li>DataSourceAlertFactory (e.g. add different alert factories for different ebean instances)</li>
* <li>DocStoreFactory</li>
* <li>SlowQueryListener (e.g. add custom query listener for a certain ebean instance)</li>
* <li>ServerCacheNotifyPlugin</li>
* </ul>
*/
public <T> void putServiceObject(Class<T> iface, T configObject) {
serviceObject.put(serviceObjectKey(iface), configObject);
}
/**
* Return the service object given the key.
*/
@@ -631,7 +645,7 @@ public class DatabaseConfig {
}
/**
* Put a service object into configuration such that it can be passed to a plugin.
* Put a service object into configuration such that it can be used by ebean or a plugin.
*
* <pre>{@code
*
@@ -656,7 +670,7 @@ public class DatabaseConfig {
}
/**
* Used by plugins to obtain service objects.
* Used by ebean or plugins to obtain service objects.
*
* <pre>{@code
*
@@ -1,20 +1,16 @@
package io.ebean.platform.db2;
package io.ebean.config.dbplatform;
import io.ebean.config.dbplatform.SqlLimitRequest;
import io.ebean.config.dbplatform.SqlLimitResponse;
import io.ebean.config.dbplatform.SqlLimiter;
public class Db2SqlLimiter implements SqlLimiter {
public final class AnsiSqlRowsLimiter implements SqlLimiter {
@Override
public SqlLimitResponse limit(SqlLimitRequest request) {
StringBuilder sb = new StringBuilder(512);
String dbSql = request.getDbSql();
StringBuilder sb = new StringBuilder(50 + dbSql.length());
sb.append("select ");
if (request.isDistinct()) {
sb.append("distinct ");
}
sb.append(request.getDbSql());
sb.append(dbSql);
int firstRow = request.getFirstRow();
if (firstRow > 0) {
sb.append(" offset ").append(firstRow).append(" rows");
@@ -23,7 +19,6 @@ public class Db2SqlLimiter implements SqlLimiter {
if (maxRows > 0) {
sb.append(" fetch next ").append(maxRows).append(" rows only");
}
String sql = request.getDbPlatform().completeSql(sb.toString(), request.getOrmQuery());
return new SqlLimitResponse(sql);
}
@@ -3,42 +3,25 @@ package io.ebean.config.dbplatform;
/**
* Adds LIMIT OFFSET clauses to a SQL query.
*/
public class LimitOffsetSqlLimiter implements SqlLimiter {
/**
* LIMIT keyword.
*/
private static final String LIMIT = "limit";
/**
* OFFSET keyword.
*/
private static final String OFFSET = "offset";
public final class LimitOffsetSqlLimiter implements SqlLimiter {
@Override
public SqlLimitResponse limit(SqlLimitRequest request) {
String dbSql = request.getDbSql();
StringBuilder sb = new StringBuilder(50 + dbSql.length());
sb.append("select ");
if (request.isDistinct()) {
sb.append("distinct ");
}
sb.append(dbSql);
int firstRow = request.getFirstRow();
int maxRows = request.getMaxRows();
if (maxRows > 0 || firstRow > 0) {
sb.append(" ").append(LIMIT).append(" ").append(maxRows);
if (firstRow > 0) {
sb.append(" ").append(OFFSET).append(" ");
sb.append(firstRow);
}
if (maxRows > 0) {
sb.append(" limit ").append(maxRows);
}
int firstRow = request.getFirstRow();
if (firstRow > 0) {
sb.append(" offset ").append(firstRow);
}
String sql = request.getDbPlatform().completeSql(sb.toString(), request.getOrmQuery());
return new SqlLimitResponse(sql);
}
@@ -5,14 +5,6 @@ package io.ebean.config.dbplatform;
*/
public interface SqlLimiter {
/**
* the new line character used.
* <p>
* Note that this is removed for logging sql to the transaction log.
* </p>
*/
char NEW_LINE = '\n';
/**
* Add the SQL limiting statements around the query.
*/
+4 -4
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</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.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
<name>ebean autotune</name>
@@ -26,7 +26,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
@@ -55,7 +55,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
+104 -18
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean bom</name>
@@ -89,106 +89,192 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-joda-time</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-jackson-jsonnode</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-jackson-mapper</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-ddl-generator</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-xml</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-autotune</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>querybean-generator</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>kotlin-querybean-generator</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-postgis</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-redis</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<!-- platforms -->
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-all</artifactId>
<version>13.11.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-clickhouse</artifactId>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-db2</artifactId>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-h2</artifactId>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-hana</artifactId>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-hsqldb</artifactId>
<version>13.11.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-mariadb</artifactId>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-mysql</artifactId>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-nuodb</artifactId>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-oracle</artifactId>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-postgres</artifactId>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-sqlanywhere</artifactId>
<version>13.11.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-sqlite</artifactId>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-sqlserver</artifactId>
<version>13.11.1</version>
</dependency>
</dependencies>
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-core-type</artifactId>
@@ -16,7 +16,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -30,7 +30,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.4.1</version>
<version>42.4.3</version>
<optional>true</optional>
</dependency>
+9 -9
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-core</artifactId>
@@ -15,14 +15,14 @@
<scm>
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
<dependencies>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -46,13 +46,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -135,7 +135,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.0</version>
<version>42.5.1</version>
<optional>true</optional>
</dependency>
@@ -143,21 +143,21 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlserver</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
@@ -759,6 +759,11 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
*/
BindParams getBindParams();
/**
* Return the bind parameters ensuring it is initialised.
*/
BindParams initBindParams();
/**
* Replace the query detail. This is used by the AutoTune feature to as a
* fast way to set the query properties and joins.
@@ -115,88 +115,88 @@ public class DataBind implements DataBinder {
}
@Override
public void setString(String s) throws SQLException {
pstmt.setString(++pos, s);
public void setString(String value) throws SQLException {
pstmt.setString(++pos, value);
}
@Override
public final void setInt(int i) throws SQLException {
pstmt.setInt(++pos, i);
public final void setInt(int value) throws SQLException {
pstmt.setInt(++pos, value);
}
@Override
public final void setLong(long i) throws SQLException {
pstmt.setLong(++pos, i);
public final void setLong(long value) throws SQLException {
pstmt.setLong(++pos, value);
}
@Override
public final void setShort(short i) throws SQLException {
pstmt.setShort(++pos, i);
public final void setShort(short value) throws SQLException {
pstmt.setShort(++pos, value);
}
@Override
public final void setFloat(float i) throws SQLException {
pstmt.setFloat(++pos, i);
public final void setFloat(float value) throws SQLException {
pstmt.setFloat(++pos, value);
}
@Override
public final void setDouble(double i) throws SQLException {
pstmt.setDouble(++pos, i);
public final void setDouble(double value) throws SQLException {
pstmt.setDouble(++pos, value);
}
@Override
public final void setBigDecimal(BigDecimal v) throws SQLException {
pstmt.setBigDecimal(++pos, v);
public final void setBigDecimal(BigDecimal value) throws SQLException {
pstmt.setBigDecimal(++pos, value);
}
@Override
public final void setDate(java.sql.Date v) throws SQLException {
public final void setDate(java.sql.Date value) throws SQLException {
Calendar timeZone = dataTimeZone.getTimeComponentTimeZone();
if (timeZone != null) {
pstmt.setDate(++pos, v, timeZone);
pstmt.setDate(++pos, value, timeZone);
} else {
pstmt.setDate(++pos, v);
pstmt.setDate(++pos, value);
}
}
@Override
public final void setTimestamp(Timestamp v) throws SQLException {
public final void setTimestamp(Timestamp value) throws SQLException {
Calendar timeZone = dataTimeZone.getTimeZone();
if (timeZone != null) {
pstmt.setTimestamp(++pos, v, timeZone);
pstmt.setTimestamp(++pos, value, timeZone);
} else {
pstmt.setTimestamp(++pos, v);
pstmt.setTimestamp(++pos, value);
}
}
@Override
public final void setTime(Time v) throws SQLException {
public final void setTime(Time value) throws SQLException {
Calendar timeZone = dataTimeZone.getTimeComponentTimeZone();
if (timeZone != null) {
pstmt.setTime(++pos, v, timeZone);
pstmt.setTime(++pos, value, timeZone);
} else {
pstmt.setTime(++pos, v);
pstmt.setTime(++pos, value);
}
}
@Override
public void setBoolean(boolean v) throws SQLException {
pstmt.setBoolean(++pos, v);
public void setBoolean(boolean value) throws SQLException {
pstmt.setBoolean(++pos, value);
}
@Override
public void setBytes(byte[] v) throws SQLException {
pstmt.setBytes(++pos, v);
public void setBytes(byte[] value) throws SQLException {
pstmt.setBytes(++pos, value);
}
@Override
public void setByte(byte v) throws SQLException {
pstmt.setByte(++pos, v);
public void setByte(byte value) throws SQLException {
pstmt.setByte(++pos, value);
}
@Override
public void setChar(char v) throws SQLException {
pstmt.setString(++pos, String.valueOf(v));
public void setChar(char value) throws SQLException {
pstmt.setString(++pos, String.valueOf(value));
}
@Override
@@ -215,20 +215,17 @@ public class DataBind implements DataBinder {
@Override
public void setBlob(byte[] bytes) throws SQLException {
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
pstmt.setBinaryStream(++pos, is, bytes.length);
pstmt.setBinaryStream(++pos, new ByteArrayInputStream(bytes), bytes.length);
}
@Override
public void setClob(String content) throws SQLException {
Reader reader = new StringReader(content);
pstmt.setCharacterStream(++pos, reader, content.length());
pstmt.setCharacterStream(++pos, new StringReader(content), content.length());
}
@Override
public void setArray(String arrayType, Object[] elements) throws SQLException {
Array array = connection.createArrayOf(arrayType, elements);
pstmt.setArray(++pos, array);
pstmt.setArray(++pos, connection.createArrayOf(arrayType, elements));
}
}
@@ -33,87 +33,87 @@ public final class BindCaptureStatement extends BindCaptureStatementBase impleme
}
@Override
public void setBoolean(int parameterIndex, boolean x) {
capture.add(new BindCaptureTypes.Boolean(parameterIndex, x));
public void setBoolean(int parameterIndex, boolean value) {
capture.add(new BindCaptureTypes.Boolean(parameterIndex, value));
}
@Override
public void setByte(int parameterIndex, byte x) {
capture.add(new BindCaptureTypes.Byte(parameterIndex, x));
public void setByte(int parameterIndex, byte value) {
capture.add(new BindCaptureTypes.Byte(parameterIndex, value));
}
@Override
public void setShort(int parameterIndex, short x) {
capture.add(new BindCaptureTypes.TShort(parameterIndex, x));
public void setShort(int parameterIndex, short value) {
capture.add(new BindCaptureTypes.TShort(parameterIndex, value));
}
@Override
public void setInt(int parameterIndex, int x) {
capture.add(new BindCaptureTypes.TInt(parameterIndex, x));
public void setInt(int parameterIndex, int value) {
capture.add(new BindCaptureTypes.TInt(parameterIndex, value));
}
@Override
public void setLong(int parameterIndex, long x) {
capture.add(new BindCaptureTypes.TLong(parameterIndex, x));
public void setLong(int parameterIndex, long value) {
capture.add(new BindCaptureTypes.TLong(parameterIndex, value));
}
@Override
public void setFloat(int parameterIndex, float x) {
capture.add(new BindCaptureTypes.TFloat(parameterIndex, x));
public void setFloat(int parameterIndex, float value) {
capture.add(new BindCaptureTypes.TFloat(parameterIndex, value));
}
@Override
public void setDouble(int parameterIndex, double x) {
capture.add(new BindCaptureTypes.TDouble(parameterIndex, x));
public void setDouble(int parameterIndex, double value) {
capture.add(new BindCaptureTypes.TDouble(parameterIndex, value));
}
@Override
public void setBigDecimal(int parameterIndex, BigDecimal x) {
capture.add(new BindCaptureTypes.TBigDecimal(parameterIndex, x));
public void setBigDecimal(int parameterIndex, BigDecimal value) {
capture.add(new BindCaptureTypes.TBigDecimal(parameterIndex, value));
}
@Override
public void setString(int parameterIndex, String x) {
capture.add(new BindCaptureTypes.TString(parameterIndex, x));
public void setString(int parameterIndex, String value) {
capture.add(new BindCaptureTypes.TString(parameterIndex, value));
}
@Override
public void setBytes(int parameterIndex, byte[] x) {
capture.add(new BindCaptureTypes.Bytes(parameterIndex, x));
public void setBytes(int parameterIndex, byte[] value) {
capture.add(new BindCaptureTypes.Bytes(parameterIndex, value));
}
@Override
public void setDate(int parameterIndex, Date x) {
capture.add(new BindCaptureTypes.TDate(parameterIndex, x));
public void setDate(int parameterIndex, Date value) {
capture.add(new BindCaptureTypes.TDate(parameterIndex, value));
}
@Override
public void setTime(int parameterIndex, Time x) {
capture.add(new BindCaptureTypes.TTime(parameterIndex, x));
public void setTime(int parameterIndex, Time value) {
capture.add(new BindCaptureTypes.TTime(parameterIndex, value));
}
@Override
public void setTimestamp(int parameterIndex, Timestamp x) {
capture.add(new BindCaptureTypes.TTimestamp(parameterIndex, x, null));
public void setTimestamp(int parameterIndex, Timestamp value) {
capture.add(new BindCaptureTypes.TTimestamp(parameterIndex, value, null));
}
@Override
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) {
capture.add(new BindCaptureTypes.TTimestamp(parameterIndex, x, cal));
public void setTimestamp(int parameterIndex, Timestamp value, Calendar cal) {
capture.add(new BindCaptureTypes.TTimestamp(parameterIndex, value, cal));
}
@Override
public void setObject(int parameterIndex, Object x) {
capture.add(new BindCaptureTypes.TObject(parameterIndex, x));
public void setObject(int parameterIndex, Object value) {
capture.add(new BindCaptureTypes.TObject(parameterIndex, value));
}
@Override
public void setBinaryStream(int parameterIndex, InputStream x, int length) {
public void setBinaryStream(int parameterIndex, InputStream value, int length) {
capture.add(new BindCaptureTypes.BinaryStream(parameterIndex));
}
@Override
public void setCharacterStream(int parameterIndex, Reader reader, int length) {
public void setCharacterStream(int parameterIndex, Reader value, int length) {
capture.add(new BindCaptureTypes.CharacterStream(parameterIndex));
}
@@ -160,6 +160,8 @@ public final class DefaultContainer implements SpiContainer {
*/
private BootupClasses bootupClasses(DatabaseConfig config) {
BootupClasses bootup = bootupClasses1(config);
bootup.addServerConfigStartup(config.getServerConfigStartupListeners());
bootup.runServerConfigStartup(config);
bootup.addIdGenerators(config.getIdGenerators());
bootup.addPersistControllers(config.getPersistControllers());
bootup.addPostLoaders(config.getPostLoaders());
@@ -167,9 +169,7 @@ public final class DefaultContainer implements SpiContainer {
bootup.addFindControllers(config.getFindControllers());
bootup.addPersistListeners(config.getPersistListeners());
bootup.addQueryAdapters(config.getQueryAdapters());
bootup.addServerConfigStartup(config.getServerConfigStartupListeners());
bootup.addChangeLogInstances(config);
bootup.runServerConfigStartup(config);
return bootup;
}
@@ -307,7 +307,10 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
*/
public void start() {
if (config.isRunMigration() && TenantMode.DB != config.getTenantMode()) {
final AutoMigrationRunner migrationRunner = ServiceUtil.service(AutoMigrationRunner.class);
AutoMigrationRunner migrationRunner = config.getServiceObject(AutoMigrationRunner.class);
if (migrationRunner == null) {
migrationRunner = ServiceUtil.service(AutoMigrationRunner.class);
}
if (migrationRunner == null) {
throw new IllegalStateException("No AutoMigrationRunner found. Probably ebean-migration is not in the classpath?");
}
@@ -1088,7 +1091,13 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public <T> Set<T> findSet(Query<T> query, Transaction transaction) {
SpiOrmQueryRequest request = createQueryRequest(Type.SET, query, transaction);
SpiOrmQueryRequest request = buildQueryRequest(Type.SET, query, transaction);
request.resetBeanCacheAutoMode(false);
if ((transaction == null || !transaction.isSkipCache()) && request.getFromBeanCache()) {
// hit bean cache and got all results from cache
return request.beanCacheHitsAsSet();
}
request.prepareQuery();
Object result = request.getFromQueryCache();
if (result != null) {
return (Set<T>) result;
@@ -1104,12 +1113,13 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public <K, T> Map<K, T> findMap(Query<T> query, @Nullable Transaction transaction) {
SpiOrmQueryRequest request = createQueryRequest(Type.MAP, query, transaction);
SpiOrmQueryRequest request = buildQueryRequest(Type.MAP, query, transaction);
request.resetBeanCacheAutoMode(false);
if ((transaction == null || !transaction.isSkipCache()) && request.getFromBeanCache()) {
// hit bean cache and got all results from cache
return request.beanCacheHitsAsMap();
}
request.prepareQuery();
Object result = request.getFromQueryCache();
if (result != null) {
return (Map<K, T>) result;
@@ -117,7 +117,10 @@ final class InitDataSource {
* Attach DataSourceAlert via service loader if present.
*/
private void attachAlert(DataSourceConfig dsConfig) {
DataSourceAlertFactory alertFactory = ServiceUtil.service(DataSourceAlertFactory.class);
DataSourceAlertFactory alertFactory = config.getServiceObject(DataSourceAlertFactory.class);
if (alertFactory == null) {
alertFactory = ServiceUtil.service(DataSourceAlertFactory.class);
}
if (alertFactory != null) {
dsConfig.setAlert(alertFactory.createAlert());
}
@@ -144,7 +144,12 @@ public final class InternalConfiguration {
}
private <S> S service(Class<S> cls) {
return ServiceUtil.service(cls);
S service = config.getServiceObject(cls);
if (service != null) {
return service;
} else {
return ServiceUtil.service(cls);
}
}
private List<XmapEbean> readExternalMapping() {
@@ -515,12 +515,12 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
if (query.getType() == Type.MAP) {
mergeCacheHitsToMap(result);
} else {
mergeCacheHitsToList(result);
mergeCacheHitsToCollection(result);
}
}
}
private void mergeCacheHitsToList(BeanCollection<T> result) {
private void mergeCacheHitsToCollection(BeanCollection<T> result) {
for (T hit : cacheBeans) {
result.internalAdd(hit);
}
@@ -579,6 +579,15 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
return property;
}
@Override
public Set<T> beanCacheHitsAsSet() {
OrderBy<T> orderBy = query.getOrderBy();
if (orderBy != null && !orderBy.isEmpty()) {
beanDescriptor.sort(cacheBeans, orderBy.toStringFormat());
}
return new LinkedHashSet<>(cacheBeans);
}
@Override
public boolean getFromBeanCache() {
if (!query.isBeanCacheGet()) {
@@ -153,6 +153,11 @@ public interface SpiOrmQueryRequest<T> extends BeanQueryRequest<T>, DocQueryRequ
*/
<K> Map<K,T> beanCacheHitsAsMap();
/**
* Return the bean cache hits for findMap (when all hits / no misses).
*/
Set<T> beanCacheHitsAsSet();
/**
* Reset Bean cache mode AUTO - require explicit setting for bean cache use with findList().
*/
@@ -342,8 +342,9 @@ public class BootupClasses implements Predicate<Class<?>> {
*/
@SuppressWarnings("unchecked")
private boolean isInterestingInterface(Class<?> cls) {
if (Modifier.isAbstract(cls.getModifiers())) {
// do not include abstract classes as we can
if (Modifier.isAbstract(cls.getModifiers())
|| !(Modifier.isPublic(cls.getModifiers()) || Modifier.isProtected(cls.getModifiers()))) {
// do not include abstract and non pupbic/protected classes as we can
// not instantiate them
return false;
}
@@ -65,7 +65,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
/**
* Flag to mark this is the id property.
*/
private final boolean id;
protected final boolean id;
private final boolean importedPrimaryKey;
/**
* Flag to make this as a dummy property for unidirecitonal relationships.
@@ -655,7 +655,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
@Override
public void setValue(EntityBean bean, Object value) {
super.setValue(bean, value);
if (embedded && value instanceof EntityBean) {
if (!id && embedded && value instanceof EntityBean) {
setEmbeddedOwner(bean, value);
}
}
@@ -663,7 +663,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
@Override
public void setValueIntercept(EntityBean bean, Object value) {
super.setValueIntercept(bean, value);
if (embedded && value instanceof EntityBean) {
if (!id && embedded && value instanceof EntityBean) {
setEmbeddedOwner(bean, value);
}
}
@@ -675,8 +675,10 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
Object emb = getValue(owner);
if (emb != null) {
EntityBean embeddedBean = (EntityBean) emb;
embeddedBean._ebean_getIntercept().setEmbeddedOwner(owner, propertyIndex);
targetDescriptor.setAllLoaded(embeddedBean);
if (!id) {
embeddedBean._ebean_getIntercept().setEmbeddedOwner(owner, propertyIndex);
}
}
}
@@ -1123,7 +1123,7 @@ public class DeployBeanProperty {
private boolean matchPlatform(Platform[] platforms, Platform match) {
for (Platform platform : platforms) {
if (platform == match) {
if (platform == match || platform == match.base()) {
return true;
}
}
@@ -14,17 +14,13 @@ import java.util.*;
public final class InExpression extends AbstractExpression implements IdInCommon {
private final boolean not;
/**
* Set to true when adding "1=1" predicate (due to null or empty sourceValues).
*/
private final boolean empty;
private final boolean not;
private final Collection<?> sourceValues;
private List<Object> bindValues;
private boolean multiValueSupported;
InExpression(String propertyName, Collection<?> sourceValues, boolean not) {
@@ -95,7 +91,7 @@ public final class InExpression extends AbstractExpression implements IdInCommon
public void prepareExpression(BeanQueryRequest<?> request) {
initBindValues();
if (bindValues.size() > 0) {
multiValueSupported = request.isMultiValueSupported((bindValues.get(0)).getClass());
multiValueSupported = request.isMultiValueSupported(bindValues.get(0).getClass());
}
}
@@ -117,7 +113,6 @@ public final class InExpression extends AbstractExpression implements IdInCommon
}
}
ElPropertyValue prop = getElProp(request);
List<Object> values = bindValues;
if (prop != null && prop.isAssocId()) {
values = new ArrayList<>();
@@ -132,24 +127,23 @@ public final class InExpression extends AbstractExpression implements IdInCommon
if (values.isEmpty()) {
// nothing in in-query
return;
} else if (prop.isDbEncrypted()) {
// bind the key as well as the value
String encryptKey = prop.beanProperty().encryptKey().getStringValue();
request.addBindEncryptKey(encryptKey);
} else if (prop.isLocalEncrypted()) {
List<Object> encValues = new ArrayList<>(values.size());
for (Object value : values) {
encValues.add(prop.localEncrypt(value));
}
// this is most likely binary garbage, so don't add it to the bind log
request.addBindEncryptKey(new MultiValueWrapper(encValues));
return;
}
// if we have no property, we wrap them in a multi value wrapper.
// later the binder will decide, which bind strategy to use.
if (prop != null) {
if (prop.isDbEncrypted()) {
// bind the key as well as the value
request.addBindEncryptKey(prop.beanProperty().encryptKey().getStringValue());
} else if (prop.isLocalEncrypted()) {
List<Object> encValues = new ArrayList<>(values.size());
for (Object value : values) {
encValues.add(prop.localEncrypt(value));
}
// this is most likely binary garbage, so don't add it to the bind log
request.addBindEncryptKey(new MultiValueWrapper(encValues));
return;
}
}
// wrap in a multi value wrapper, later the binder will decide the bind strategy to use
request.addBindValue(new MultiValueWrapper(values));
}
@Override
@@ -164,7 +158,6 @@ public final class InExpression extends AbstractExpression implements IdInCommon
}
ElPropertyValue prop = getElProp(request);
if (prop != null) {
if (prop.isAssocId()) {
request.append(prop.assocIdInExpr(propName));
@@ -172,15 +165,13 @@ public final class InExpression extends AbstractExpression implements IdInCommon
return;
}
if (prop.isDbEncrypted()) {
String dsql = prop.beanProperty().decryptProperty(propName);
request.append(dsql);
request.append(prop.beanProperty().decryptProperty(propName));
request.appendInExpression(not, bindValues);
return;
}
}
request.append(propName);
request.appendInExpression(not, bindValues);
}
/**
@@ -7,25 +7,7 @@ import io.ebeaninternal.server.bind.DataBind;
import java.sql.SQLException;
import java.util.Collection;
import static java.sql.Types.BIGINT;
import static java.sql.Types.BIT;
import static java.sql.Types.BOOLEAN;
import static java.sql.Types.CHAR;
import static java.sql.Types.DATE;
import static java.sql.Types.DECIMAL;
import static java.sql.Types.DOUBLE;
import static java.sql.Types.FLOAT;
import static java.sql.Types.INTEGER;
import static java.sql.Types.NCHAR;
import static java.sql.Types.NUMERIC;
import static java.sql.Types.NVARCHAR;
import static java.sql.Types.REAL;
import static java.sql.Types.SMALLINT;
import static java.sql.Types.TIMESTAMP;
import static java.sql.Types.TIMESTAMP_WITH_TIMEZONE;
import static java.sql.Types.TIME_WITH_TIMEZONE;
import static java.sql.Types.TINYINT;
import static java.sql.Types.VARCHAR;
import static java.sql.Types.*;
/**
* Base MultiValueBind for platform specific support.
@@ -86,6 +68,8 @@ abstract class AbstractMultiValueBind extends MultiValueBind {
case ExtraDbTypes.UUID: // Postgres cast to uuid[]
case ExtraDbTypes.INET: // Postgres cast to inet[]
return "varchar";
case VARBINARY:
return "bytea";
default:
return null;
@@ -17,7 +17,7 @@ public class MultiValueBind {
}
Object[] toArray(Collection<?> values, ScalarType<?> type) {
Object[] array = new Object[values.size()];
Object[] array = type.binary() ? new byte[values.size()][] : new Object[values.size()];
int i = 0;
for (Object value : values) {
array[i++] = type.toJdbcType(value);
@@ -396,7 +396,7 @@ final class CQueryBuilder {
sql = nativeQueryPaging(query, sql);
}
query.setGeneratedSql(sql);
Connection connection = request.transaction().connection();
Connection connection = request.transaction().getInternalConnection();
BeanDescriptor<?> desc = request.descriptor();
try {
// For SqlServer we need either "selectMethod=cursor" in the connection string or fetch explicitly a cursorable
@@ -129,6 +129,26 @@ public final class DefaultDtoQuery<T> extends AbstractQuery implements SpiDtoQue
return Optional.ofNullable(findOne());
}
@Override
public DtoQuery<T> setNullParameter(String name, int jdbcType) {
if (ormQuery != null) {
ormQuery.initBindParams().setNullParameter(name, jdbcType);
} else {
bindParams.setNullParameter(name, jdbcType);
}
return this;
}
@Override
public DtoQuery<T> setNullParameter(int position, int jdbcType) {
if (ormQuery != null) {
ormQuery.initBindParams().setNullParameter(position, jdbcType);
} else {
bindParams.setNullParameter(position, jdbcType);
}
return this;
}
@Override
public DtoQuery<T> setParameter(int position, Object value) {
if (ormQuery != null) {
@@ -1544,19 +1544,13 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
@Override
public final Query<T> setParameter(Object value) {
if (bindParams == null) {
bindParams = new BindParams();
}
bindParams.setNextParameter(value);
initBindParams().setNextParameter(value);
return this;
}
@Override
public final Query<T> setParameters(Object... values) {
if (bindParams == null) {
bindParams = new BindParams();
}
bindParams.setNextParameters(values);
initBindParams().setNextParameters(values);
return this;
}
@@ -1567,10 +1561,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
*/
@Override
public final Query<T> setParameter(int position, Object value) {
if (bindParams == null) {
bindParams = new BindParams();
}
bindParams.setParameter(position, value);
initBindParams().setParameter(position, value);
return this;
}
@@ -1586,10 +1577,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
return this;
}
}
if (bindParams == null) {
bindParams = new BindParams();
}
bindParams.setParameter(name, value);
initBindParams().setParameter(name, value);
return this;
}
@@ -1598,10 +1586,7 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
if (namedParams != null) {
throw new IllegalStateException("setArrayParameter() not supported when EQL parsed query");
}
if (bindParams == null) {
bindParams = new BindParams();
}
bindParams.setArrayParameter(name, values);
initBindParams().setArrayParameter(name, values);
}
@Override
@@ -1789,6 +1774,14 @@ public class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<T> {
return bindParams;
}
@Override
public BindParams initBindParams() {
if (bindParams == null) {
bindParams = new BindParams();
}
return bindParams;
}
@Override
public final Query<T> where(Expression expression) {
where().add(expression);
@@ -35,7 +35,7 @@ abstract class TransactionFactory {
*/
final SpiTransaction setIsolationLevel(SpiTransaction t, boolean explicit, int isolationLevel) {
if (isolationLevel > -1) {
Connection connection = t.connection();
Connection connection = t.getInternalConnection();
try {
connection.setTransactionIsolation(isolationLevel);
} catch (SQLException e) {
@@ -111,7 +111,10 @@ public final class DefaultTypeManager implements TypeManager {
}
private void loadGeoTypeBinder(DatabaseConfig config) {
final GeoTypeProvider provider = ServiceUtil.service(GeoTypeProvider.class);
GeoTypeProvider provider = config.getServiceObject(GeoTypeProvider.class);
if (provider == null) {
provider = ServiceUtil.service(GeoTypeProvider.class);
}
if (provider != null) {
geoTypeBinder = provider.createBinder(config);
}
@@ -65,8 +65,8 @@ class BasePlatformArrayTypeFactoryTest {
}
@Override
public void setString(String s) {
setEmptyString = "[]".equals(s);
public void setString(String value) {
setEmptyString = "[]".equals(value);
}
@Override
+4 -4
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-csv-reader</artifactId>
@@ -14,21 +14,21 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
+4 -4
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean ddl generation</name>
@@ -28,14 +28,14 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
@@ -58,7 +58,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-all</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean external mapping api</name>
+6 -6
View File
@@ -4,12 +4,12 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<scm>
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
<name>ebean external mapping xml</name>
@@ -21,7 +21,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -54,21 +54,21 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-ddl-generator</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
+2 -2
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-jackson-jsonnode</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
+2 -2
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -14,7 +14,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
+2 -2
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -14,7 +14,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
+3 -3
View File
@@ -6,7 +6,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1-SNAPSHOT</version>
<version>13.11.1-SNAPSHOT</version>
</parent>
<artifactId>ebean-kotlin</artifactId>
@@ -28,7 +28,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1-SNAPSHOT</version>
<version>13.11.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@@ -50,7 +50,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.10.1-SNAPSHOT</version>
<version>13.11.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
+5 -5
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean postgis</name>
@@ -22,14 +22,14 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<!-- provided scope -->
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
@@ -50,7 +50,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.0</version>
<version>42.5.1</version>
<scope>provided</scope>
</dependency>
@@ -65,7 +65,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
+5 -5
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean querybean</name>
@@ -17,7 +17,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
@@ -63,21 +63,21 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-ddl-generator</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>querybean-generator</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
@@ -3,6 +3,8 @@ package org.example.domain;
import io.ebean.annotation.DbArray;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
@@ -16,7 +18,11 @@ import java.util.Map;
public class Contact extends BaseModel {
@DbArray
List<String> phoneNumbers = new ArrayList<>();
List<@Size(max=20) String> phoneNumbers = new ArrayList<>();
@ElementCollection
@Size(max=10)
List<@Size(max=20) String> paths;
@Column(length = 50)
String firstName;
@@ -36,7 +42,7 @@ public class Contact extends BaseModel {
Customer customer;
@OneToMany(mappedBy = "contact")
List<ContactNote> notes;
List<@NotNull ContactNote> notes;
@OneToMany(cascade = CascadeType.PERSIST)
@MapKey(name = "key")
@@ -6,8 +6,8 @@ datasource.default=h2
datasource.h2.username=sa
datasource.h2.password=
datasource.h2.url=jdbc:h2:mem:tests;NON_KEYWORDS=KEY
datasource.h2.url=jdbc:h2:mem:tests;NON_KEYWORDS=KEY,VALUE
datasource.pg.username=sa
datasource.pg.password=
datasource.pg.url=jdbc:h2:mem:tests;NON_KEYWORDS=KEY
datasource.pg.url=jdbc:h2:mem:tests;NON_KEYWORDS=KEY,VALUE
+6 -6
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-redis</artifactId>
@@ -22,35 +22,35 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>querybean-generator</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
+9 -9
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>ebean test</name>
@@ -28,20 +28,20 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-ddl-generator</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -105,28 +105,28 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-joda-time</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-jackson-jsonnode</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-jackson-mapper</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-all</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
@@ -183,7 +183,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.0</version>
<version>42.5.1</version>
<exclusions>
<exclusion>
<groupId>org.checkerframework</groupId>
@@ -18,6 +18,7 @@ import org.tests.model.basic.Customer;
import org.tests.model.basic.EBasicLog;
import org.tests.model.basic.ResetBasicData;
import java.sql.Types;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
@@ -366,6 +367,38 @@ class DtoQueryTest extends BaseTestCase {
assertThat(list).isNotEmpty();
}
@ForPlatform(Platform.H2)
@Test
void dto3_setNullByPosition() {
ResetBasicData.reset();
List<DCust3> robs = server().findDto(DCust3.class, "select id, name, nvl(cast(? as int), 42) as totalOrders from o_customer where name like ?")
.setNullParameter(1, Types.INTEGER)
.setParameter(2, "Rob")
.setMaxRows(10)
.findList();
log.info(robs.toString());
assertThat(robs).isNotEmpty();
assertThat(robs.get(0).getTotalOrders()).isEqualTo(42);
}
@ForPlatform(Platform.H2)
@Test
void dto3_setNullByName() {
ResetBasicData.reset();
List<DCust3> robs = server().findDto(DCust3.class, "select id, name, nvl(cast(:foo as int), 42) as totalOrders from o_customer where name like :bar")
.setNullParameter("foo", Types.INTEGER)
.setParameter("bar", "Rob")
.setMaxRows(10)
.findList();
log.info(robs.toString());
assertThat(robs).isNotEmpty();
assertThat(robs.get(0).getTotalOrders()).isEqualTo(42);
}
@Test
void dto3_findList_constructorMatch() {
ResetBasicData.reset();
@@ -4,13 +4,53 @@ import io.ebean.Database;
import io.ebean.DatabaseFactory;
import io.ebean.config.DatabaseConfig;
import io.ebean.event.ServerConfigStartup;
import io.ebeaninternal.api.SpiLogger;
import io.ebeaninternal.api.SpiLoggerFactory;
import org.junit.jupiter.api.Test;
import org.tests.model.basic.UTDetail;
import java.util.HashSet;
import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat;
public class EbeanServerFactory_ServerConfigStart_Test {
/**
* Demo, how to intercept logging for a certain database.
* In conjunction to ServiceLoader, you can add different loggers to different databases
*/
private static class MySpiLoggerFactory implements SpiLoggerFactory {
Set<String> loggers = new HashSet<>();
@Override
public SpiLogger create(String name) {
loggers.add(name);
// just return a dummy here
return new SpiLogger() {
@Override
public boolean isDebug() {
return false;
}
@Override
public boolean isTrace() {
return false;
}
@Override
public void debug(String msg) {
}
@Override
public void trace(String msg) {
}
};
}
}
@Test
public void test() throws InterruptedException {
@@ -30,9 +70,13 @@ public class EbeanServerFactory_ServerConfigStart_Test {
// act - register an instance
OnStartup onStartup = new OnStartup();
config.addServerConfigStartup(onStartup);
MySpiLoggerFactory loggerFactory = new MySpiLoggerFactory();
config.putServiceObject(SpiLoggerFactory.class, loggerFactory);
Database db = DatabaseFactory.create(config);
assertThat(loggerFactory.loggers).containsExactlyInAnyOrder("io.ebean.SQL", "io.ebean.SUM", "io.ebean.TXN");
assertThat(onStartup.calledWithConfig).isSameAs(config);
assertThat(OnStartupViaClass.calledWithConfig).isSameAs(config);
@@ -15,7 +15,6 @@ import org.tests.model.basic.ECustomId;
import org.tests.model.controller.FindControllerMain;
import org.tests.model.controller.SoftRefA;
import org.tests.model.controller.SoftRefB;
import org.tests.model.controller.TestBeanFindController;
import java.util.List;
@@ -1,16 +1,17 @@
package org.tests.model.controller;
package io.ebean.xtest.event;
import io.ebean.bean.BeanCollection;
import io.ebean.event.BeanFindController;
import io.ebean.event.BeanQueryRequest;
import io.ebean.plugin.BeanType;
import org.tests.model.controller.FindControllerMain;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TestBeanFindController implements BeanFindController {
class TestBeanFindController implements BeanFindController {
@Override
public boolean isRegisterFor(final Class<?> cls) {
@@ -1,8 +1,10 @@
package org.tests.basic;
import io.ebean.annotation.Platform;
import io.ebean.xtest.BaseTestCase;
import io.ebean.DB;
import io.ebean.Query;
import io.ebean.xtest.IgnorePlatform;
import org.junit.jupiter.api.Test;
import org.tests.model.basic.Order;
import org.tests.model.basic.ResetBasicData;
@@ -22,6 +24,7 @@ public class TestLimitQuery extends BaseTestCase {
rob();
}
@IgnorePlatform({Platform.MYSQL, Platform.MARIADB})
@Test
public void testMaxRowsZeroWithFirstRow() {
@@ -40,7 +43,7 @@ public class TestLimitQuery extends BaseTestCase {
String sql = query.getGeneratedSql();
if (isH2()) {
assertThat(sql).contains("offset 3");
assertThat(sql).contains("limit 0");
assertThat(sql).doesNotContain("limit");
}
}
@@ -1,8 +1,11 @@
package org.tests.basic;
import io.ebean.xtest.BaseTestCase;
import io.ebean.DB;
import io.ebean.DatabaseFactory;
import io.ebean.QueryIterator;
import io.ebean.Transaction;
import io.ebean.config.DatabaseConfig;
import io.ebean.xtest.BaseTestCase;
import io.ebeaninternal.api.SpiPersistenceContext;
import io.ebeaninternal.api.SpiTransaction;
import org.junit.jupiter.api.Disabled;
@@ -12,15 +15,17 @@ import org.tests.model.basic.Customer;
import org.tests.model.basic.Order;
import org.tests.model.basic.ResetBasicData;
import java.util.ArrayList;
import java.util.List;
import java.util.WeakHashMap;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.validation.constraints.Size;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
class TestPersistenceContext extends BaseTestCase {
public class TestPersistenceContext extends BaseTestCase {
@Test
void testReload() {
@@ -191,29 +196,135 @@ class TestPersistenceContext extends BaseTestCase {
}
}
@Disabled // run manually
@Test
void testPcScopes_with_findEachFindList() {
for (int i = 0; i < 5000; i++) {
Customer c = new Customer();
c.setName("Customer #" + i);
DB.save(c);
Order o = new Order();
o.setCustomer(c);
DB.save(o);
@Embeddable
public static class TmId {
private final UUID id1;
private final UUID id2;
public TmId(UUID id1, UUID id2) {
this.id1 = id1;
this.id2 = id2;
}
for (int i = 0; i < 1000; i++) {
try (Transaction txn = DB.beginTransaction()) {
List<Customer> customers = new ArrayList<>();
DB.find(Customer.class).select("id").findEach(customers::add);
SpiPersistenceContext pc = ((SpiTransaction) txn).getPersistenceContext();
assertThat(pc.toString()).contains("Customer=size:5000 (5000 weak)");
customers.clear();
customers = DB.find(Customer.class).select("id").findList();
public UUID getId1() {
return id1;
}
assertThat(pc.toString()).contains("Customer=size:5000"); // We expect ALWAYS 5000 entries in the PC
}
public UUID getId2() {
return id2;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TmId tmId = (TmId) o;
return Objects.equals(id1, tmId.id1) && Objects.equals(id2, tmId.id2);
}
@Override
public int hashCode() {
return Objects.hash(id1, id2);
}
}
@Entity
// @Cache(enableQueryCache = true, enableBeanCache = false)
public static class TestModel2 {
@EmbeddedId
private TmId id;
@Size(max = 255)
private String someData;
public String getSomeData() {
return someData;
}
public void setSomeData(String someData) {
this.someData = someData;
}
public TmId getId() {
return id;
}
public void setId(TmId id) {
this.id = id;
}
}
@Test
@Disabled
void initDb() {
DatabaseConfig config = new DatabaseConfig();
config.setName("h2-batch");
config.loadFromProperties();
config.setDdlExtra(false);
config.getDataSourceConfig().setUsername("sa");
config.getDataSourceConfig().setPassword("sa");
config.getDataSourceConfig().setUrl("jdbc:h2:file:./testsFile3;DB_CLOSE_ON_EXIT=FALSE;NON_KEYWORDS=KEY,VALUE");
config.addClass(TestModel2.class);
config.addClass(TmId.class);
DatabaseFactory.create(config);
String base = "x".repeat(240);
// 10 mio TestModel - each needs about 1/4 kbytes -> 2,5 GB in total
List<TestModel2> batch = new ArrayList<>();
for (int i = 0; i < 1_000_000; i++) {
TestModel2 m = new TestModel2();
TmId id = new TmId(UUID.randomUUID(), UUID.randomUUID());
m.setId(id);
m.setSomeData(base + i); // ensure we have not duplicates
batch.add(m);
if (i % 1000 == 0) {
DB.saveAll(batch);
batch.clear();
}
if (i % 100000 == 0) {
System.out.println(i);
}
}
DB.saveAll(batch);
}
@Test
@Disabled
void testFindEachFindList() {
DatabaseConfig config = new DatabaseConfig();
config.setName("h2-batch");
config.loadFromProperties();
config.setDdlRun(false);
config.getDataSourceConfig().setUsername("sa");
config.getDataSourceConfig().setPassword("sa");
config.getDataSourceConfig().setUrl("jdbc:h2:file:./testsFile3;DB_CLOSE_ON_EXIT=FALSE;NON_KEYWORDS=KEY,VALUE");
config.addClass(TestModel2.class);
config.addClass(TmId.class);
DatabaseFactory.create(config);
AtomicInteger i = new AtomicInteger();
System.out.println("Doing findEach");
DB.find(TestModel2.class).select("*").findEach(c -> {
i.incrementAndGet();
});
System.out.println("Read " + i + " entries");
i.set(0);
System.out.println("Doing findStream");
DB.find(TestModel2.class).select("*").findStream().forEach(c -> i.incrementAndGet());
System.out.println("Read " + i + " entries");
i.set(0);
System.out.println("Doing findIterate");
QueryIterator<TestModel2> iter = DB.find(TestModel2.class).select("*").findIterate();
while (iter.hasNext()) {
iter.next();
i.incrementAndGet();
}
System.out.println("Read " + i + " entries");
System.out.println("Doing FindList, will hold all entries in memory. Expect OOM with -Xmx100m.");
List<TestModel2> lst = DB.find(TestModel2.class).select("*").findList();
System.out.println("Read " + lst.size() + " entries");
}
}
@@ -5,6 +5,7 @@ import io.ebean.xtest.BaseTestCase;
import io.ebean.xtest.ForPlatform;
import io.ebean.annotation.Platform;
import io.ebean.test.LoggedSql;
import io.ebean.xtest.IgnorePlatform;
import org.junit.jupiter.api.Test;
import org.tests.model.basic.Customer;
import org.tests.model.basic.EBasic;
@@ -19,7 +20,6 @@ import static org.junit.jupiter.api.Assertions.*;
public class TestQueryForUpdate extends BaseTestCase {
@Test
@ForPlatform({Platform.H2, Platform.ORACLE, Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB})
public void testForUpdate() {
ResetBasicData.reset();
@@ -35,13 +35,35 @@ public class TestQueryForUpdate extends BaseTestCase {
if (isSqlServer()) {
assertThat(sqlOf(query)).contains("with (updlock)");
} else {
} else if (!isDb2()){
assertThat(sqlOf(query)).contains("for update");
}
}
@Test
@ForPlatform({ Platform.H2, Platform.ORACLE, Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB})
public void testForUpdate_withLimit() {
ResetBasicData.reset();
Query<Customer> query;
try (final Transaction transaction = DB.beginTransaction()) {
query = DB.find(Customer.class)
.forUpdate()
.setMaxRows(3)
.order().desc("id");
query.findList();
}
if (isSqlServer()) {
assertThat(sqlOf(query)).contains("with (updlock)");
} else if (!isOracle() && !isDb2()) {
// Oracle does not support FOR UPDATE with FETCH
assertThat(sqlOf(query)).contains("for update");
}
}
@Test
@ForPlatform({Platform.H2, Platform.ORACLE, Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB})
public void testForUpdate_when_alreadyInPCAsReference() {
ResetBasicData.reset();
Order o0 = DB.find(Order.class).orderBy("id").setMaxRows(1).findOne();
@@ -75,7 +97,7 @@ public class TestQueryForUpdate extends BaseTestCase {
}
@Test
@ForPlatform({ Platform.H2, Platform.ORACLE, Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB})
@ForPlatform({Platform.H2, Platform.ORACLE, Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB})
public void testForUpdate_when_alreadyInPCAsReference_usingLock() {
ResetBasicData.reset();
Order o0 = DB.find(Order.class).orderBy("id").setMaxRows(1).findOne();
@@ -110,7 +132,7 @@ public class TestQueryForUpdate extends BaseTestCase {
}
@Test
@ForPlatform({ Platform.H2, Platform.ORACLE, Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB})
@ForPlatform({Platform.H2, Platform.ORACLE, Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB})
public void testForUpdate_when_alreadyInPC() {
EBasic basic = new EBasic("test PC cache");
@@ -124,7 +146,7 @@ public class TestQueryForUpdate extends BaseTestCase {
assertThat(basic0).isNotNull();
EBasic basic1 = DB.find(EBasic.class)
.setId( basic.getId())
.setId(basic.getId())
.forUpdate()
.findOne();
+108 -3
View File
@@ -1,11 +1,12 @@
package org.tests.cache;
import io.ebean.xtest.BaseTestCase;
import io.ebean.DB;
import io.ebean.Query;
import io.ebean.Transaction;
import io.ebean.cache.ServerCache;
import io.ebean.cache.ServerCacheStatistics;
import io.ebean.test.LoggedSql;
import io.ebean.xtest.BaseTestCase;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -15,6 +16,7 @@ import org.tests.model.basic.OCachedBean;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
@@ -54,10 +56,39 @@ public class TestBeanCache extends BaseTestCase {
assertThat(sql).isEmpty();
}
@Test
public void idsInFindMap() {
List<OCachedBean> beans = createBeans(Arrays.asList("m0", "m1", "m2", "m3", "m4", "m5", "m6"));
List<Long> ids = beans.stream().map(OCachedBean::getId).collect(Collectors.toList());
beanCache.clear();
beanCache.statistics(true);
Query<OCachedBean> query = DB.find(OCachedBean.class).setUseCache(true);
// Test findIds
LoggedSql.start();
query.copy()
.where().idIn(ids.subList(0, 1))
.findMap(); // cache key is: 3/d[{/c1000}]/w[List[IdIn[?1],]]
assertThat(LoggedSql.stop().get(0)).contains("in (?)");
LoggedSql.start();
query.copy()
.where().idIn(ids.subList(0, 4))
.findMap(); // cache key is: 3/d[{/c1000}]/w[List[IdIn[?5],]]
assertThat(LoggedSql.stop().get(0)).contains("in (?,?,?,?,?)");
LoggedSql.start();
query.copy()
.where().idIn(ids.subList(2, 6))
.findMap(); // same cache key as above and same SQL above
assertThat(LoggedSql.stop().get(0)).contains("in (?,?,?,?,?)");
}
@Test
public void idsIn_explicitCache_expect_cachePut() {
List<OCachedBean> beans = createBeans(Arrays.asList("k0","k1"));
List<OCachedBean> beans = createBeans(Arrays.asList("k0", "k1"));
List<Long> ids = beans.stream().map(OCachedBean::getId).collect(Collectors.toList());
beanCache.clear();
@@ -157,6 +188,80 @@ public class TestBeanCache extends BaseTestCase {
}
}
@Test
public void testFindSet() {
List<OCachedBean> beans = createBeans(Arrays.asList("z0", "z1", "z2"));
List<Long> ids = beans.stream().map(OCachedBean::getId).collect(Collectors.toList());
beanCache.clear();
beanCache.statistics(true);
LoggedSql.start();
log.info("All misses (0 of 3) ...");
Set<OCachedBean> set = DB.find(OCachedBean.class)
.where().idIn(ids)
.setUseCache(true)
.findSet();
assertThat(set).hasSize(3);
assertBeanCacheHitMiss(0, 3);
List<String> sql = LoggedSql.collect();
assertThat(sql).hasSize(1);
if (isH2()) {
assertSql(sql.get(0)).contains("from o_cached_bean t0 where t0.id in (?,?,?,?,?)");
}
log.info("All hits (3 of 3) ...");
set = DB.find(OCachedBean.class)
.where().idIn(ids)
.setUseCache(true)
.findSet();
assertBeanCacheHitMiss(3, 0);
assertThat(set).hasSize(3);
sql = LoggedSql.collect();
assertThat(sql).hasSize(0); // no misses
// remove a bean so that we get a "partial" hit (2 out of 3 in cache)
beanCache.remove(beans.get(0).getId().toString());
log.info("Partial hits (2 of 3) ...");
set = DB.find(OCachedBean.class)
.where().idIn(ids)
.setUseCache(true)
.findSet();
assertBeanCacheHitMiss(2, 1);
assertThat(set).hasSize(3);
sql = LoggedSql.collect();
assertThat(sql).hasSize(1);
if (isH2()) {
// fetch the miss from DB
assertSql(sql.get(0)).contains("from o_cached_bean t0 where t0.id in (?)");
}
// remove beans so that we get a "partial" hit (1 out of 3 in cache)
beanCache.remove(beans.get(1).getId().toString());
beanCache.remove(beans.get(2).getId().toString());
log.info("Partial hits (1 of 3) ...");
set = DB.find(OCachedBean.class)
.where().idIn(ids)
.setUseCache(true)
.findSet();
assertBeanCacheHitMiss(1, 2);
assertThat(set).hasSize(3);
sql = LoggedSql.stop();
assertThat(sql).hasSize(1);
if (isH2()) {
// fetch the misses from DB
assertSql(sql.get(0)).contains("from o_cached_bean t0 where t0.id in (?,?,?,?,?)");
}
}
private void assertBeanCacheHitMiss(int hitCount, int missCount) {
ServerCacheStatistics statistics = beanCache.statistics(true);
assertThat(statistics.getHitCount()).isEqualTo(hitCount);
@@ -183,7 +288,7 @@ public class TestBeanCache extends BaseTestCase {
Country country = DB.find(Country.class)
.where()
.eq("name","NotValid")
.eq("name", "NotValid")
.findOne();
assertThat(country).isNull();
@@ -3,6 +3,8 @@ package org.tests.cache;
import io.ebean.CacheMode;
import io.ebean.DB;
import io.ebean.ExpressionList;
import io.ebean.annotation.Transactional;
import io.ebean.annotation.TxIsolation;
import io.ebean.bean.BeanCollection;
import io.ebean.cache.ServerCache;
import io.ebean.test.LoggedSql;
@@ -159,6 +161,32 @@ public class TestQueryCache extends BaseTestCase {
assertThat(count2).isEqualTo(count1);
sql = LoggedSql.stop();
assertThat(sql).hasSize(1);
LoggedSql.start();
findCountNoTxn();
sql = LoggedSql.stop();
assertThat(sql).hasSize(0);
// Oracle does not support READ_UNCOMMITTED as expected
if (!isOracle()) {
LoggedSql.start();
findCountTxn();
sql = LoggedSql.stop();
assertThat(sql).hasSize(0);
}
}
private void findCountNoTxn() {
DB.find(EColAB.class)
.setUseQueryCache(CacheMode.ON)
.where()
.eq("columnB", "count")
.findCount();
}
@Transactional(isolation = TxIsolation.READ_UNCOMMITTED)
private void findCountTxn() {
findCountNoTxn();
}
@Test
@@ -189,7 +189,7 @@ public class TestChangeLog extends BaseTestCase {
return DatabaseFactory.create(config);
}
public static class TDChangeLogPrepare implements ChangeLogPrepare {
static class TDChangeLogPrepare implements ChangeLogPrepare {
@Override
public boolean prepare(ChangeSet changes) {
changes.setUserId("appUser1");
@@ -198,7 +198,7 @@ public class TestChangeLog extends BaseTestCase {
}
}
public static class TDChangeLogListener implements ChangeLogListener {
static class TDChangeLogListener implements ChangeLogListener {
ObjectMapper objectMapper = new ObjectMapper();
@@ -226,7 +226,7 @@ public class TestChangeLog extends BaseTestCase {
}
public static class TDChangeLogRegister implements ChangeLogRegister {
static class TDChangeLogRegister implements ChangeLogRegister {
@Override
public ChangeLogFilter getChangeFilter(Class<?> beanType) {
@@ -29,7 +29,7 @@ public class MyEBasicConfigStartup implements ServerConfigStartup {
serverConfig.add(new EbasicBulkListener());
}
public static class EbasicBulkListener implements BulkTableEventListener {
private static class EbasicBulkListener implements BulkTableEventListener {
final Set<String> s = new HashSet<>();
@@ -49,7 +49,7 @@ public class MyEBasicConfigStartup implements ServerConfigStartup {
}
public static class EbasicPersistList extends AbstractBeanPersistListener {
private static class EbasicPersistList extends AbstractBeanPersistListener {
@Override
public boolean isRegisterFor(Class<?> cls) {
@@ -1,9 +1,11 @@
package org.tests.query;
import io.ebean.annotation.Platform;
import io.ebean.xtest.BaseTestCase;
import io.ebean.DB;
import io.ebean.PagedList;
import io.ebean.test.LoggedSql;
import io.ebean.xtest.IgnorePlatform;
import org.junit.jupiter.api.Test;
import org.tests.model.basic.Order;
import org.tests.model.basic.ResetBasicData;
@@ -17,6 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class TestAddOrderByWithFirstRowsMaxRows extends BaseTestCase {
@IgnorePlatform({Platform.MYSQL, Platform.MARIADB})
@Test
public void test_firstRows() {
+5 -5
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<name>kotlin querybean generator</name>
@@ -29,7 +29,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
@@ -43,7 +43,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
@@ -64,14 +64,14 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-ddl-generator</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
<scope>test</scope>
</dependency>
@@ -146,6 +146,15 @@ class ProcessingContext implements Constants {
}
}
private String trimAnnotations(String type) {
int pos = type.indexOf("@");
if (pos == -1) {
return type;
}
String remainder = type.substring(0, pos) + type.substring(type.indexOf(' ') + 1);
return trimAnnotations(remainder);
}
/**
* Gather all the fields (properties) for the given bean element.
*/
@@ -159,7 +168,6 @@ class ProcessingContext implements Constants {
* Recursively gather all the fields (properties) for the given bean element.
*/
private void gatherProperties(List<VariableElement> fields, Element element) {
TypeElement typeElement = (TypeElement) element;
TypeMirror superclass = typeElement.getSuperclass();
Element mappedSuper = typeUtils.asElement(superclass);
@@ -253,9 +261,17 @@ class ProcessingContext implements Constants {
}
PropertyType getPropertyType(VariableElement field) {
TypeMirror typeMirror = field.asType();
if (dbJsonField(field)) {
return propertyTypeMap.getDbJsonType();
}
if (dbArrayField(field)) {
// get generic parameter type
DeclaredType declaredType = (DeclaredType) field.asType();
String fullType = typeDef(declaredType.getTypeArguments().get(0));
String shortName = langShortType(Split.shortName(fullType));
return new PropertyTypeArray(fullType, shortName);
}
final TypeMirror typeMirror = field.asType();
TypeMirror currentType = typeMirror;
while (currentType != null) {
PropertyType type = propertyTypeMap.getType(typeDef(currentType));
@@ -268,18 +284,6 @@ class ProcessingContext implements Constants {
currentType = (fieldType == null) ? null : fieldType.getSuperclass();
}
if (dbJsonField(field)) {
return propertyTypeMap.getDbJsonType();
}
if (dbArrayField(field)) {
// get generic parameter type
DeclaredType declaredType = (DeclaredType) typeMirror;
String fullType = typeDef(declaredType.getTypeArguments().get(0));
String shortName = langShortType(Split.shortName(fullType));
return new PropertyTypeArray(fullType, shortName);
}
Element fieldType = typeUtils.asElement(typeMirror);
if (fieldType == null) {
return null;
@@ -324,9 +328,9 @@ class ProcessingContext implements Constants {
}
if (typeInstanceOf(typeMirror, "java.lang.Comparable")) {
return new PropertyTypeScalarComparable(typeMirror.toString());
return new PropertyTypeScalarComparable(trimAnnotations(typeMirror.toString()));
} else {
return new PropertyTypeScalar(typeMirror.toString());
return new PropertyTypeScalar(trimAnnotations(typeMirror.toString()));
}
}
@@ -383,7 +387,6 @@ class ProcessingContext implements Constants {
* Create the QAssoc PropertyType.
*/
private PropertyType createPropertyTypeAssoc(String fullName) {
String[] split = Split.split(fullName);
String propertyName = "QAssoc" + split[1];
String packageName = packageAppend(split[0]);
@@ -436,7 +439,6 @@ class ProcessingContext implements Constants {
* Register an entity with optional dbName.
*/
void addEntity(String beanFullName, String dbName) {
loaded.add(beanFullName);
final String pkg = packageOf(beanFullName);
if (pkg != null) {
+15 -15
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-all</artifactId>
@@ -14,72 +14,72 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-clickhouse</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-db2</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-hana</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-hsqldb</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-mysql</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-mariadb</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-nuodb</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-oracle</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlanywhere</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlite</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlserver</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-clickhouse</artifactId>
@@ -14,12 +14,12 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-db2</artifactId>
@@ -14,12 +14,12 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
@@ -2,11 +2,7 @@ package io.ebean.platform.db2;
import io.ebean.BackgroundExecutor;
import io.ebean.annotation.Platform;
import io.ebean.config.dbplatform.DatabasePlatform;
import io.ebean.config.dbplatform.DbPlatformType;
import io.ebean.config.dbplatform.DbType;
import io.ebean.config.dbplatform.PlatformIdGenerator;
import io.ebean.config.dbplatform.SqlErrorCodes;
import io.ebean.config.dbplatform.*;
import javax.sql.DataSource;
import java.sql.Types;
@@ -22,7 +18,7 @@ public abstract class BaseDB2Platform extends DatabasePlatform {
this.supportsNativeJavaTime = false;
this.truncateTable = "truncate table %s reuse storage ignore delete triggers immediate";
this.likeClauseRaw = "like ?";
this.sqlLimiter = new Db2SqlLimiter();
this.sqlLimiter = new AnsiSqlRowsLimiter();
this.dbIdentity.setSupportsGetGeneratedKeys(true);
this.dbIdentity.setSupportsSequence(true);
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-h2</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<!-- Provided scope so that the H2HistoryTrigger can live in Ebean core
@@ -36,6 +36,6 @@
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-hana</artifactId>
@@ -14,12 +14,12 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
@@ -5,17 +5,13 @@ import io.ebean.Query.LockWait;
import io.ebean.annotation.PersistBatch;
import io.ebean.annotation.Platform;
import io.ebean.config.PlatformConfig;
import io.ebean.config.dbplatform.DatabasePlatform;
import io.ebean.config.dbplatform.DbPlatformType;
import io.ebean.config.dbplatform.DbType;
import io.ebean.config.dbplatform.IdType;
import io.ebean.config.dbplatform.SqlErrorCodes;
import io.ebean.config.dbplatform.*;
public class HanaPlatform extends DatabasePlatform {
public HanaPlatform() {
this.platform = Platform.HANA;
this.sqlLimiter = new HanaSqlLimiter();
this.sqlLimiter = new LimitOffsetSqlLimiter();
this.persistBatchOnCascade = PersistBatch.NONE;
this.supportsResultSetConcurrencyModeUpdatable = false;
this.historySupport = new HanaHistorySupport();
@@ -1,34 +0,0 @@
package io.ebean.platform.hana;
import io.ebean.config.dbplatform.SqlLimitRequest;
import io.ebean.config.dbplatform.SqlLimitResponse;
import io.ebean.config.dbplatform.SqlLimiter;
public class HanaSqlLimiter implements SqlLimiter {
@Override
public SqlLimitResponse limit(SqlLimitRequest request) {
String dbSql = request.getDbSql();
StringBuilder sb = new StringBuilder(50 + dbSql.length());
sb.append("select ");
if (request.isDistinct()) {
sb.append("distinct ");
}
sb.append(dbSql);
int firstRow = request.getFirstRow();
int maxRows = request.getMaxRows();
if (maxRows > 0) {
sb.append(" ").append("limit ").append(maxRows);
if (firstRow > 0) {
sb.append(" ").append("offset ");
sb.append(firstRow);
}
}
String sql = request.getDbPlatform().completeSql(sb.toString(), request.getOrmQuery());
return new SqlLimitResponse(sql);
}
}
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-hsqldb</artifactId>
@@ -14,12 +14,12 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+4 -4
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-mariadb</artifactId>
@@ -14,18 +14,18 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-mysql</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-mysql</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -27,6 +27,6 @@
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-nuodb</artifactId>
@@ -14,12 +14,12 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-oracle</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -27,6 +27,6 @@
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
@@ -7,27 +7,26 @@ import io.ebean.config.dbplatform.SqlLimiter;
/**
* Use ANSI offset rows syntax.
*/
class OracleAnsiSqlRowsLimiter implements SqlLimiter {
final class OracleAnsiSqlRowsLimiter implements SqlLimiter {
@Override
public SqlLimitResponse limit(SqlLimitRequest request) {
String dbSql = request.getDbSql();
StringBuilder sb = new StringBuilder(50 + dbSql.length());
int firstRow = request.getFirstRow();
int maxRows = request.getMaxRows();
sb.append("select ");
if (request.isDistinct()) {
sb.append("distinct ");
}
sb.append(dbSql);
int firstRow = request.getFirstRow();
if (firstRow > 0) {
sb.append(" offset ").append(firstRow).append(" rows");
}
int maxRows = request.getMaxRows();
if (maxRows > 0) {
sb.append(" fetch next ").append(maxRows).append(" rows only");
}
// Oracle does not support FOR UPDATE clause with limit offset
return new SqlLimitResponse(sb.toString());
}
@@ -11,7 +11,6 @@ class OracleRownumSqlLimiter implements SqlLimiter {
@Override
public SqlLimitResponse limit(SqlLimitRequest request) {
// select *
// from ( select /*+ FIRST_ROWS(n) */ a.*, ROWNUM rnum
// from ( your_query_goes_here,
+1 -1
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>platforms</artifactId>
+4 -4
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-postgres</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -27,7 +27,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.0</version>
<version>42.5.1</version>
<scope>test</scope>
</dependency>
@@ -41,6 +41,6 @@
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-sqlanywhere</artifactId>
@@ -14,12 +14,12 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
@@ -7,18 +7,12 @@ import io.ebean.config.dbplatform.SqlLimiter;
/**
* Use top xx and start at xx to limit sql results.
*/
public class SqlAnywhereLimiter implements SqlLimiter {
public final class SqlAnywhereLimiter implements SqlLimiter {
@Override
public SqlLimitResponse limit(SqlLimitRequest request) {
String dbSql = request.getDbSql();
StringBuilder sb = new StringBuilder(60 + dbSql.length());
int firstRow = request.getFirstRow();
int maxRows = request.getMaxRows();
/*
* SELECT TOP xx START AT xx ... FROM ...
*/
@@ -26,14 +20,15 @@ public class SqlAnywhereLimiter implements SqlLimiter {
if (request.isDistinct()) {
sb.append("distinct ");
}
int maxRows = request.getMaxRows();
if (maxRows > 0) {
sb.append("top ").append(maxRows).append(" ");
}
int firstRow = request.getFirstRow();
if (firstRow > 0) {
sb.append("start at ").append(firstRow + 1).append(" ");
}
sb.append(dbSql);
String sql = request.getDbPlatform().completeSql(sb.toString(), request.getOrmQuery());
return new SqlLimitResponse(sql);
}
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-sqlite</artifactId>
@@ -14,12 +14,12 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>platforms</artifactId>
<groupId>io.ebean</groupId>
<version>13.10.1</version>
<version>13.11.1</version>
</parent>
<artifactId>ebean-platform-sqlserver</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.10.1</version>
<version>13.11.1</version>
</dependency>
<dependency>
@@ -27,6 +27,6 @@
</dependencies>
<scm>
<tag>ebean-parent-13.10.1</tag>
<tag>ebean-parent-13.11.1</tag>
</scm>
</project>
@@ -7,20 +7,14 @@ import io.ebean.config.dbplatform.SqlLimiter;
/**
* Use ANSI offset rows syntax or top n - SQL Server 2012 onwards.
*/
public class SqlServerSqlLimiter implements SqlLimiter {
public SqlServerSqlLimiter() {
}
public final class SqlServerSqlLimiter implements SqlLimiter {
@Override
public SqlLimitResponse limit(SqlLimitRequest request) {
String dbSql = request.getDbSql();
StringBuilder sb = new StringBuilder(50 + dbSql.length());
int firstRow = request.getFirstRow();
int maxRows = request.getMaxRows();
if (firstRow < 1) {
// just use top n
sb.append("select ");
@@ -31,12 +25,10 @@ public class SqlServerSqlLimiter implements SqlLimiter {
sb.append(dbSql);
return new SqlLimitResponse(sb.toString());
}
sb.append("select ");
if (request.isDistinct()) {
sb.append("distinct ");
}
sb.append(dbSql);
sb.append(" ").append("offset");
sb.append(" ").append(firstRow).append(" rows");

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