Compare commits

...
Author SHA1 Message Date
Rob Bygrave 04ff5e7995 Version 12.16.3 2024-04-18 00:02:35 +12:00
Rob BygraveandGitHub f490116572 Merge pull request #3394 from ebean-orm/fix/3393
#3393 Fix for 12.x to support "NoTimeZone" to bypass MySQL JDBC use of Timezone Calendar
2024-04-17 22:59:05 +12:00
Rob Bygrave 6e163b9f5c #3393 Fix for 12.x to support "NoTimeZone" to bypass MySQL JDBC use of Timezone Calendar 2024-04-17 22:57:55 +12:00
Rob Bygrave 63336bafe5 [maven-release-plugin] prepare for next development iteration 2023-09-07 14:50:26 +12:00
Rob Bygrave 97ca198b7c [maven-release-plugin] prepare release ebean-parent-12.16.2 2023-09-07 14:50:18 +12:00
Rob BygraveandGitHub 88fd59e164 Merge pull request #3218 from ebean-orm/backport-12x/3173-BeanSet-init-loading
[12x] Backport of fix for #3173 BeanSet init(), initClear() and BeanMap
2023-09-07 14:45:59 +12:00
Rob Bygrave 5b9ef2daec [12x] Backport of fix for #3173 BeanSet init(), initClear() and BeanMap
- BeanSet init() and initClear() load with onlyIds false because the expectation is that with BeanSet the equals/hashCode implementation can use a property
- BeanMap lazy loading, include the mapKey if defined in the lazy loading query
2023-09-07 14:44:17 +12:00
Rob Bygrave 514bba4130 bump versions in test modules after release 2022-03-29 23:04:31 +13:00
Rob Bygrave d31aa2b24c [maven-release-plugin] prepare for next development iteration 2022-03-29 22:49:50 +13:00
Rob Bygrave d834817dc2 [maven-release-plugin] prepare release ebean-parent-12.16.1 2022-03-29 22:49:42 +13:00
Rob Bygrave 4cad515110 #2619 - Lack of setNullParameter() functionality on io.ebean.SqlQuery interface 2022-03-29 22:41:36 +13:00
Rob Bygrave aa89df5f00 Merge branch 'master' of github.com:ebean-orm/ebean 2022-03-29 22:10:54 +13:00
Rob Bygrave 29f7375468 Bump ebean-agent to 12.16.1 2022-03-29 22:10:40 +13:00
Rob BygraveandGitHub 3e4d7c9b5a Merge pull request #2617 from FOCONIS/json-update-existing
ENH: JsonContext accepts a bean as target
2022-03-29 08:38:29 +13:00
Rob BygraveandGitHub fa34c39d92 Merge pull request #2615 from FOCONIS/tidy-code
Tidy, remove unused imports - Suggested changes (no code change)
2022-03-29 08:28:20 +13:00
Roland Praml ffeb630e7e JsonContext accepts a bean as target 2022-03-28 15:38:44 +02:00
Roland Praml 7666775d1a Suggested changes (no code change) 2022-03-28 14:39:12 +02:00
Rob Bygrave f95212eeb3 #2613 - Bump ebean-migration to 12.16.1 2022-03-28 14:36:10 +13:00
Rob Bygrave 5c3b680c8a #2612 - Incorrect DDL generation for MySql on history tables that use quoted identifiers 2022-03-28 13:05:59 +13:00
Rob Bygrave c8bb3c7b57 Fix test ebean-redis ClusterTest such that it allows for background thread sync to redis 2022-03-28 09:23:55 +13:00
Rob Bygrave dcd3bfee4c Fix test ConfigTest such that it doesn't set the RunOnceMarker
When tests are run using for example -Dprops.file=testconfig/ebean-postgres.properties ... then we want ebean-test AutoConfigureForTesting to run and setup the default datasource appropriately. If ConfigTest runs before that then it sets the RunOnceMarker and the default datasource isn't adjusted
2022-03-28 09:12:13 +13:00
Rob Bygrave b85bb5f459 Refactor tests, move some unit tests to ebean-api 2022-03-27 20:31:17 +13:00
Rob Bygrave 426d314e63 Refactor tests, move internal type tests to ebean-core 2022-03-27 20:20:35 +13:00
Rob Bygrave e3e5414157 Refactor tests, move some internal expression tests to ebean-core 2022-03-27 19:55:34 +13:00
Rob Bygrave 28088a5e54 Refactor tests, move some internal deploy tests to ebean-core 2022-03-27 17:44:43 +13:00
Rob Bygrave 2acdf2f4bf Refactor tests, move some internal core tests to ebean-core 2022-03-27 17:06:52 +13:00
Rob Bygrave 785a027dd6 Refactor tests, move some cache tests to ebean-core 2022-03-27 16:49:28 +13:00
Rob Bygrave 88005dbe09 Refactor tests, move changelog tests 2022-03-25 18:44:24 +13:00
Rob Bygrave 88acd8190a Refactor tests, move db migration tests 2022-03-25 18:23:23 +13:00
Rob Bygrave 72963bc9fb Refactor tests, move DbPrimaryTest to ebean-api 2022-03-25 18:07:29 +13:00
Rob BygraveandGitHub 6a552cd7d1 Merge pull request #2610 from FOCONIS/remove-unused-imports
No effective code change: Removed unused imports
2022-03-24 22:53:56 +13:00
Roland Praml c40b9738d1 No effective code change: Removed unused imports 2022-03-24 09:23:39 +01:00
Rob Bygrave 84a64f9640 Refactor tests, move BaseTestCase and annotations @ForPlatform @IgnorePlatform 2022-03-24 18:52:37 +13:00
Rob Bygrave e4c06432a0 Move some more unit tests from ebean-test back to ebean-core 2022-03-24 18:48:59 +13:00
Rob Bygrave f58d6038c7 Move some unit tests from ebean-test back to ebean-core 2022-03-24 18:21:48 +13:00
Rob Bygrave f270c52c00 Bump maven-compiler-plugin 2022-03-24 16:58:41 +13:00
Rob Bygrave e6ea85a193 #2609 - Fix module-info export io.ebean.config.dbplatform.yugabyte 2022-03-24 16:51:18 +13:00
Rob Bygrave 17f408681c No functional change - final methods on internal RsetDataReader 2022-03-24 12:01:22 +13:00
Rob Bygrave fcf6f5f384 No effective change - typo in javadoc 2022-03-24 11:32:50 +13:00
Rob Bygrave d98c49e266 Update test generated db2 index migration files 2022-03-23 22:31:32 +13:00
Rob Bygrave 79213e7194 Merge branch 'master' of github.com:ebean-orm/ebean 2022-03-23 22:29:16 +13:00
Rob Bygrave bc1f7040da Merge branch 'FOCONIS-tmp-tablespace' 2022-03-23 22:27:44 +13:00
Rob Bygrave f157c2da7f Merge branch 'tmp-tablespace' of https://github.com/FOCONIS/ebean into FOCONIS-tmp-tablespace 2022-03-23 22:27:17 +13:00
Rob BygraveandGitHub 33b18fb837 Merge pull request #2607 from FOCONIS/some-todos
DDL: Support schema in history entities and ignore case in DB2 procedures
2022-03-23 16:46:31 +13:00
Rob BygraveandGitHub 1f8a6b0668 Update README.md 2022-03-23 13:16:17 +13:00
Rob BygraveandGitHub 85a971323a Update early access build badges 2022-03-23 13:10:57 +13:00
Rob Bygrave f1b626a182 Merge branch 'master' of github.com:ebean-orm/ebean 2022-03-23 13:00:44 +13:00
Rob Bygrave cc043316ee Update EA build name 2022-03-23 13:00:30 +13:00
Rob BygraveandGitHub c656436d09 Update README.md 2022-03-23 12:31:22 +13:00
Roland Praml 250e66819b Reference scripts 2022-03-22 17:05:04 +01:00
Roland Praml 3e4cc3b3d6 Add tablespace support for DB2 2022-03-22 17:03:38 +01:00
Roland Praml f1950d479e Added testcase with upper and lower case characters 2022-03-22 10:43:34 +01:00
Roland Praml 00686fcccf DB2: ignore case in "drop if exists" checks 2022-03-22 09:58:20 +01:00
Roland Praml 4fe8ef2b23 Support schema in history-entities 2022-03-22 09:42:19 +01:00
Rob Bygrave baddc76961 Refactor tidy grammar in server/expression classes 2022-03-22 16:48:47 +13:00
Rob Bygrave de4140aaac #2600 - Pending drops migration with the same version of the target migration cause trouble 2022-03-22 16:20:06 +13:00
Rob BygraveandGitHub 66aa772f4a Merge pull request #2603 from FOCONIS/remove-lowertablename
Refactored DDL generation to correctly handle quoted identifiers
2022-03-22 09:02:42 +13:00
Rob BygraveandGitHub f745cfaab3 Merge pull request #2604 from FOCONIS/remove-lowertablename2
Remove LowerTableName
2022-03-22 08:38:14 +13:00
Roland Praml 8640b4a1a0 Fix: Check if pendingDrops are used correctly 2022-03-21 15:20:41 +01:00
Roland Praml 5e87706055 Fix: check newTable for history flag 2022-03-21 15:05:29 +01:00
Roland Praml 0d765d6583 Reference scripts 2022-03-21 15:02:06 +01:00
Roland Praml 2a924d8d32 Add more quotes, for history tables 2022-03-21 15:01:43 +01:00
Roland Praml 04d2a20945 Add testcase, that uses all kinds of reserved keywords 2022-03-21 13:48:48 +01:00
Roland Praml 4077d906d1 ADD: Support for quoted identifiers 2022-03-21 13:34:29 +01:00
Roland Praml 7e3fbbba62 Refactor: use normalized table names for history 2022-03-21 11:52:00 +01:00
Roland Praml 3db9a17c6a Refactored DbTriggerBasedHistory: always use historyTableName 2022-03-21 11:15:13 +01:00
Roland Praml 327babbfa2 Reference scripts 2022-03-21 11:08:54 +01:00
Roland Praml 0a1acb3f9b Fix: DB2-History table must be an exact copy 2022-03-21 11:08:41 +01:00
Roland Praml a2e27b9e00 fixed test case 2022-03-21 11:02:14 +01:00
Roland Praml a8ad93823a Removed 'lowerTableName' and 'lowerColumnName' 2022-03-18 08:56:43 +01:00
Rob Bygrave 5eb790e54d Merge branch 'master' of github.com:ebean-orm/ebean 2022-03-18 11:08:29 +13:00
Rob Bygrave c44ae96e09 Add badge to README for JDK EA 2022-03-18 11:08:11 +13:00
Rob BygraveandGitHub d540bf4d16 Merge pull request #2601 from FOCONIS/ddl-refactor9
Extended @Column support for DB2
2022-03-18 09:25:56 +13:00
Roland Praml ab6f5daec3 FIX LargeValueInsert-Test for DB2 2022-03-17 13:26:54 +01:00
Roland Praml d7a7ef097b Reference scripts 2022-03-17 13:14:11 +01:00
Roland Praml 8f746196ab Support for extra colum options for DB2 2022-03-17 13:11:48 +01:00
Roland Praml eb1ed0bdd0 DbColumDefault must be returned although if individual columnDefinition is specified (cases no DDL change)
We support optional platform columnDefinitions now. E.g. "db2;clob(64M);" - so we must not ignore @DbDefault for all other platforms
2022-03-17 13:07:52 +01:00
Roland Praml 37ab71cb7c Reference scripts 2022-03-17 13:03:55 +01:00
Roland Praml 74720a840d DbMigration: Do only real type changes 2022-03-17 13:01:25 +01:00
Rob Bygrave 923f83cafb Bump after release to 12.16.1-SNAPSHOT 2022-03-17 21:37:56 +13:00
Rob Bygrave 2faaf5f186 [maven-release-plugin] prepare for next development iteration 2022-03-16 22:49:23 +13:00
Rob Bygrave ef8d9c7eb0 [maven-release-plugin] prepare release ebean-parent-12.16.0 2022-03-16 22:49:16 +13:00
Rob Bygrave a464c763d0 Bump parent pom 2022-03-16 22:45:57 +13:00
Rob Bygrave d4d1e571d3 Fix test assert for multi-database 2022-03-16 22:37:54 +13:00
Rob Bygrave 92e85e32a2 #2598 - H2 + @Lob String fails with - Error[Value too long for column "CHARACTER VARYING": "... (1048577)" [22001-210]] 2022-03-16 22:13:52 +13:00
Rob Bygrave ff1b01e5ca Bump agent to 12.16.0 + test and provided dependencies 2022-03-16 22:13:07 +13:00
Rob Bygrave 327f25c568 No functional change - refactor tidy dealing with some internal warnings
protected not needed on final classes
2022-03-16 18:51:12 +13:00
Rob BygraveandGitHub 00a1324c52 Merge pull request #2596 from FOCONIS/ddl-refactor8
DDl-Refactor: Add DB2 Reorg support and history support
2022-03-16 18:47:58 +13:00
Rob Bygrave 75b9df942c No effective change - tidy TestWithCacheAndLazyLoad 2022-03-16 18:38:47 +13:00
Rob Bygrave 946b390037 Merge branch 'FOCONIS-lazyload-npe' 2022-03-16 18:37:48 +13:00
Rob Bygrave 3a1e1e23f5 Merge branch 'lazyload-npe' of https://github.com/FOCONIS/ebean into FOCONIS-lazyload-npe 2022-03-16 18:14:22 +13:00
Rob Bygrave d9ea465102 Support running tests against java 19 2022-03-16 18:02:07 +13:00
Rob Bygrave 3bc7f061eb Bump test dependencies for junit, assertj, mockito 2022-03-16 17:55:37 +13:00
Rob Bygrave 0bc07d38b2 Add Oracle GH workflow for JDK EA 18,19,loom,valhalla,metropolis,panama 2022-03-16 12:13:29 +13:00
Roland Praml 79f6d6d0f0 Ignored query plans for DB2 2022-03-15 17:18:34 +01:00
Roland Praml 782e41098d enabled history tests 2022-03-15 16:56:00 +01:00
Roland Praml 0225fddf6d FIX: AlterColumnTest 2022-03-15 16:31:43 +01:00
Roland Praml be3e08018e Reference Scripts 2022-03-15 15:59:50 +01:00
Roland Praml c9204eed3f DB2: HistorySupport added 2022-03-15 15:59:33 +01:00
Noemi Szemenyei edb6a0ebe2 performance boost list --> set
(cherry picked from commit 2478aded70)
2022-03-15 13:21:10 +01:00
Noemi Szemenyei 826b507b77 Suggested fix
(cherry picked from commit 52ca271a13)
2022-03-15 13:21:02 +01:00
Noemi Szemenyei 8ad8f47c6b Created failing test case
(cherry picked from commit 2b21588c90)
2022-03-15 13:20:16 +01:00
Rob BygraveandGitHub 5944777a13 Merge pull request #2594 from FOCONIS/ddl-refactor7
[DDL-Refactor] History table generation
2022-03-15 09:23:30 +13:00
Roland Praml 05a1b0d64e DB2: Migration is working now 2022-03-14 16:31:34 +01:00
Roland Praml 4d62958645 Updated DDL scripts to support notnull -> null transitions 2022-03-14 14:13:56 +01:00
Roland Praml 610a8b2df6 FIX: notNull -> null transition must be applied also to history 2022-03-14 14:13:10 +01:00
Roland Praml 5b8bb41598 Postgres: Drops history support during alter and restores it after that 2022-03-14 14:08:42 +01:00
Roland Praml 9e16d955ae Sqlserver: no effective code change 2022-03-14 14:06:25 +01:00
Roland Praml 197bb0509a Nuodb: no effective ddl change 2022-03-14 14:05:42 +01:00
Roland Praml 5536aeb829 Mysql: locks only one table at once 2022-03-14 14:04:59 +01:00
Roland Praml d629fb2dbd MariaDB uses '@@system_versioning_alter_history = 1' now. Removed obsolete "lock tables" statements 2022-03-14 14:01:21 +01:00
Roland Praml 10c01574d2 H2: No effective change Statements reordered 2022-03-14 13:12:24 +01:00
Roland Praml cfad20c8e1 Refactored Hisotry generation 2022-03-14 13:11:00 +01:00
Rob Bygrave 0ea375b4fc Merge branch 'FOCONIS-ddl-clickhouse' 2022-03-14 16:54:07 +13:00
Rob Bygrave 71fce1b4c5 #2575 Tidy up for [DDL-ClickHouse] fixes for ClickHouse platform 2022-03-14 16:53:51 +13:00
Rob Bygrave db60065389 Merge branch 'ddl-clickhouse' of https://github.com/FOCONIS/ebean into FOCONIS-ddl-clickhouse 2022-03-14 16:51:27 +13:00
Rob Bygrave d3a765a532 Tidy whitespace only, no effective change 2022-03-14 16:19:02 +13:00
Rob Bygrave fd4be0ca59 #2593 - Tidy SqlTreeBuilder to not add duplicate BeanProperties 2022-03-14 16:16:14 +13:00
Rob Bygrave 267a81b792 #25890 - Tidy only, no effective change for BackgroundExecutorWrapper 2022-03-14 15:46:21 +13:00
Rob Bygrave 1615beadd1 Merge branch 'master' of github.com:ebean-orm/ebean 2022-03-14 15:37:52 +13:00
Rob Bygrave a3e5c3de72 Merge branch 'FOCONIS-Bug-wrong-join-inheritance-dbforeignkey' 2022-03-14 15:37:38 +13:00
Rob Bygrave 267b1b7303 #2580 - Fix for Wrong join in query with @Inheritance
Effectively delays an extra join added via BeanPropertyAssocOne with inheritance, such that this only occurs if a SqlTreeNode child doesn't add the join.
2022-03-14 15:37:12 +13:00
Rob Bygrave c902caed24 Fix is to delay the extra join added via BeanPropertyAssocOne until after the children nodes have joined.
In this way the join is ONLY added if not already done so via a child node (SqlTreeNode).
2022-03-14 15:32:42 +13:00
Rob BygraveandGitHub 662666e1a4 Merge pull request #2590 from FOCONIS/background-executor-wrapper
Provide custom BackgroundExecutorWrapper to pass thread locals
2022-03-14 10:40:37 +13:00
Rob BygraveandGitHub 394f245e33 Merge pull request #2591 from FOCONIS/ddl-refactor6
[DDL-refactor] Sorted the statements, so that they are going to the correct buffers
2022-03-14 09:17:17 +13:00
Roland Praml 89da952b15 updated scripts 2022-03-11 15:35:15 +01:00
Roland Praml d927b8c2c2 [DDL-refactor] Sorted the statements, so that they are going to the correct buffers 2022-03-11 15:34:37 +01:00
Noemi Szemenyei 6867c4568c fix db.shutdown()
(cherry picked from commit 33d17d0f49)
2022-03-11 13:32:08 +01:00
Noemi Szemenyei e0e572a8b4 update
(cherry picked from commit dab8ed8a3b)
2022-03-11 13:31:58 +01:00
Noemi Szemenyei 3c7555de36 Provide custom BackgroundExecutorWrapper to pass thread locals
(cherry picked from commit 336accf447)
2022-03-11 13:31:50 +01:00
Rob BygraveandGitHub 75662aac5c Merge pull request #2589 from FOCONIS/ddl-refactor5
No effective DDL change - refactor whitespace and add buffer comments
2022-03-11 10:38:14 +13:00
Roland Praml e4ddcbd40a Reference scripts 2022-03-10 13:39:59 +01:00
Roland Praml a8f390c3b7 No effective DDL change - removed obsolete whitespaces 2022-03-10 13:31:12 +01:00
Roland Praml f1b196cf2e FIX: tests and pushed reference ddl scripts 2022-03-10 13:24:39 +01:00
Roland Praml 04675ea76b No effective DDL change, just added buffer comments in DDL 2022-03-10 13:24:01 +01:00
Rob Bygrave 8e44ad71e8 Merge branch 'Bug-wrong-join-inheritance-dbforeignkey' of https://github.com/FOCONIS/ebean into FOCONIS-Bug-wrong-join-inheritance-dbforeignkey 2022-03-10 16:24:14 +13:00
Rob Bygrave febd56c9c0 #2581 - SoftDelete on @OneToMany is ignored after refresh() (since 12.11.5) 2022-03-10 16:19:11 +13:00
Rob Bygrave 0d3649853a Bump provided optional Jackson dependency to 2.13.2 2022-03-10 15:33:33 +13:00
Rob Bygrave beed67567a #2588 - [postgis-jdbc] Bump postgis-jdbc dependency from 2.2.1 to 2.5.1 2022-03-10 15:33:00 +13:00
Rob BygraveandGitHub 0fe0803374 Merge pull request #2587 from FOCONIS/ddl-refactor4
[Ddl refactor] Alter Table changes are grouped by table name.
2022-03-10 13:00:44 +13:00
Roland Praml 5fd7aca3d9 Fixed test cases 2022-03-09 16:17:04 +01:00
Rob BygraveandGitHub 348fecddf7 Merge pull request #2586 from FOCONIS/ddl-refactor3
[Clickhouse] Refactored columnNotNull
2022-03-09 22:10:59 +13:00
Rob BygraveandGitHub b333449d84 Merge pull request #2584 from FOCONIS/hazelcast-unmodifiable-map
Small code change for Hazelcast 4.1.5
2022-03-09 16:10:39 +13:00
Rob BygraveandGitHub 87a97c2889 Merge pull request #2585 from FOCONIS/ddl-refactor2
Fix DDL Default handling & Prepared PlatformDdl to to have only one 'alterColumn' method
2022-03-09 16:07:30 +13:00
Roland Praml 790147e42d Reviewed DDL changes - all changes are plausible 2022-03-08 17:28:39 +01:00
Roland Praml 3a93abaa7f Only moves in DDL (checked with git -c color.diff.newMoved=black -c color.diff.oldMoved=black diff --color-moved=plain '*.sql') 2022-03-08 12:43:54 +01:00
Roland Praml 1049d951d9 Code changes to group alterTables by tableName 2022-03-08 12:39:44 +01:00
Roland Praml c3bdac5271 [Clickhouse] Refactored columnNotNull 2022-03-07 16:41:27 +01:00
Roland Praml 9bcba0b80d Sql-scripts 2022-03-07 15:40:45 +01:00
Roland Praml 1529a2f12b Prepared PlatformDdl to to have only one 'alterColumn' method (required for further refactoring) 2022-03-07 15:35:36 +01:00
Noemi Szemenyei b41b6da40e iterator.remove() is not needed 2022-03-04 08:20:44 +01:00
Rob BygraveandGitHub 4285cbaeb2 Merge pull request #2583 from ebean-orm/feature/2582-bg-executor
#2582 - Fix for regression, BackgroundExecutor is bounded (since 12.6.2)
2022-03-04 11:15:23 +13:00
Rob BygraveandGitHub 26fd7c5498 Merge pull request #2578 from ebean-orm/feature/bump-ddl-runner
Bump to ebean-ddl-runner 1.3
2022-03-04 11:14:35 +13:00
Rob BygraveandGitHub 6ec4e4b965 Merge branch 'master' into feature/bump-ddl-runner 2022-03-04 10:26:17 +13:00
Rob Bygrave e3a20a351d #2582 - Fix for regression, BackgroundExecutor is bounded (since 12.6.2)
The change for #2121 brought in a regression where the scheduledExecutorService was used for processing ALL submitted tasks (not just scheduled ones) and is a bounded executor service.  Previously non-scheduled tasks went to a "newCachedThreadPool" based executor service and with this change we are moving back to that (via restoring and using the DaemonExecutorService for those tasks).
2022-03-04 10:21:56 +13:00
Alexander Wagner 9b8f7be98f Bug: Wrong join in query with @Inheritance and @DbForeignKey
(cherry picked from commit 4bcadbb4da3f0defbcc58802e621442d948df38a)
2022-03-02 11:50:57 +01:00
Rob Bygrave 61f5442e3b #2579 - Bump to ebean-migration 12.16.0, support both basePlatform and platform for finding/running migrations
Fix ebean-migration-auto.version to 1.2
2022-03-02 12:30:32 +13:00
Rob Bygrave c5acd31da4 #2579 - Bump to ebean-migration 12.16.0, support both basePlatform and platform for finding/running migrations 2022-03-02 12:25:57 +13:00
Rob Bygrave 49fde7654e Bump to 12.16.0-SNAPSHOT 2022-03-02 12:17:38 +13:00
Rob Bygrave 05338531ed Bump versions after release 2022-03-01 23:01:09 +13:00
Rob Bygrave eb4d906814 [maven-release-plugin] prepare for next development iteration 2022-03-01 22:47:01 +13:00
Rob Bygrave 2a96a59deb [maven-release-plugin] prepare release ebean-parent-12.15.1 2022-03-01 22:46:55 +13:00
Rob Bygrave f571da5154 Bump to ebean-ddl-runner 1.3 2022-03-01 22:35:40 +13:00
Rob Bygrave ffad9abeef #2577 - Refactor internals remove no longer needed DdlAutoCommit platform option 2022-03-01 22:32:09 +13:00
Rob Bygrave e8df81d78a DbMigrationTest ignore Yugabyte at this stage 2022-03-01 21:29:17 +13:00
Rob Bygrave ed19a96801 Tidy DbMigrationTest after fix for #2576 2022-03-01 21:01:48 +13:00
Rob Bygrave 6d27e30b88 [H2] Use LocalDateTime in H2HistoryTrigger with microsecond precision - fix DbMigrationTest 2022-03-01 20:52:39 +13:00
Rob Bygrave 52aa1a2d91 For Multi-jdk build failure - tweak DbMigrationTest, add another hack 1 milli sleep 2022-03-01 20:30:49 +13:00
Rob Bygrave ddbd816f6d For Multi-jdk build failure - tweak DbMigrationTest, add hack comment 2022-03-01 16:23:58 +13:00
Rob Bygrave 00940c2b31 For Multi-jdk build failure - tweak DbMigrationTest 2022-03-01 12:10:28 +13:00
Rob Bygrave 708ec64893 For Multi-jdk build failure - check if H2HistoryTrigger should bump 1ms if needed 2022-03-01 11:59:37 +13:00
Rob Bygrave d0dd2d8203 Add a more useful implementation for Version.toString() 2022-03-01 11:34:07 +13:00
Rob Bygrave faa921ac27 Update DbMigrationTest to include platform for some asserts 2022-03-01 11:22:40 +13:00
Rob Bygrave f2a99c7b01 Update DbMigrationTest to include platform for some asserts 2022-03-01 11:03:37 +13:00
Rob BygraveandGitHub b6ea9df444 Merge pull request #2574 from FOCONIS/ddl-cockroach
[DDL-Cockroach] Fixes for Cockroach platform
2022-02-28 11:25:21 +13:00
Rob BygraveandGitHub e6cde5862d Merge pull request #2573 from FOCONIS/ddl-hana
[DDL-hana] HANA always requires stored procedures
2022-02-28 11:24:05 +13:00
Rob BygraveandGitHub dec927bf9a Merge pull request #2571 from FOCONIS/ddl-sqlite
[DDL-SqLite] Modified SqLite platform to generate at least non failing migration scripts
2022-02-28 11:20:20 +13:00
Rob BygraveandGitHub ae41471c74 Merge pull request #2570 from FOCONIS/ddl-oracle-fixes
[DDL-Oracle] Fix drop default and ignore erros when trying to drop non existent objects
2022-02-28 11:19:43 +13:00
Rob BygraveandGitHub 843d9d2700 Merge pull request #2569 from FOCONIS/ddl-extend-test
[DDL-common] Extended DbMigrationTest to run on all platforms
2022-02-28 11:16:59 +13:00
Roland Praml 475fd38be5 FIX: PlatformDdl-tests 2022-02-25 15:44:54 +01:00
Roland Praml b88e4a35f8 Ddl fixes for clickhouse platform 2022-02-25 12:10:54 +01:00
Roland Praml c82f3783f0 Fixes for Cockroach platform 2022-02-25 12:10:06 +01:00
Roland Praml bf99f9d08d Fix: HANA always requires stored procedures (similar to SqlServer), Fix: default value on intermediate alters 2022-02-25 12:09:09 +01:00
Roland Praml f30c3869b6 Modified SqLite platform to generate at least non failing migration scripts.
Note: If you want to alter a table in SqLite, the best option is to recreate the table with the new layout
2022-02-25 12:07:06 +01:00
Roland Praml 3b32e4c018 Oracle: Fix DB name to match with docker container 2022-02-25 12:06:09 +01:00
Roland Praml e0669e9a9f DDL generation fixes fpr oracle platform (fix drop default, do "drop if exists" with error handlers) 2022-02-25 12:05:53 +01:00
Roland Praml 95b1488aed Extended DbMigrationTest to run on all platforms 2022-02-25 12:04:24 +01:00
Rob BygraveandGitHub 897a97d415 Merge pull request #2568 from FOCONIS/Tidy-up-code
Removed unused imports and add missing Override statements (no effective code change)
2022-02-25 14:29:30 +13:00
Rob BygraveandGitHub 1d71f617c2 Merge pull request #2567 from FOCONIS/tidy-up-ddl-generation
Tidy up ddl generation (no effective code change)
2022-02-25 14:28:20 +13:00
Roland Praml 1ca5789112 Removed unused imports and add missing Override statements (no effective code change) 2022-02-24 08:03:26 +01:00
Roland Praml 70ec8a3891 Removed unused code 2022-02-23 11:17:16 +01:00
Roland Praml 2dfa9d2e77 No effective code change: Normalized "DdlWrite write" to "DdlWrite writer" 2022-02-23 11:14:22 +01:00
Rob Bygrave 29a5a13dd9 Merge branch 'master' of github.com:ebean-orm/ebean 2022-02-22 14:52:14 +13:00
Rob Bygrave 7a3494ebd9 Update to the newer Apache2 licence text (from older Apache2 license text) 2022-02-22 14:51:54 +13:00
Rob BygraveandGitHub 915bf29eaf Merge pull request #2557 from FOCONIS/add-reorg-support
Refactored DDL generation
2022-02-22 13:19:51 +13:00
Rob Bygrave dad4837b50 No change - format code only 2022-02-22 13:15:28 +13:00
Rob BygraveandGitHub 8fa8c687e9 Merge pull request #2563 from FOCONIS/platform-specific-columndefinition
Different ColumnDefinition for different platforms
2022-02-22 13:13:43 +13:00
Rob Bygrave aff54f5cf7 Merge branch 'FOCONIS-bug-save-one-to-one-version-cascade' 2022-02-22 13:08:05 +13:00
Rob Bygrave fa0336a404 Merge branch 'bug-save-one-to-one-version-cascade' of https://github.com/FOCONIS/ebean into FOCONIS-bug-save-one-to-one-version-cascade 2022-02-22 13:00:41 +13:00
Noemi Szemenyei 7ccea9ff7e migrations 2022-02-18 10:03:04 +01:00
Noemi Szemenyei c2e4f862bc default columnDef should be calculated from ebean 2022-02-18 10:02:48 +01:00
Roland Praml 36bda117a6 No effective code change: Tidy up (organize imports/fix java warnings) 2022-02-17 14:47:05 +01:00
Roland Praml 08838770e9 No effective code change: Removed obsolete IOExceptions 2022-02-17 14:45:02 +01:00
Noemi Szemenyei 137a7950ff new migrations 2022-02-17 09:53:26 +01:00
Noemi Szemenyei e3980a14a2 review changes 2022-02-17 09:52:23 +01:00
Rob BygraveandGitHub ca9f48d019 Merge pull request #2562 from ebean-orm/dependabot/maven/ebean-test/org.postgresql-postgresql-42.3.3
Bump postgresql from 42.3.2 to 42.3.3 in /ebean-test
2022-02-17 21:44:01 +13:00
Rob BygraveandGitHub e83e6b0f8f Merge pull request #2561 from ebean-orm/dependabot/maven/ebean-core/org.postgresql-postgresql-42.3.3
Bump postgresql from 42.3.2 to 42.3.3 in /ebean-core
2022-02-17 21:43:49 +13:00
Rob BygraveandGitHub 7d18329c18 Merge pull request #2560 from ebean-orm/dependabot/maven/ebean-postgis/org.postgresql-postgresql-42.3.3
Bump postgresql from 42.3.2 to 42.3.3 in /ebean-postgis
2022-02-17 21:43:37 +13:00
Noemi Szemenyei c6fa60f28c migrations 2022-02-17 08:16:35 +01:00
Noemi Szemenyei 3ab7ebe5e6 new property for test 2022-02-17 08:14:51 +01:00
Noemi Szemenyei 48e875714b solution v1
(cherry picked from commit 3d83c6bd0e2bcca6fc04f73ce08983266b9df636)
2022-02-17 08:13:39 +01:00
dependabot[bot]andGitHub 5ba93ed927 Bump postgresql from 42.3.2 to 42.3.3 in /ebean-test
Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.2 to 42.3.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.3.2...REL42.3.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-16 01:19:58 +00:00
dependabot[bot]andGitHub 9974102f1a Bump postgresql from 42.3.2 to 42.3.3 in /ebean-core
Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.2 to 42.3.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.3.2...REL42.3.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-16 01:19:22 +00:00
dependabot[bot]andGitHub ba27e09179 Bump postgresql from 42.3.2 to 42.3.3 in /ebean-postgis
Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.2 to 42.3.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.3.2...REL42.3.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-16 01:18:59 +00:00
Alexander Wagner 90066eee0c Possible fix 2022-02-11 10:31:24 +01:00
Roland Praml 53c8827a52 Refactor: remove MConfiguration from BaseDdlBuffer (it is unused, and may/should be re-added to the DdlWrite when needed) 2022-02-08 16:21:25 +01:00
Alexander Wagner 3bb6f0ca65 Bug: save with cascade of @OneToOne + @Version model sets version to 1
(cherry picked from commit 1570e1800d)
2022-02-08 16:08:13 +01:00
Roland Praml 6e5eb6b963 Refactor: BaseDdlBuffer uses StringBuilder instead of StringWriter. Makes IOException obsolete. 2022-02-08 16:04:14 +01:00
Rob BygraveandGitHub 7bea0d0eb2 Merge pull request #2551 from FOCONIS/move-testcase
Move DbMigration-Tests to ebean-test
2022-02-08 10:23:40 +13:00
Rob BygraveandGitHub 5a07a54544 Merge pull request #2555 from FOCONIS/clickhouse-dbarray-type-missing
ClickHouseDb - decimal[] array type missing
2022-02-08 10:12:46 +13:00
Rob BygraveandGitHub 684508b7ea Merge pull request #2554 from FOCONIS/add-stored-procs-mysql
generate mysql StoredProcs for column deletion also for mariadb
2022-02-08 10:12:13 +13:00
Rob BygraveandGitHub ab72fd97b9 Merge pull request #2553 from FOCONIS/add-yugabyte-platform
Add Yugabyte-Platform to DefaultDbMigration
2022-02-08 10:11:33 +13:00
Rob BygraveandGitHub 8486415249 Merge pull request #2552 from FOCONIS/flaky-dtimedmetrictest
DTimedMetricTest fails sometimes (flaky test)
2022-02-08 10:10:36 +13:00
Roland Praml 6a74b84b8c Comments and mysql fixes 2022-02-07 17:07:01 +01:00
Roland Praml 999be3e0a7 ClickHouseDb - decimal[] array type missing 2022-02-07 16:40:11 +01:00
Roland Praml a656b55526 generate mysql StoredProcs for column deletion also for mariadb 2022-02-07 16:37:15 +01:00
Roland Praml dabb1451e9 Add Yugabyte-Platform to DefaultDbMigration 2022-02-07 16:34:39 +01:00
Roland Praml cde00650ca DTimedMetricTest fails sometimes 2022-02-07 16:27:09 +01:00
Roland Praml 6b96bea480 Disabled Yugabyte 2022-02-07 16:23:50 +01:00
Roland Praml a731bfdfaf Multi-platform tests 2022-02-07 16:04:59 +01:00
Roland Praml 0ee153d6bc Add: ElementCollection 2022-02-07 14:08:26 +01:00
Roland Praml cb89b903fd Regenerated scripts & tests 2022-02-07 14:07:10 +01:00
Roland Praml a93e2e05c5 Moved DbMigrationtests test to "ebean-tests" 2022-02-07 11:55:41 +01:00
Rob BygraveandGitHub 05ad6da7e6 Merge pull request #2550 from ebean-orm/feature/cockroach-like
CockroachDB - Now supports LIKE ESCAPE and no longer needs Autocommit for DDL
2022-02-04 17:02:33 +13:00
Rob Bygrave 0d3ea9626c CockroachDB - Now supports LIKE ESCAPE and no longer needs Autocommit for DDL 2022-02-04 17:02:01 +13:00
Rob Bygrave b8b83c2ec8 Update more tests for CockroachDB 2022-02-04 16:59:16 +13:00
Rob Bygrave d05dfae1d7 Merge branch 'master' of github.com:ebean-orm/ebean 2022-02-04 15:55:26 +13:00
Rob Bygrave d0fcd4a13a #2549 - Fix DefaultPersister to expose non RuntimeExceptions on insert/update/delete. Not hide NoClassDefFoundError etc 2022-02-04 15:55:00 +13:00
Rob BygraveandGitHub b02adeccc1 Merge pull request #2548 from ebean-orm/feature/tests-for-cockroach
CockroachDB - Modify tests, use BigDecimal over Double etc
2022-02-04 11:04:55 +13:00
Rob Bygrave b3f110b7a5 CockroachDB - Modify tests, use BigDecimal over Double etc 2022-02-04 10:42:07 +13:00
Rob Bygrave daf0ba67a4 #2547 - CockroachDB - Use ON DISTINCT ... like Postgres and Yugabyte 2022-02-04 08:58:21 +13:00
Rob Bygrave cf3499f0e4 #2547 - Update BaseTestCase to include CockroachDB 2022-02-04 08:41:34 +13:00
Rob Bygrave a72cbaf243 #2547 - Cockroach identity DDL - Changing to use standard GENERATED ... AS IDENTITY syntax 2022-02-04 08:40:23 +13:00
Rob Bygrave 9ea2811aa3 Add H2Database build badge 2022-02-03 17:13:45 +13:00
Rob Bygrave 0abef7396f Add H2Database build workflow 2022-02-03 16:41:58 +13:00
Rob Bygrave 101d9e85ef Add H2Database build workflow 2022-02-03 16:38:17 +13:00
Rob Bygrave 7a3be45efd Add Yugabyte build badge to README 2022-02-03 16:22:53 +13:00
Rob Bygrave f4d92eed18 Bump test modules to 12.15.1-SNAPSHOT after release 2022-02-03 09:19:10 +13:00
Rob Bygrave db6f2cba75 [maven-release-plugin] prepare for next development iteration 2022-02-03 09:02:38 +13:00
1457 changed files with 24587 additions and 9281 deletions
+41
View File
@@ -0,0 +1,41 @@
name: H2Database
on:
workflow_dispatch:
schedule:
- cron: '10 1 * * *'
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
java_version: [11]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java_version }}
distribution: 'zulu'
- name: Maven cache
uses: actions/cache@v2
env:
cache-name: maven-cache
with:
path:
~/.m2
key: build-${{ env.cache-name }}
- name: Maven version
run: mvn --version
- name: H2Database
run: mvn clean package
+39
View File
@@ -0,0 +1,39 @@
name: ebean EA
on:
workflow_dispatch:
schedule:
- cron: '39 6 * * 1,3,5'
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
java_version: [17,18,19,loom,valhalla,metropolis,panama]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: oracle-actions/setup-java@v1
with:
website: jdk.java.net
release: ${{ matrix.java_version }}
- name: Maven cache
uses: actions/cache@v2
env:
cache-name: maven-cache
with:
path:
~/.m2
key: build-${{ env.cache-name }}
- name: Build with Maven
run: mvn package
+4 -6
View File
@@ -31,7 +31,7 @@ jobs:
path:
~/.m2
key: build-${{ env.cache-name }}
- name: h2
- name: h2database
run: mvn clean test
- name: postgres
run: mvn clean test -Dprops.file=testconfig/ebean-postgres.properties
@@ -39,13 +39,11 @@ jobs:
run: mvn clean test -Dprops.file=testconfig/ebean-mysql.properties
- name: mariadb
run: mvn clean test -Dprops.file=testconfig/ebean-mariadb.properties
- name: mariadb
run: mvn clean test -Dprops.file=testconfig/ebean-mariadb.properties
- name: sqlserver
run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver17.properties
- name: yugabyte
run: mvn clean test -Dprops.file=testconfig/ebean-yugabyte.properties
# - name: sqlserver 2019
- name: sqlserver
run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver17.properties
# - name: sqlserver19
# run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver19.properties
# - name: db2
# run: mvn clean test -Dprops.file=testconfig/ebean-db2.properties
+1 -3
View File
@@ -34,7 +34,5 @@ jobs:
path:
~/.m2
key: build-${{ env.cache-name }}
# - name: sqlserver 2019 latest
# run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver.properties
- name: sqlserver 2017 latest
- name: sqlserver 2017
run: mvn clean test -Dprops.file=testconfig/ebean-sqlserver17.properties
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2012 Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-15
View File
@@ -1,15 +0,0 @@
EbeanORM
Copyright 2012 Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+16 -5
View File
@@ -4,10 +4,21 @@
[![Multi-JDK Build](https://github.com/ebean-orm/ebean/actions/workflows/multi-jdk-build.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/multi-jdk-build.yml)
[![JDK 18-ea](https://github.com/ebean-orm/ebean/actions/workflows/jdk-18-ea.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/jdk-18-ea.yml)
[![H2Database](https://github.com/ebean-orm/ebean/actions/workflows/h2database.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/h2database.yml)
[![Postgres](https://github.com/ebean-orm/ebean/actions/workflows/postgres.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/postgres.yml)
[![MySql](https://github.com/ebean-orm/ebean/actions/workflows/mysql.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/mysql.yml)
[![MariaDB](https://github.com/ebean-orm/ebean/actions/workflows/mariadb.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/mariadb.yml)
[![SqlServer](https://github.com/ebean-orm/ebean/actions/workflows/sqlserver.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/sqlserver.yml)
[![Yugabyte](https://github.com/ebean-orm/ebean/actions/workflows/yugabyte.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/yugabyte.yml)
#### Builds against EA (Early Access) versions of Java (19, Loom, panama etc)
[![ebean EA](https://github.com/ebean-orm/ebean/actions/workflows/jdk-ea.yml/badge.svg)](https://github.com/ebean-orm/ebean/actions/workflows/jdk-ea.yml)
[![datasource EA](https://github.com/ebean-orm/ebean-datasource/actions/workflows/jdk-ea.yml/badge.svg)](https://github.com/ebean-orm/ebean-datasource/actions/workflows/jdk-ea.yml)
[![migration EA](https://github.com/ebean-orm/ebean-migration/actions/workflows/jdk-ea.yml/badge.svg)](https://github.com/ebean-orm/ebean-migration/actions/workflows/jdk-ea.yml)
[![test-docker EA](https://github.com/ebean-orm/ebean-test-docker/actions/workflows/jdk-ea.yml/badge.svg)](https://github.com/ebean-orm/ebean-test-docker/actions/workflows/jdk-ea.yml)
# Sponsors
<table>
@@ -37,15 +48,15 @@
</tbody>
</table>
# Need help?
## Need help?
Post questions or issues to the Ebean google group - https://groups.google.com/forum/#!forum/ebean
# Documentation
## Documentation
Goto [https://ebean.io/docs/](https://ebean.io/docs/)
## Maven central links:
[Maven central - ebean](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.ebean%22%20AND%20a%3A%22ebean%22 "maven central ebean")
## Maven central
[Maven central - io.ebean](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22io.ebean%22%20)
[Maven central - all related projects](http://search.maven.org/#search%7Cga%7C1%7Cebean "maven central all related projects")
+3 -3
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.15.0</version>
<version>12.16.3</version>
</parent>
<name>ebean api</name>
@@ -49,7 +49,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-annotation</artifactId>
<version>7.6</version>
<version>7.7</version>
</dependency>
<dependency>
@@ -106,7 +106,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.0</version>
<version>1.1</version>
<scope>test</scope>
</dependency>
@@ -300,7 +300,7 @@ public interface Database {
* Create a new instance of T that is an EntityBean.
* <p>
* Useful if you use BeanPostConstructListeners or &#64;PostConstruct Annotations.
* In this case you should not use "new Bean...()". Making all bean construtors protected
* In this case you should not use "new Bean...()". Making all bean constructors protected
* could be a good idea here.
* </p>
*/
@@ -246,6 +246,16 @@ public interface SqlQuery extends Serializable, CancelableQuery {
*/
SqlQuery setParameter(Object value);
/**
* Set a null parameter by position.
*/
SqlQuery setNullParameter(int position, int jdbcType);
/**
* Set a null parameter by name.
*/
SqlQuery setNullParameter(String name, int jdbcType);
/**
* Bind the parameter by its index position (1 based like JDBC).
* <p>
@@ -98,4 +98,14 @@ public class Version<T> {
public Map<String, ValuePair> getDiff() {
return diff;
}
@Override
public String toString() {
return "Version{" +
"bean=" + bean +
", start=" + start +
", end=" + end +
", diff=" + diff +
'}';
}
}
@@ -360,7 +360,7 @@ public final class EntityBeanIntercept implements Serializable {
* Return true if the entity should be updated.
*/
public boolean isUpdate() {
return forceUpdate || state == STATE_LOADED;
return forceUpdate || state == STATE_LOADED || state == STATE_REFERENCE;
}
/**
@@ -829,7 +829,7 @@ public final class EntityBeanIntercept implements Serializable {
/**
* Load the bean when it is a reference.
*/
protected void loadBean(int loadProperty) {
void loadBean(int loadProperty) {
lock.lock();
try {
if (beanLoader == null) {
@@ -886,7 +886,7 @@ public final class EntityBeanIntercept implements Serializable {
* Helper method to check if two objects are equal.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
protected static boolean notEqual(Object obj1, Object obj2) {
static boolean notEqual(Object obj1, Object obj2) {
if (obj1 == null) {
return (obj2 != null);
}
@@ -117,7 +117,7 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
try {
if (set == null) {
if (!disableLazyLoad && modifyListening) {
lazyLoadCollection(true);
lazyLoadCollection(false);
} else {
set = new LinkedHashSet<>();
}
@@ -134,7 +134,7 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
if (disableLazyLoad) {
set = new LinkedHashSet<>();
} else {
lazyLoadCollection(true);
lazyLoadCollection(false);
}
}
} finally {
@@ -0,0 +1,42 @@
package io.ebean.config;
import java.util.concurrent.Callable;
/**
* BackgroundExecutorWrapper that can be used to wrap tasks that are sent to background (i.e. another thread).
* It should copy all necessary thread-local variables. See {@link MdcBackgroundExecutorWrapper} for implementation details.
*
* @author Roland Praml, FOCONIS AG
*/
public interface BackgroundExecutorWrapper {
/**
* Wrap the task with MDC context if defined.
*/
<T> Callable<T> wrap(Callable<T> task);
/**
* Wrap the task with MDC context if defined.
*/
Runnable wrap(Runnable task);
/**
* Combines two wrappers by nesting them.
*/
default BackgroundExecutorWrapper with(BackgroundExecutorWrapper inner) {
return new BackgroundExecutorWrapper() {
@Override
public Runnable wrap(Runnable task) {
return BackgroundExecutorWrapper.this.wrap(inner.wrap(task));
}
@Override
public <T> Callable<T> wrap(Callable<T> task) {
return BackgroundExecutorWrapper.this.wrap(inner.wrap(task));
}
};
}
}
@@ -445,6 +445,7 @@ public class DatabaseConfig {
private int backgroundExecutorSchedulePoolSize = 1;
private int backgroundExecutorShutdownSecs = 30;
private BackgroundExecutorWrapper backgroundExecutorWrapper = new MdcBackgroundExecutorWrapper();
// defaults for the L2 bean caching
@@ -1463,6 +1464,20 @@ public class DatabaseConfig {
this.backgroundExecutorShutdownSecs = backgroundExecutorShutdownSecs;
}
/**
* Return the background executor wrapper.
*/
public BackgroundExecutorWrapper getBackgroundExecutorWrapper() {
return backgroundExecutorWrapper;
}
/**
* Sets the background executor wrapper. The wrapper is used when a task is sent to background and should copy the thread-locals.
*/
public void setBackgroundExecutorWrapper(BackgroundExecutorWrapper backgroundExecutorWrapper) {
this.backgroundExecutorWrapper = backgroundExecutorWrapper;
}
/**
* Return the L2 cache default max size.
*/
@@ -2884,6 +2899,7 @@ public class DatabaseConfig {
backgroundExecutorSchedulePoolSize = p.getInt("backgroundExecutorSchedulePoolSize", backgroundExecutorSchedulePoolSize);
backgroundExecutorShutdownSecs = p.getInt("backgroundExecutorShutdownSecs", backgroundExecutorShutdownSecs);
backgroundExecutorWrapper = p.createInstance(BackgroundExecutorWrapper.class, "backgroundExecutorWrapper", backgroundExecutorWrapper);
disableClasspathSearch = p.getBoolean("disableClasspathSearch", disableClasspathSearch);
currentUserProvider = p.createInstance(CurrentUserProvider.class, "currentUserProvider", currentUserProvider);
databasePlatform = p.createInstance(DatabasePlatform.class, "databasePlatform", databasePlatform);
@@ -184,17 +184,4 @@ public class DbConstraintNaming {
return normalise.normaliseColumn(tableName);
}
/**
* Lower case the table name checking for quoted identifiers.
*/
public String lowerTableName(String tableName) {
return normalise.lowerTableName(tableName);
}
/**
* Lower case the column name checking for quoted identifiers.
*/
public String lowerColumnName(String name) {
return normalise.lowerColumnName(name);
}
}
@@ -55,53 +55,19 @@ public class DbConstraintNormalise {
return value.replace("(","").replace(")","");
}
/**
* Lower case the table name checking for quoted identifiers.
*/
public String lowerTableName(String tableName) {
if (lowerCaseTables && notQuoted(tableName)) {
return tableName.toLowerCase();
}
return tableName;
}
/**
* Lower case the column name checking for quoted identifiers.
*/
public String lowerColumnName(String name) {
if (lowerCaseColumns && notQuoted(name)) {
return name.toLowerCase();
}
return name;
}
/**
* Trim off the platform quoted identifier quotes like [ ' and ".
*/
public boolean notQuoted(String tableName) {
public String trimQuotes(String identifier) {
// remove quoted identifier characters
for (String quotedIdentifier : quotedIdentifiers) {
if (tableName.contains(quotedIdentifier)) {
return false;
}
}
return true;
}
/**
* Trim off the platform quoted identifier quotes like [ ' and ".
*/
public String trimQuotes(String tableName) {
if (tableName == null) {
if (identifier == null) {
return "";
}
// remove quoted identifier characters
for (String quotedIdentifier : quotedIdentifiers) {
tableName = tableName.replace(quotedIdentifier, "");
identifier = identifier.replace(quotedIdentifier, "");
}
return tableName;
return identifier;
}
@@ -0,0 +1,52 @@
package io.ebean.config;
import org.slf4j.MDC;
import java.util.Map;
import java.util.concurrent.Callable;
/**
* Propagates MDC context for tasks executed in the background.
*/
public final class MdcBackgroundExecutorWrapper implements BackgroundExecutorWrapper {
/**
* Wrap the task with MDC context if defined.
*/
@Override
public <T> Callable<T> wrap(Callable<T> task) {
final Map<String, String> map = MDC.getCopyOfContextMap();
if (map == null) {
return task;
} else {
return () -> {
MDC.setContextMap(map);
try {
return task.call();
} finally {
MDC.clear();
}
};
}
}
/**
* Wrap the task with MDC context if defined.
*/
@Override
public Runnable wrap(Runnable task) {
final Map<String, String> map = MDC.getCopyOfContextMap();
if (map == null) {
return task;
} else {
return () -> {
MDC.setContextMap(map);
try {
task.run();
} finally {
MDC.clear();
}
};
}
}
}
@@ -165,7 +165,7 @@ public class DatabasePlatform {
* want to use quoted identifiers for. The backticks get converted to the
* appropriate characters in convertQuotedIdentifiers
*/
private static final char BACK_TICK = '`';
private static final char[] QUOTED_IDENTIFIERS = new char[] { '"', '\'', '[', ']', '`' };
/**
* The non-escaped like clause (to stop slash being escaped on some platforms).
@@ -606,13 +606,6 @@ public class DatabasePlatform {
this.useMigrationStoredProcedures = useMigrationStoredProcedures;
}
/**
* Normally not needed - overridden in CockroachPlatform.
*/
public boolean isDdlAutoCommit() {
return false;
}
/**
* Return the DB identity/sequence features for this platform.
*
@@ -669,8 +662,8 @@ public class DatabasePlatform {
public String convertQuotedIdentifiers(String dbName) {
// Ignore null values e.g. schema name or catalog
if (dbName != null && !dbName.isEmpty()) {
if (dbName.charAt(0) == BACK_TICK) {
if (dbName.charAt(dbName.length() - 1) == BACK_TICK) {
if (isQuote(dbName.charAt(0))) {
if (isQuote(dbName.charAt(dbName.length() - 1))) {
return openQuote + dbName.substring(1, dbName.length() - 1) + closeQuote;
} else {
log.error("Missing backquote on [" + dbName + "]");
@@ -682,6 +675,15 @@ public class DatabasePlatform {
return dbName;
}
private boolean isQuote(char ch) {
for (char identifer : QUOTED_IDENTIFIERS) {
if (identifer == ch) {
return true;
}
}
return false;
}
/**
* Remove quoted identifier quotes from the table or column name if present.
*/
@@ -18,6 +18,8 @@ public class ClickHousePlatform extends DatabasePlatform {
//this.exceptionTranslator =
this.nativeUuidType = true;
this.dbDefaultValue.setNow("now()");
this.dbDefaultValue.setFalse("0");
this.dbDefaultValue.setTrue("1");
this.dbIdentity.setIdType(IdType.IDENTITY);
this.dbIdentity.setSupportsGetGeneratedKeys(false);
@@ -11,18 +11,7 @@ public class CockroachPlatform extends PostgresPlatform {
public CockroachPlatform() {
super();
this.platform = Platform.COCKROACH;
// no like escape clause supported
this.likeSpecialCharacters = new char[]{'%', '_'};
this.likeClauseRaw = "like ?";
this.likeClauseEscaped = "like ?";
}
/**
* Needs a commit after create index such that alter table add foreign key ... succeeds.
*/
@Override
public boolean isDdlAutoCommit() {
return true;
this.historySupport = null; // not yet implemented in DDL
}
}
@@ -1,7 +1,6 @@
package io.ebean.config.dbplatform.db2;
import io.ebean.BackgroundExecutor;
import io.ebean.annotation.PersistBatch;
import io.ebean.annotation.Platform;
import io.ebean.config.dbplatform.DatabasePlatform;
import io.ebean.config.dbplatform.DbPlatformType;
@@ -37,6 +36,7 @@ public abstract class BaseDB2Platform extends DatabasePlatform {
.addDataIntegrity("23502","23503","23504","23511","23512","23511","42917","23515")
.build();
historySupport = new DB2HistorySupport();
booleanDbType = Types.BOOLEAN;
dbTypeMap.put(DbType.TINYINT, new DbPlatformType("smallint", false));
dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false));
@@ -0,0 +1,30 @@
package io.ebean.config.dbplatform.db2;
import io.ebean.config.dbplatform.DbStandardHistorySupport;
/**
* DB2 based history support.
*/
public class DB2HistorySupport extends DbStandardHistorySupport {
@Override
public String getAsOfViewSuffix(String asOfViewSuffix) {
return " for system_time as of ?";
}
@Override
public String getVersionsBetweenSuffix(String asOfViewSuffix) {
return " for system_time between ? and ?";
}
@Override
public String getSysPeriodLower(String tableAlias, String sysPeriod) {
return tableAlias + "." + sysPeriod + "_start";
}
@Override
public String getSysPeriodUpper(String tableAlias, String sysPeriod) {
return tableAlias + "." + sysPeriod + "_end";
}
}
@@ -5,6 +5,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.*;
import java.time.LocalDateTime;
import java.util.Arrays;
/**
@@ -76,7 +77,7 @@ public class H2HistoryTrigger implements Trigger {
public void fire(Connection connection, Object[] oldRow, Object[] newRow) throws SQLException {
if (oldRow != null) {
// a delete or update event
Timestamp now = new Timestamp(System.currentTimeMillis());
LocalDateTime now = LocalDateTime.now();
oldRow[effectEndPosition] = now;
if (newRow != null) {
// update event. Set the effective start timestamp to now.
@@ -92,4 +92,8 @@ public class HanaPlatform extends DatabasePlatform {
}
}
@Override
public boolean isUseMigrationStoredProcedures() {
return true;
}
}
@@ -12,11 +12,18 @@ import io.ebean.bean.PersistenceContext;
*/
public interface JsonBeanReader<T> {
/**
* Read the JSON into given bean. Will update existing properties.
*/
T read(T target);
/**
* Read the JSON returning a bean.
*/
T read();
default T read() {
return read(null);
}
/**
* Create a new reader taking the context from the existing one but using a new JsonParser.
*/
@@ -58,12 +58,60 @@ public interface JsonContext {
*/
<T> T toBean(Class<T> cls, JsonParser parser, JsonReadOptions options) throws JsonIOException;
/**
* Read json parser input into a given Bean. <br>
* Note: This is a kind of "update". Only properties in the json will be modified. Embedded Lists and Maps will become new
* instances, so the object identity will not be preserved here.
*
* @throws JsonIOException When IOException occurs
*/
<T> void toBean(T target, JsonParser parser) throws JsonIOException;
/**
* Read json parser input into a given Bean additionally using JsonReadOptions.<br>
* See {@link #toBean(Class, JsonParser)} for details modified.
*
* @throws JsonIOException When IOException occurs
*/
<T> void toBean(T target, JsonParser parser, JsonReadOptions options) throws JsonIOException;
/**
* Read json reader input into a given Bean.<br>
* See {@link #toBean(Class, JsonParser)} for details
*
* @throws JsonIOException When IOException occurs
*/
<T> void toBean(T target, Reader json) throws JsonIOException;
/**
* Read json reader input into a given Bean additionally using JsonReadOptions.<br>
* See {@link #toBean(Class, JsonParser)} for details modified.
*
* @throws JsonIOException When IOException occurs
*/
<T> void toBean(T target, Reader json, JsonReadOptions options) throws JsonIOException;
/**
* Read json string input into a given Bean.<br>
* See {@link #toBean(Class, JsonParser)} for details
*
* @throws JsonIOException When IOException occurs
*/
<T> void toBean(T target, String json) throws JsonIOException;
/**
* Read json string input into a given Bean additionally using JsonReadOptions.<br>
* See {@link #toBean(Class, JsonParser)} for details
*
* @throws JsonIOException When IOException occurs
*/
<T> void toBean(T target, String json, JsonReadOptions options) throws JsonIOException;
/**
* Create and return a new bean reading for the bean type given the JSON options and source.
* <p>
* Note that JsonOption provides an option for setting a persistence context and also enabling
* further lazy loading. Further lazy loading requires a persistence context so if that is set
* on then a persistence context is created if there is not one set.
* Note that JsonOption provides an option for setting a persistence context and also enabling further lazy loading. Further lazy
* loading requires a persistence context so if that is set on then a persistence context is created if there is not one set.
*/
<T> JsonBeanReader<T> createBeanReader(Class<T> cls, JsonParser parser, JsonReadOptions options) throws JsonIOException;
+2 -1
View File
@@ -10,13 +10,13 @@ module io.ebean.api {
requires transitive java.sql;
requires transitive io.avaje.config;
requires transitive io.avaje.lang;
requires transitive persistence.api;
requires transitive io.ebean.annotation;
requires transitive io.ebean.datasource.api;
requires transitive org.slf4j;
requires static io.ebean.types;
requires static io.avaje.jsr305x;
requires static com.fasterxml.jackson.core;
requires static javax.servlet.api;
requires static com.h2database;
@@ -41,6 +41,7 @@ module io.ebean.api {
exports io.ebean.config.dbplatform.sqlanywhere;
exports io.ebean.config.dbplatform.sqlite;
exports io.ebean.config.dbplatform.sqlserver;
exports io.ebean.config.dbplatform.yugabyte;
exports io.ebean.event;
exports io.ebean.event.readaudit;
exports io.ebean.event.changelog;
@@ -0,0 +1,29 @@
package io.ebean;
import org.junit.jupiter.api.Test;
import java.util.Properties;
import static org.junit.jupiter.api.Assertions.*;
class DbPrimaryTest {
@Test
void testIsSkipPrimaryServer() {
DbPrimary.setSkip(true);
assertTrue(DbPrimary.isSkip());
DbPrimary.setSkip(false);
assertFalse(DbPrimary.isSkip());
}
@Test
void testGetPrimaryServerName() {
assertEquals("h2", DbPrimary.getDefaultServerName());
}
@Test
void testLoadProperties() {
Properties properties = DbPrimary.getProperties();
assertFalse(properties.isEmpty());
}
}
@@ -1,8 +1,5 @@
package io.ebean.config.dbplatform;
import io.ebean.BaseTestCase;
import io.ebean.DB;
import io.ebean.annotation.ForPlatform;
import io.ebean.annotation.Platform;
import io.ebean.config.DatabaseConfig;
import io.ebean.config.MatchingNamingConvention;
@@ -12,45 +9,9 @@ import io.ebean.config.dbplatform.postgres.PostgresPlatform;
import io.ebean.config.dbplatform.sqlserver.SqlServer17Platform;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class DatabasePlatformTest extends BaseTestCase {
@Test
@ForPlatform(Platform.H2)
public void h2_platform() {
final Platform platform = DB.getDefault().platform();
assertThat(platform).isSameAs(Platform.H2);
}
@Test
@ForPlatform(Platform.POSTGRES)
public void postgres_platform() {
final Platform platform = DB.getDefault().platform().base();
assertThat(platform).isSameAs(Platform.POSTGRES);
}
@Test
@ForPlatform(Platform.MYSQL)
public void mysql_platform() {
final Platform platform = DB.getDefault().platform().base();
assertThat(platform).isSameAs(Platform.MYSQL);
}
@Test
@ForPlatform(Platform.MARIADB)
public void mariadb_platform() {
final Platform platform = DB.getDefault().platform().base();
assertThat(platform).isSameAs(Platform.MARIADB);
}
@Test
@ForPlatform(Platform.SQLSERVER)
public void sqlserver_platform() {
final Platform platform = DB.getDefault().platform().base();
assertThat(platform).isSameAs(Platform.SQLSERVER);
}
class DatabasePlatformTest {
@Test
public void convertQuotedIdentifiers_when_allQuotedIdentifier_sqlServer() {
@@ -1,5 +1,6 @@
package io.ebean.config.dbplatform;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.sql.Types;
@@ -13,7 +14,7 @@ public class DbPlatformTypeLookupTest {
@Test
public void byName() throws Exception {
assertEquals(lookup.byName("DECIMAL"), DbType.DECIMAL);
Assertions.assertEquals(lookup.byName("DECIMAL"), DbType.DECIMAL);
assertEquals(lookup.byName("Decimal"), DbType.DECIMAL);
assertEquals(lookup.byName("decimal"), DbType.DECIMAL);
@@ -1,25 +1,12 @@
package io.ebean.text;
import io.ebean.BaseTestCase;
import io.ebean.DB;
import io.ebean.FetchPath;
import io.ebean.Query;
import io.ebean.test.LoggedSql;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tests.model.basic.Customer;
import org.tests.model.basic.ResetBasicData;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
public class PathPropertiesTests extends BaseTestCase {
private static final Logger log = LoggerFactory.getLogger(PathPropertiesTests.class);
public class PathPropertiesTests {
@Test
public void test_noParentheses() {
@@ -197,34 +184,4 @@ public class PathPropertiesTests extends BaseTestCase {
assertFalse(root.includesPath("customer", "shippingAddress"));
}
@Test
public void example_withQueryAndJson() {
ResetBasicData.reset();
PathProperties pathProps = PathProperties.parse("id,name,billingAddress(city),shippingAddress(*))");
Query<Customer> query = DB.find(Customer.class)
.where().lt("id", 2)
.query();
pathProps.apply(query);
List<Customer> list = query.findList();
String asJson = DB.json().toJson(list, pathProps);
log.info("Json: {}", asJson);
}
@Test
public void test_withAllPropsQuery() {
PathProperties root = PathProperties.parse("*,billingAddress(line1)");
LoggedSql.start();
Query<Customer> query = DB.find(Customer.class).apply(root);
query.findList();
List<String> sql = LoggedSql.stop();
assertThat(sql).hasSize(1);
assertThat(sql.get(0)).contains("select t0.id, t0.status, t0.name, t0.smallnote, t0.anniversary, t0.cretime, t0.updtime, t0.version, t0.shipping_address_id, t1.id, t1.line_1 from o_customer t0 left join o_address t1 on t1.id = t0.billing_address_id;");
}
}
@@ -2,7 +2,6 @@ package io.ebean.util;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.util.Set;
import org.junit.jupiter.api.Test;
@@ -0,0 +1 @@
datasource.default=h2
+4 -4
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.15.0</version>
<version>12.16.3</version>
</parent>
<!-- <parent>-->
<!-- <groupId>org.avaje</groupId>-->
@@ -14,7 +14,7 @@
<scm>
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
<tag>ebean-parent-12.15.0</tag>
<tag>HEAD</tag>
</scm>
<name>ebean autotune</name>
@@ -26,7 +26,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
<scope>provided</scope>
</dependency>
@@ -48,7 +48,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.0</version>
<version>1.1</version>
<scope>test</scope>
</dependency>
+15 -15
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.15.0</version>
<version>12.16.3</version>
</parent>
<name>ebean bom</name>
@@ -71,88 +71,88 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-ddl-generator</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-api</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-xml</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-autotune</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>querybean-generator</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>kotlin-querybean-generator</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-postgis</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-redis</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
</dependencies>
+2 -2
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.15.0</version>
<version>12.16.3</version>
</parent>
<artifactId>ebean-core-type</artifactId>
@@ -16,7 +16,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
+9 -9
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>12.15.0</version>
<version>12.16.3</version>
</parent>
<artifactId>ebean-core</artifactId>
@@ -15,7 +15,7 @@
<scm>
<developerConnection>scm:git:git@github.com:ebean-orm/ebean.git</developerConnection>
<tag>ebean-parent-12.15.0</tag>
<tag>HEAD</tag>
</scm>
<dependencies>
@@ -23,7 +23,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-ddl-runner</artifactId>
<version>1.2</version>
<version>${ebean-ddl-runner.version}</version>
</dependency>
<dependency>
@@ -35,25 +35,25 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-migration-auto</artifactId>
<version>1.1</version>
<version>${ebean-migration-auto.version}</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-externalmapping-api</artifactId>
<version>12.15.0</version>
<version>12.16.3</version>
</dependency>
<dependency>
@@ -136,7 +136,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.3.2</version>
<version>42.3.3</version>
<optional>true</optional>
</dependency>
@@ -152,7 +152,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.0</version>
<version>1.1</version>
<scope>test</scope>
</dependency>
@@ -167,7 +167,7 @@ public final class BindParams implements Serializable {
*/
@SuppressWarnings("rawtypes")
public void setParameter(int position, Object value) {
assert value != null : "use setNullParameter";
//TODO: Review - assert value != null : "use setNullParameter";
Param p = getParam(position);
if (value instanceof Collection) {
// use of postgres ANY with positioned parameter
@@ -219,7 +219,7 @@ public final class BindParams implements Serializable {
* Set a named In parameter that is not null.
*/
public Param setParameter(String name, Object value) {
assert value != null : "use setNullParameter";
// TODO: Review - assert value != null : "use setNullParameter";
Param p = getParam(name);
p.setInValue(value);
return p;
@@ -35,7 +35,7 @@ public final class CacheIdLookupMany<T> implements CacheIdLookup<T> {
@Override
public List<T> removeHits(BeanCacheResult<T> cacheResult) {
Set<Object> hitIds = new HashSet<>();
List<T> beans = new ArrayList<>(hitIds.size());
List<T> beans = new ArrayList<>();
for (BeanCacheResult.Entry<T> hit : cacheResult.hits()) {
hitIds.add(hit.getKey());
beans.add(hit.getBean());
@@ -4,7 +4,7 @@ import io.ebean.bean.EntityBeanIntercept;
import io.ebean.bean.PersistenceContext;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import java.util.List;
import java.util.Set;
/**
* A buffer of beans for batch lazy loading and secondary query loading.
@@ -13,7 +13,7 @@ public interface LoadBeanBuffer {
int batchSize();
List<EntityBeanIntercept> batch();
Set<EntityBeanIntercept> batch();
BeanDescriptor<?> descriptor();
@@ -16,7 +16,7 @@ import java.util.Set;
*/
public final class LoadBeanRequest extends LoadRequest {
private final List<EntityBeanIntercept> batch;
private final Set<EntityBeanIntercept> batch;
private final LoadBeanBuffer loadBuffer;
private final String lazyLoadProperty;
private final boolean loadCache;
@@ -58,7 +58,7 @@ public final class LoadBeanRequest extends LoadRequest {
/**
* Return the batch of beans to actually load.
*/
public List<EntityBeanIntercept> batch() {
public Set<EntityBeanIntercept> batch() {
return batch;
}
@@ -97,8 +97,12 @@ public final class LoadManyRequest extends LoadRequest {
// potentially changes the joins, selected properties, cache mode
loadContext.configureQuery(query);
if (onlyIds) {
// lazy loading invoked via clear() and removeAll()
query.select(many.targetIdProperty());
String mapKey = many.mapKey();
if (mapKey != null) {
query.select(mapKey);
} else {
query.select(many.targetIdProperty());
}
}
return query;
}
@@ -3,8 +3,6 @@ package io.ebeaninternal.api;
import io.ebean.*;
import io.ebean.bean.BeanCollectionLoader;
import io.ebean.bean.CallOrigin;
import io.ebean.config.DatabaseConfig;
import io.ebean.config.dbplatform.DatabasePlatform;
import io.ebean.event.readaudit.ReadAuditLogger;
import io.ebean.event.readaudit.ReadAuditPrepare;
import io.ebean.meta.MetricVisitor;
@@ -1,6 +1,5 @@
package io.ebeaninternal.api;
import io.ebean.meta.QueryPlanRequest;
import io.ebeaninternal.server.type.bindcapture.BindCapture;
/**
@@ -5,7 +5,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
import io.ebean.event.changelog.BeanChange;
import io.ebean.event.changelog.ChangeSet;
import io.ebean.event.changelog.ChangeType;
import io.ebean.text.json.JsonContext;
import java.io.IOException;
import java.io.Writer;
@@ -15,8 +15,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.concurrent.locks.ReentrantLock;
import javax.persistence.PersistenceException;
/**
* Wraps the objects involved in executing a SQL / Relational Query.
*/
@@ -5,7 +5,6 @@ import io.avaje.classpath.scanner.ClassPathScannerFactory;
import io.ebean.config.DatabaseConfig;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
@@ -106,7 +106,9 @@ final class DScriptRunner implements ScriptRunner {
try (Connection connection = obtainConnection()) {
DdlRunner runner = new DdlRunner(useAutoCommit, scriptName, platformName);
runner.runAll(content, connection);
connection.commit();
if (!connection.getAutoCommit()) {
connection.commit();
}
runner.runNonTransactional(connection);
}
@@ -2,7 +2,6 @@ package io.ebeaninternal.server.core;
import io.ebean.CacheMode;
import io.ebean.ExpressionList;
import io.ebean.Transaction;
import io.ebean.bean.BeanCollection;
import io.ebean.bean.EntityBean;
import io.ebean.bean.EntityBeanIntercept;
@@ -17,6 +16,7 @@ import org.slf4j.Logger;
import javax.persistence.EntityNotFoundException;
import java.util.List;
import java.util.Set;
/**
* Helper to handle lazy loading and refreshing of beans.
@@ -39,14 +39,14 @@ final class DefaultBeanLoader {
}
void loadMany(BeanCollection<?> bc, boolean onlyIds) {
loadManyInternal(bc.getOwnerBean(), bc.getPropertyName(), null, false, onlyIds);
loadManyInternal(bc.getOwnerBean(), bc.getPropertyName(), false, onlyIds);
}
void refreshMany(EntityBean parentBean, String propertyName) {
loadManyInternal(parentBean, propertyName, null, true, false);
loadManyInternal(parentBean, propertyName, true, false);
}
private void loadManyInternal(EntityBean parentBean, String propertyName, Transaction t, boolean refresh, boolean onlyIds) {
private void loadManyInternal(EntityBean parentBean, String propertyName, boolean refresh, boolean onlyIds) {
EntityBeanIntercept ebi = parentBean._ebean_getIntercept();
PersistenceContext pc = ebi.getPersistenceContext();
BeanDescriptor<?> parentDesc = server.descriptor(parentBean.getClass());
@@ -105,7 +105,7 @@ final class DefaultBeanLoader {
query.setReadOnly(true);
}
server.findOne(query, t);
server.findOne(query, null);
if (beanCollection != null) {
if (beanCollection.checkEmptyLazyLoad()) {
if (log.isDebugEnabled()) {
@@ -121,7 +121,7 @@ final class DefaultBeanLoader {
* Load a batch of beans for +query or +lazy loading.
*/
void loadBean(LoadBeanRequest loadRequest) {
List<EntityBeanIntercept> batch = loadRequest.batch();
Set<EntityBeanIntercept> batch = loadRequest.batch();
if (batch.isEmpty()) {
throw new RuntimeException("Nothing in batch?");
}
@@ -199,7 +199,7 @@ final class DefaultBeanLoader {
query.setLazyLoadProperty(ebi.getLazyLoadProperty());
if (draft) {
query.asDraft();
} else {
} else if (mode == SpiQuery.Mode.LAZYLOAD_BEAN) {
query.setIncludeSoftDeletes();
}
if (embeddedOwnerIndex > -1) {
@@ -1,5 +1,6 @@
package io.ebeaninternal.server.core;
import io.ebean.config.BackgroundExecutorWrapper;
import io.ebean.config.ContainerConfig;
import io.ebean.config.DatabaseConfig;
import io.ebean.config.DatabaseConfigProvider;
@@ -67,7 +68,8 @@ public final class DefaultContainer implements SpiContainer {
String namePrefix = "ebean-" + config.getName();
int schedulePoolSize = config.getBackgroundExecutorSchedulePoolSize();
int shutdownSecs = config.getBackgroundExecutorShutdownSecs();
return new DefaultBackgroundExecutor(schedulePoolSize, shutdownSecs, namePrefix);
BackgroundExecutorWrapper wrapper = config.getBackgroundExecutorWrapper();
return new DefaultBackgroundExecutor(schedulePoolSize, shutdownSecs, namePrefix, wrapper);
}
/**
@@ -373,7 +373,9 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
migrationRunner.setDefaultDbSchema(dbSchema);
}
migrationRunner.setName(config.getName());
migrationRunner.setPlatform(config.getDatabasePlatform().getPlatform().base().name().toLowerCase());
Platform platform = config.getDatabasePlatform().getPlatform();
migrationRunner.setBasePlatform(platform.base().name().toLowerCase());
migrationRunner.setPlatform(platform.name().toLowerCase());
migrationRunner.loadProperties(config.getProperties());
migrationRunner.run(config.getDataSource());
}
@@ -280,7 +280,7 @@ public final class InternalConfiguration {
private MultiValueBind createMultiValueBind(Platform platform) {
// only Postgres at this stage
if (platform.base() == Platform.POSTGRES || platform.base() == Platform.YUGABYTE) {
if (platform.base() == Platform.POSTGRES || platform.base() == Platform.YUGABYTE || platform.base() == Platform.COCKROACH) {
return new PostgresMultiValueBind();
}
return new MultiValueBind();
@@ -445,6 +445,9 @@ public final class InternalConfiguration {
*/
private DataTimeZone initDataTimeZone() {
String tz = config.getDataTimeZone();
if ("NoTimeZone".equals(tz)) {
return new NoDataTimeZone();
}
if (tz == null) {
if (isMySql(getPlatform())) {
return new MySqlDataTimeZone();
@@ -3,6 +3,7 @@ package io.ebeaninternal.server.deploy;
import io.ebean.bean.EntityBean;
import io.ebean.bean.PersistenceContext;
import io.ebeaninternal.server.query.SqlJoinType;
import io.ebeaninternal.server.query.SqlTreeJoin;
import java.sql.SQLException;
@@ -60,11 +61,28 @@ final class AssocOneHelpRefInherit extends AssocOneHelp {
return ref;
}
@Override
void appendFrom(DbSqlContext ctx, SqlJoinType joinType) {
// add join to support the discriminator column
String relativePrefix = ctx.getRelativePrefix(property.name);
property.tableJoin.addJoin(joinType, relativePrefix, ctx);
ctx.addExtraJoin(new Extra(relativePrefix, joinType));
}
/**
* Extra join to support the discriminator column.
*/
final class Extra implements SqlTreeJoin {
final String relativePrefix;
final SqlJoinType joinType;
Extra(String relativePrefix, SqlJoinType joinType) {
this.relativePrefix = relativePrefix;
this.joinType = joinType;
}
@Override
public void addJoin(DbSqlContext ctx) {
// add join to support the discriminator column *IF* join is not already present
property.tableJoin.addJoin(joinType, relativePrefix, ctx);
}
}
/**
@@ -121,6 +121,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
private final boolean softDelete;
private final String draftTable;
private final PartitionMeta partitionMeta;
private final TablespaceMeta tablespaceMeta;
private final String storageEngine;
private final String dbComment;
private final boolean readAuditing;
@@ -275,6 +276,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
this.dependentTables = deploy.getDependentTables();
this.dbComment = deploy.getDbComment();
this.partitionMeta = deploy.getPartitionMeta();
this.tablespaceMeta = deploy.getTablespaceMeta();
this.storageEngine = deploy.getStorageEngine();
this.autoTunable = beanFinder == null && (entityType == EntityType.ORM || entityType == EntityType.VIEW);
// helper object used to derive lists of properties
@@ -1310,8 +1312,8 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* Hit the bean cache trying to load a list/batch of entities.
* Return the set of entities that were successfully loaded from L2 cache.
*/
public Set<EntityBeanIntercept> cacheBeanLoadAll(List<EntityBeanIntercept> list, PersistenceContext persistenceContext, int lazyLoadProperty, String propertyName) {
return cacheHelp.beanCacheLoadAll(list, persistenceContext, lazyLoadProperty, propertyName);
public Set<EntityBeanIntercept> cacheBeanLoadAll(Set<EntityBeanIntercept> batch, PersistenceContext persistenceContext, int lazyLoadProperty, String propertyName) {
return cacheHelp.beanCacheLoadAll(batch, persistenceContext, lazyLoadProperty, propertyName);
}
/**
@@ -2671,6 +2673,13 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
public PartitionMeta partitionMeta() {
return partitionMeta;
}
/**
* Return the tablespace details of the bean.
*/
public TablespaceMeta tablespaceMeta() {
return tablespaceMeta;
}
/**
* Return the storage engine.
@@ -3372,12 +3381,12 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
jsonHelp.jsonWriteProperties(writeJson, bean);
}
public T jsonRead(SpiJsonReader jsonRead, String path) throws IOException {
return jsonHelp.jsonRead(jsonRead, path, true);
public T jsonRead(SpiJsonReader jsonRead, String path, T target) throws IOException {
return jsonHelp.jsonRead(jsonRead, path, true, target);
}
T jsonReadObject(SpiJsonReader jsonRead, String path) throws IOException {
return jsonHelp.jsonRead(jsonRead, path, false);
T jsonReadObject(SpiJsonReader jsonRead, String path, T target) throws IOException {
return jsonHelp.jsonRead(jsonRead, path, false, target);
}
public List<BeanProperty[]> uniqueProps() {
@@ -693,9 +693,9 @@ final class BeanDescriptorCacheHelp<T> {
/**
* Load a batch of entities from L2 bean cache checking the lazy loaded property is loaded.
*/
Set<EntityBeanIntercept> beanCacheLoadAll(List<EntityBeanIntercept> list, PersistenceContext context, int lazyLoadProperty, String propertyName) {
Set<EntityBeanIntercept> beanCacheLoadAll(Set<EntityBeanIntercept> batch, PersistenceContext context, int lazyLoadProperty, String propertyName) {
Map<Object, EntityBeanIntercept> ebis = new HashMap<>();
for (EntityBeanIntercept ebi : list) {
for (EntityBeanIntercept ebi : batch) {
ebis.put(desc.cacheKeyForBean(ebi.getOwner()), ebi);
}
@@ -716,7 +716,6 @@ final class BeanDescriptorCacheHelp<T> {
if (beanLog.isTraceEnabled()) {
beanLog.trace(" load {}({}) - cache miss on property({})", cacheName, key, propertyName);
}
iterator.remove();
} else {
CachedBeanDataToBean.load(desc, ebi.getOwner(), cacheData, context);
loaded.add(ebi);
@@ -61,13 +61,13 @@ class BeanDescriptorElementEmbedded<T> extends BeanDescriptorElement<T> {
}
@Override
public T jsonRead(SpiJsonReader jsonRead, String path) throws IOException {
return readJsonElement(jsonRead, path);
public T jsonRead(SpiJsonReader jsonRead, String path, T target) throws IOException {
return readJsonElement(jsonRead, path, target);
}
@SuppressWarnings("unchecked")
T readJsonElement(SpiJsonReader jsonRead, String path) throws IOException {
return (T)targetDescriptor.jsonRead(jsonRead, path);
T readJsonElement(SpiJsonReader jsonRead, String path, T target) throws IOException {
return (T)targetDescriptor.jsonRead(jsonRead, path, target);
}
void writeJsonElement(SpiJsonWriter ctx, Object element) {
@@ -58,13 +58,13 @@ class BeanDescriptorElementEmbeddedMap<T> extends BeanDescriptorElementEmbedded<
}
if (stringKey) {
parser.nextToken();
Object val = readJsonElement(readJson, null);
Object val = readJsonElement(readJson, null, null); // CHECKME: Update existing map entry here?
add.addKeyValue(fieldName, val);
} else {
parser.nextFieldName();
Object key = scalarTypeKey.jsonRead(parser);
parser.nextFieldName();
Object val = readJsonElement(readJson, null);
Object val = readJsonElement(readJson, null, null); // CHECKME: Update existing map entry here?
add.addKeyValue(key, val);
}
} while (true);
@@ -65,7 +65,7 @@ final class BeanDescriptorJsonHelp<T> {
}
@SuppressWarnings("unchecked")
T jsonRead(SpiJsonReader jsonRead, String path, boolean withInheritance) throws IOException {
T jsonRead(SpiJsonReader jsonRead, String path, boolean withInheritance, T target) throws IOException {
JsonParser parser = jsonRead.getParser();
//noinspection StatementWithEmptyBody
if (parser.getCurrentToken() == JsonToken.START_OBJECT) {
@@ -82,7 +82,7 @@ final class BeanDescriptorJsonHelp<T> {
}
if (desc.inheritInfo == null || !withInheritance) {
return jsonReadObject(jsonRead, path);
return jsonReadObject(jsonRead, path, target);
}
ObjectNode node = jsonRead.getObjectMapper().readTree(parser);
@@ -97,17 +97,25 @@ final class BeanDescriptorJsonHelp<T> {
JsonNode discNode = node.get(discColumn);
if (discNode == null || discNode.isNull()) {
if (!desc.isAbstractType()) {
return desc.jsonReadObject(newReader, path);
return desc.jsonReadObject(newReader, path, target);
}
String msg = "Error reading inheritance discriminator - expected [" + discColumn + "] but no json key?";
throw new JsonParseException(newParser, msg, parser.getCurrentLocation());
}
return (T) inheritInfo.readType(discNode.asText()).desc().jsonReadObject(newReader, path);
BeanDescriptor<T> inheritDesc = (BeanDescriptor<T>) inheritInfo.readType(discNode.asText()).desc();
return inheritDesc.jsonReadObject(newReader, path, target);
}
private T jsonReadObject(SpiJsonReader readJson, String path) throws IOException {
EntityBean bean = desc.createEntityBeanForJson();
private T jsonReadObject(SpiJsonReader readJson, String path, T target) throws IOException {
EntityBean bean;
if (target == null) {
bean = desc.createEntityBeanForJson();
} else if (desc.beanType.isInstance(target)) {
bean = (EntityBean) target;
} else {
throw new ClassCastException(target.getClass().getName() + " provided, but " + desc.beanType.getClass().getName() + " expected");
}
return jsonReadProperties(readJson, bean, path);
}
@@ -992,6 +992,9 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
*/
public String renderDbType(DbPlatformType dbType, boolean strict) {
if (dbColumnDefn != null) {
if (dbColumnDefn.endsWith(";")) {
return dbColumnDefn + dbType.renderType(dbLength, dbScale, strict);
}
return dbColumnDefn;
}
return dbType.renderType(dbLength, dbScale, strict);
@@ -1001,7 +1004,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
* Return the DB column default to use for DDL.
*/
public String dbColumnDefault() {
return dbColumnDefn != null ? null : dbColumnDefault;
return dbColumnDefault;
}
/**
@@ -1160,26 +1163,27 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
public boolean isLob() {
return lob;
}
/**
* Returns true if this <code>isLob()</code> or the type will effectively map to a lob.
* Returns true if this <code>isLob()</code> or the type will effectively map to a lob.
*/
@Override
public boolean isDbLob() {
if (lob) {
return true;
}
switch (dbType) {
case DbPlatformType.JSON:
case DbPlatformType.JSONB:
return dbLength == 0; // must be analog to DbPlatformTypeMapping.lookup
case DbPlatformType.JSONBlob:
case DbPlatformType.JSONClob:
return true;
default:
return false;
case DbPlatformType.JSON:
case DbPlatformType.JSONB:
return dbLength == 0; // must be analog to DbPlatformTypeMapping.lookup
case DbPlatformType.JSONBlob:
case DbPlatformType.JSONClob:
return true;
default:
return false;
}
}
public static boolean isLobType(int type) {
switch (type) {
case Types.CLOB:
@@ -1016,7 +1016,8 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
BeanCollection<?> collection = createEmpty(parentBean);
BeanCollectionAdd add = beanCollectionAdd(collection);
do {
EntityBean detailBean = (EntityBean) targetDescriptor.jsonRead(readJson, name);
// CHECKME: Update existing list entry here?
EntityBean detailBean = (EntityBean) targetDescriptor.jsonRead(readJson, name, null);
if (detailBean == null) {
// read the entire array
break;
@@ -783,7 +783,8 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
@Override
public void jsonRead(SpiJsonReader readJson, EntityBean bean) throws IOException {
if (jsonDeserialize && targetDescriptor != null) {
T assocBean = targetDescriptor.jsonRead(readJson, name);
T target = (T) value(bean);
T assocBean = targetDescriptor.jsonRead(readJson, name, target);
setValue(bean, assocBean);
}
}
@@ -1,6 +1,7 @@
package io.ebeaninternal.server.deploy;
import io.ebeaninternal.server.query.SqlJoinType;
import io.ebeaninternal.server.query.SqlTreeJoin;
/**
* Used to provide context during sql construction.
@@ -133,4 +134,13 @@ public interface DbSqlContext {
*/
void appendFromForUpdate();
/**
* Delay adding an extra join to support inheritance discriminator in projection (IF required).
*/
void addExtraJoin(SqlTreeJoin treeJoin);
/**
* Add extra joins *IF* required to support inheritance discriminator in projection.
*/
void flushExtraJoins();
}
@@ -0,0 +1,59 @@
package io.ebeaninternal.server.deploy;
import java.util.Objects;
/**
* Meta data for table spaces. If table space is configured, tablespaceName, indexTablespace, lobTablespace is never null;
*
* @author Noemi Szemenyei, FOCONIS AG
*
*/
public final class TablespaceMeta {
private final String tablespaceName;
private final String indexTablespace;
private final String lobTablespace;
public TablespaceMeta(String tablespaceName, String indexTablespace, String lobTablespace) {
this.tablespaceName = tablespaceName;
this.indexTablespace = indexTablespace;
this.lobTablespace = lobTablespace;
}
public String getTablespaceName() {
return tablespaceName;
}
public String getIndexTablespace() {
return indexTablespace;
}
public String getLobTablespace() {
return lobTablespace;
}
@Override
public int hashCode() {
return Objects.hash(indexTablespace, tablespaceName, lobTablespace);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TablespaceMeta other = (TablespaceMeta) obj;
return Objects.equals(indexTablespace, other.indexTablespace)
&& Objects.equals(tablespaceName, other.tablespaceName)
&& Objects.equals(lobTablespace, other.lobTablespace);
}
@Override
public String toString() {
return "tablespace=" + tablespaceName + ", indexTablespace=" + indexTablespace + ", lobTablespace=" + lobTablespace;
}
}
@@ -32,6 +32,7 @@ import io.ebeaninternal.server.deploy.IndexDefinition;
import io.ebeaninternal.server.deploy.InheritInfo;
import io.ebeaninternal.server.deploy.PartitionMeta;
import io.ebeaninternal.server.deploy.TableJoin;
import io.ebeaninternal.server.deploy.TablespaceMeta;
import io.ebeaninternal.server.deploy.parse.DeployBeanInfo;
import io.ebeaninternal.server.idgen.UuidV1IdGenerator;
import io.ebeaninternal.server.idgen.UuidV1RndIdGenerator;
@@ -135,6 +136,7 @@ public class DeployBeanDescriptor<T> {
private ChangeLogFilter changeLogFilter;
private String dbComment;
private PartitionMeta partitionMeta;
private TablespaceMeta tablespaceMeta;
/**
* One of NONE, INDEX or EMBEDDED.
*/
@@ -252,6 +254,14 @@ public class DeployBeanDescriptor<T> {
}
return partitionMeta;
}
public void setTablespaceMeta(TablespaceMeta tablespaceMeta) {
this.tablespaceMeta = tablespaceMeta;
}
public TablespaceMeta getTablespaceMeta() {
return tablespaceMeta;
}
public void setDraftable() {
draftable = true;
@@ -1,14 +1,9 @@
package io.ebeaninternal.server.deploy.parse;
import io.ebean.annotation.Aggregation;
import io.ebean.annotation.Avg;
import io.ebean.annotation.DbMigration;
import io.ebean.annotation.Index;
import io.ebean.annotation.Indices;
import io.ebean.annotation.Max;
import io.ebean.annotation.Min;
import io.ebean.annotation.Platform;
import io.ebean.annotation.Sum;
import io.ebean.config.NamingConvention;
import io.ebean.config.dbplatform.DatabasePlatform;
import io.ebean.util.AnnotationUtil;
@@ -20,7 +15,6 @@ import javax.persistence.JoinColumns;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.Set;
@@ -12,6 +12,7 @@ import io.ebean.annotation.Index;
import io.ebean.annotation.InvalidateQueryCache;
import io.ebean.annotation.ReadAudit;
import io.ebean.annotation.StorageEngine;
import io.ebean.annotation.Tablespace;
import io.ebean.annotation.View;
import io.ebean.config.TableName;
import io.ebeaninternal.api.CoreLog;
@@ -19,6 +20,7 @@ import io.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
import io.ebeaninternal.server.deploy.IndexDefinition;
import io.ebeaninternal.server.deploy.InheritInfo;
import io.ebeaninternal.server.deploy.PartitionMeta;
import io.ebeaninternal.server.deploy.TablespaceMeta;
import io.ebeaninternal.server.deploy.meta.DeployBeanProperty;
import javax.persistence.AttributeOverride;
@@ -154,6 +156,18 @@ final class AnnotationClass extends AnnotationParser {
if (partition != null) {
descriptor.setPartitionMeta(new PartitionMeta(partition.mode(), partition.property()));
}
Tablespace tablespace = typeGet(cls, Tablespace.class);
if (tablespace != null) {
String indexTs = tablespace.index();
if("".equals(indexTs)) {
indexTs = tablespace.value();
}
String lobTs = tablespace.lob();
if("".equals(lobTs)) {
lobTs = tablespace.value();
}
descriptor.setTablespaceMeta(new TablespaceMeta(tablespace.value(), indexTs, lobTs));
}
Draftable draftable = typeGet(cls, Draftable.class);
if (draftable != null) {
descriptor.setDraftable();
@@ -0,0 +1,67 @@
package io.ebeaninternal.server.executor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.*;
import java.util.concurrent.locks.ReentrantLock;
/**
* A "CachedThreadPool" based on Daemon threads.
* <p>
* The Threads are created as needed and once idle live for 60 seconds.
*/
final class DaemonExecutorService {
private static final Logger logger = LoggerFactory.getLogger(DaemonExecutorService.class);
private final ReentrantLock lock = new ReentrantLock(false);
private final String namePrefix;
private final int shutdownWaitSeconds;
private final ExecutorService service;
DaemonExecutorService(int shutdownWaitSeconds, String namePrefix) {
this.service = Executors.newCachedThreadPool(new DaemonThreadFactory(namePrefix));
this.shutdownWaitSeconds = shutdownWaitSeconds;
this.namePrefix = namePrefix;
}
<T> Future<T> submit(Callable<T> task) {
return service.submit(task);
}
Future<?> submit(Runnable task) {
return service.submit(task);
}
/**
* Shutdown this thread pool nicely if possible.
* <p>
* This will wait a maximum of 20 seconds before terminating any threads still working.
*/
void shutdown() {
lock.lock();
try {
if (service.isShutdown()) {
logger.debug("DaemonExecutorService[{}] already shut down", namePrefix);
return;
}
try {
logger.debug("DaemonExecutorService[{}] shutting down...", namePrefix);
service.shutdown();
if (!service.awaitTermination(shutdownWaitSeconds, TimeUnit.SECONDS)) {
logger.info("DaemonExecutorService[{}] shut down timeout exceeded. Terminating running threads.", namePrefix);
service.shutdownNow();
}
} catch (Exception e) {
logger.error("Error during shutdown of DaemonThreadPool[" + namePrefix + "]", e);
e.printStackTrace();
}
} finally {
lock.unlock();
}
}
}
@@ -1,15 +1,13 @@
package io.ebeaninternal.server.executor;
import io.avaje.lang.NonNullApi;
import io.ebean.config.BackgroundExecutorWrapper;
import io.ebeaninternal.api.SpiBackgroundExecutor;
import org.slf4j.MDC;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The default implementation of the BackgroundExecutor.
@@ -17,56 +15,81 @@ import java.util.concurrent.TimeUnit;
@NonNullApi
public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
private final ScheduledExecutorService executor;
private static final Logger log = LoggerFactory.getLogger("io.ebean.BackgroundExecutor");
private final ScheduledExecutorService schedulePool;
private final DaemonExecutorService pool;
private final BackgroundExecutorWrapper wrapper;
/**
* Construct the default implementation of BackgroundExecutor.
*/
public DefaultBackgroundExecutor(int schedulePoolSize, int shutdownWaitSeconds, String namePrefix) {
this.executor = new DaemonScheduleThreadPool(schedulePoolSize, shutdownWaitSeconds, namePrefix);
public DefaultBackgroundExecutor(int schedulePoolSize, int shutdownWaitSeconds, String namePrefix, BackgroundExecutorWrapper wrapper) {
this.schedulePool = new DaemonScheduleThreadPool(schedulePoolSize, shutdownWaitSeconds, namePrefix + "-periodic-");
this.pool = new DaemonExecutorService(shutdownWaitSeconds, namePrefix);
this.wrapper = wrapper;
log.debug("Created backgroundExecutor {} (schedulePoolSize={}, shutdownWaitSeconds={})", namePrefix, schedulePoolSize, shutdownWaitSeconds);
}
/**
* Wrap the task with MDC context if defined.
*/
<T> Callable<T> wrapMDC(Callable<T> task) {
final Map<String, String> map = MDC.getCopyOfContextMap();
if (map == null) {
<T> Callable<T> wrap(Callable<T> task) {
if (wrapper == null) {
return task;
} else {
return () -> {
MDC.setContextMap(map);
try {
return task.call();
} finally {
MDC.clear();
}
};
return wrapper.wrap(task);
}
}
/**
* Wrap the task with MDC context if defined.
*/
Runnable wrapMDC(Runnable task) {
final Map<String, String> map = MDC.getCopyOfContextMap();
if (map == null) {
Runnable wrap(Runnable task) {
if (wrapper == null) {
return task;
} else {
return () -> {
MDC.setContextMap(map);
try {
return wrapper.wrap(task);
}
}
/**
* Decorates a runnable by adding an exception handler and some timing metrics.
* This is used in methods that accepts a <code>Runnable</code> and return
* either <code>void</code> or <code>ScheduledFuture</code>, as there is
* normally no Future.get() call.
*
* Note: When submitting a <code>Callable</code>, you must check
* <code>Future.get()</code> for exceptions.
*/
private Runnable logExceptions(Runnable task) {
long queued = System.nanoTime();
log.trace("Queued {}", task);
return () -> {
try {
if (log.isTraceEnabled()) {
long start = System.nanoTime();
log.trace("Start {} (delay time {} us)", task, (start - queued) / 1000L);
task.run();
log.trace("Stop {} (exec time {} us)", task, (System.nanoTime() - start) / 1000L);
} else {
task.run();
} finally {
MDC.clear();
}
};
}
} catch (Throwable t) {
// log any exception here. Note they will not bubble up to the calling user
// unless Future.get() is checked. (Which is almost never done on scheduled
// background executions)
log.error("Error while executing the task {}", task, t);
throw t;
}
};
}
@Override
public <T> Future<T> submit(Callable<T> task) {
return executor.submit(wrapMDC(task));
// Note: No "logExceptions" as we expect Future.get() by the invoker
return pool.submit(wrap(task));
}
/**
@@ -74,47 +97,52 @@ public final class DefaultBackgroundExecutor implements SpiBackgroundExecutor {
*/
@Override
public Future<?> submit(Runnable task) {
return executor.submit(wrapMDC(task));
return pool.submit(wrap(task));
}
@Override
public void execute(Runnable task) {
submit(task);
submit(logExceptions(task));
}
@Override
public void executePeriodically(Runnable task, long delay, TimeUnit unit) {
executor.scheduleWithFixedDelay(wrapMDC(task), delay, delay, unit);
schedulePool.scheduleWithFixedDelay(wrap(logExceptions(task)), delay, delay, unit);
}
@Override
public void executePeriodically(Runnable task, long initialDelay, long delay, TimeUnit unit) {
executor.scheduleWithFixedDelay(wrapMDC(task), initialDelay, delay, unit);
schedulePool.scheduleWithFixedDelay(wrap(logExceptions(task)), initialDelay, delay, unit);
}
@Override
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit) {
return executor.scheduleWithFixedDelay(wrapMDC(task), initialDelay, delay, unit);
return schedulePool.scheduleWithFixedDelay(wrap(logExceptions(task)), initialDelay, delay, unit);
}
@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long initialDelay, long delay, TimeUnit unit) {
return executor.scheduleAtFixedRate(wrapMDC(task), initialDelay, delay, unit);
return schedulePool.scheduleAtFixedRate(wrap(logExceptions(task)), initialDelay, delay, unit);
}
@Override
public ScheduledFuture<?> schedule(Runnable task, long delay, TimeUnit unit) {
return executor.schedule(wrapMDC(task), delay, unit);
return schedulePool.schedule(wrap(logExceptions(task)), delay, unit);
}
@Override
public <V> ScheduledFuture<V> schedule(Callable<V> task, long delay, TimeUnit unit) {
return executor.schedule(wrapMDC(task), delay, unit);
// Note: No "logExceptions" as we expect Future.get() by the invoker
return schedulePool.schedule(wrap(task), delay, unit);
}
@Override
public void shutdown() {
executor.shutdown();
log.trace("BackgroundExecutor shutting down");
schedulePool.shutdown();
pool.shutdown();
log.debug("BackgroundExecutor stopped");
}
}
@@ -40,7 +40,7 @@ abstract class AbstractTextExpression extends AbstractExpression {
@Override
public void queryBindKey(BindValuesKey key) {
// do nothing, only execute against document store
};
}
@Override
public boolean isSameByBind(SpiExpression other) {
@@ -4,8 +4,6 @@ import io.ebeaninternal.api.BindValuesKey;
import io.ebeaninternal.api.SpiExpression;
import io.ebeaninternal.api.SpiExpressionRequest;
import java.io.IOException;
/**
* Bitwise expression.
*/
@@ -25,7 +23,7 @@ final class BitwiseExpression extends AbstractExpression {
}
@Override
public void writeDocQuery(DocQueryContext context) throws IOException {
public void writeDocQuery(DocQueryContext context) {
throw new IllegalStateException("Not supported for document queries");
}
@@ -47,12 +47,12 @@ final class DefaultExampleExpression implements SpiExpression, ExampleExpression
private final EntityBean entity;
/**
* Set to true to use case insensitive expressions.
* Set to true to use case-insensitive expressions.
*/
private boolean caseInsensitive;
/**
* The type of like (RAW, STARTS_WITH, ENDS_WITH etc)
* The type of like (RAW, STARTS_WITH, ENDS_WITH)
*/
private LikeType likeType;
@@ -62,7 +62,7 @@ final class DefaultExampleExpression implements SpiExpression, ExampleExpression
private boolean includeZeros;
/**
* The non null bean properties and found and together added as a list of
* The non-null bean properties and found and together added as a list of
* expressions (like or equal to expressions).
*/
private ArrayList<SpiExpression> list;
@@ -71,8 +71,8 @@ final class DefaultExampleExpression implements SpiExpression, ExampleExpression
/**
* Construct the query by example expression.
*
* @param entity the example entity with non null property values
* @param caseInsensitive if true use case insensitive expressions
* @param entity the example entity with non-null property values
* @param caseInsensitive if true use case-insensitive expressions
* @param likeType the type of Like wild card used
*/
DefaultExampleExpression(EntityBean entity, boolean caseInsensitive, LikeType likeType) {
@@ -303,9 +303,7 @@ final class DefaultExampleExpression implements SpiExpression, ExampleExpression
*/
private boolean isZero(Object value) {
if (value instanceof Number) {
if (((Number) value).doubleValue() == 0) {
return true;
}
return ((Number) value).doubleValue() == 0;
}
return false;
}
@@ -186,7 +186,7 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
/**
* Case Insensitive Equal To - property equal to the given value (typically
* using a lower() function to make it case insensitive).
* using a lower() function to make it case-insensitive).
*/
@Override
public Expression ieq(String propertyName, String value) {
@@ -198,7 +198,7 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
/**
* Case Insensitive Equal To - property equal to the given value (typically
* using a lower() function to make it case insensitive).
* using a lower() function to make it case-insensitive).
*/
@Override
public Expression ine(String propertyName, String value) {
@@ -336,7 +336,7 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
}
/**
* Case insensitive {@link #exampleLike(Object)}
* Case-insensitive {@link #exampleLike(Object)}
*/
@Override
public ExampleExpression iexampleLike(Object example) {
@@ -344,7 +344,7 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
}
/**
* Create the query by Example expression which is case sensitive and using
* Create the query by Example expression which is case-sensitive and using
* LikeType.RAW (you need to add you own wildcards % and _).
*/
@Override
@@ -375,9 +375,9 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
}
/**
* Case insensitive Like - property like value where the value contains the
* SQL wild card characters % (percentage) and _ (underscore). Typically uses
* a lower() function to make the expression case insensitive.
* Case-insensitive Like - property like value where the value contains the
* SQL wild card characters % (percentage) and _ (underscore). Typically, uses
* a lower() function to make the expression case-insensitive.
*/
@Override
public Expression ilike(String propertyName, String value) {
@@ -397,8 +397,8 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
}
/**
* Case insensitive Starts With - property like value%. Typically uses a
* lower() function to make the expression case insensitive.
* Case-insensitive Starts With - property like value%. Typically, uses a
* lower() function to make the expression case-insensitive.
*/
@Override
public Expression istartsWith(String propertyName, String value) {
@@ -414,8 +414,8 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
}
/**
* Case insensitive Ends With - property like %value. Typically uses a lower()
* function to make the expression case insensitive.
* Case-insensitive Ends With - property like %value. Typically, uses a lower()
* function to make the expression case-insensitive.
*/
@Override
public Expression iendsWith(String propertyName, String value) {
@@ -431,8 +431,8 @@ public class DefaultExpressionFactory implements SpiExpressionFactory {
}
/**
* Case insensitive Contains - property like %value%. Typically uses a lower()
* function to make the expression case insensitive.
* Case-insensitive Contains - property like %value%. Typically, uses a lower()
* function to make the expression case-insensitive.
*/
@Override
public Expression icontains(String propertyName, String value) {
@@ -162,7 +162,7 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
writeDocQuery(context, null);
} else {
// this is a Top level "text" expressions so we may need to wrap in Bool SHOULD etc.
// this is a Top level "text" expressions, so we may need to wrap in Bool SHOULD etc.
if (list.isEmpty()) {
throw new IllegalStateException("empty expression list?");
}
@@ -71,7 +71,7 @@ public interface DocQueryContext {
void writeIn(String propertyName, Object[] values, boolean not) throws IOException;
/**
* Write an Id in expression.
* Write an ID in expression.
*/
void writeIds(Collection<?> idCollection) throws IOException;
@@ -131,7 +131,7 @@ public interface DocQueryContext {
void writeTextQueryString(String search, TextQueryString options) throws IOException;
/**
* Start a Bool which may contain some of Must, Must Not, Should.
* Start a Bool which may contain Must, Must Not, Should.
*/
void startBoolGroup() throws IOException;
@@ -1,19 +1,11 @@
package io.ebeaninternal.server.expression;
import io.ebean.event.BeanQueryRequest;
import io.ebeaninternal.api.BindValuesKey;
import io.ebeaninternal.api.ManyWhereJoins;
import io.ebeaninternal.api.NaturalKeyQueryData;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.api.SpiExpression;
import io.ebeaninternal.api.SpiExpressionRequest;
import io.ebeaninternal.api.SpiExpressionValidation;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.api.*;
import io.ebeaninternal.api.SpiQuery.Type;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import io.ebeaninternal.server.query.CQuery;
import java.io.IOException;
import java.util.List;
final class ExistsQueryExpression implements SpiExpression, UnsupportedDocStoreExpression {
@@ -52,7 +44,7 @@ final class ExistsQueryExpression implements SpiExpression, UnsupportedDocStoreE
}
@Override
public void writeDocQuery(DocQueryContext context) throws IOException {
public void writeDocQuery(DocQueryContext context) {
throw new IllegalStateException("Not supported");
}
@@ -77,7 +69,7 @@ final class ExistsQueryExpression implements SpiExpression, UnsupportedDocStoreE
/**
* Compile/build the sub query.
*/
protected CQuery<?> compileSubQuery(BeanQueryRequest<?> queryRequest) {
CQuery<?> compileSubQuery(BeanQueryRequest<?> queryRequest) {
SpiEbeanServer ebeanServer = (SpiEbeanServer) queryRequest.database();
return ebeanServer.compileQuery(Type.SQ_EXISTS, subQuery, queryRequest.transaction());
}
@@ -51,7 +51,7 @@ final class IdExpression extends NonPrepareExpression implements SpiExpression {
@Override
public void addBindValues(SpiExpressionRequest request) {
// 'flatten' EmbeddedId and multiple Id cases
// 'flatten' EmbeddedId and multiple ID cases
// into an array of the underlying scalar field values
DefaultExpressionRequest r = (DefaultExpressionRequest) request;
Object[] bindIdValues = r.getBeanDescriptor().bindIdValues(value);
@@ -4,7 +4,7 @@ import java.util.Collection;
import java.util.Set;
/**
* Id IN expression common for cache handling.
* ID IN expression common for cache handling.
*/
public interface IdInCommon {
@@ -18,7 +18,7 @@ import java.util.List;
import java.util.Set;
/**
* In a collection of Id values.
* In a collection of ID values.
*/
public final class IdInExpression extends NonPrepareExpression implements IdInCommon {
@@ -73,7 +73,7 @@ public final class IdInExpression extends NonPrepareExpression implements IdInCo
if (idCollection.isEmpty()) {
return;
}
// Bind the Id values including EmbeddedId and multiple Id
// Bind the ID values including EmbeddedId and multiple ID
DefaultExpressionRequest r = (DefaultExpressionRequest) request;
BeanDescriptor<?> descriptor = r.getBeanDescriptor();
@@ -82,7 +82,7 @@ public final class IdInExpression extends NonPrepareExpression implements IdInCo
}
/**
* For use with deleting non attached detail beans during stateless update.
* For use with deleting non-attached detail beans during stateless update.
*/
public void addSqlNoAlias(SpiExpressionRequest request) {
@@ -116,7 +116,7 @@ public final class IdInExpression extends NonPrepareExpression implements IdInCo
}
/**
* Incorporates the number of Id values to bind.
* Incorporates the number of ID values to bind.
*/
@Override
public void queryPlanHash(StringBuilder builder) {
@@ -9,7 +9,6 @@ import io.ebeaninternal.api.SpiExpression;
import io.ebeaninternal.api.SpiExpressionRequest;
import io.ebeaninternal.server.persist.MultiValueWrapper;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -54,7 +53,7 @@ final class InPairsExpression extends AbstractExpression {
}
@Override
public void writeDocQuery(DocQueryContext context) throws IOException {
public void writeDocQuery(DocQueryContext context) {
throw new RuntimeException("Not supported with document query");
}
@@ -1,15 +1,10 @@
package io.ebeaninternal.server.expression;
import io.ebean.event.BeanQueryRequest;
import io.ebeaninternal.api.BindValuesKey;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.api.SpiExpression;
import io.ebeaninternal.api.SpiExpressionRequest;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.api.*;
import io.ebeaninternal.api.SpiQuery.Type;
import io.ebeaninternal.server.query.CQuery;
import java.io.IOException;
import java.util.List;
/**
@@ -42,7 +37,7 @@ final class InQueryExpression extends AbstractExpression implements UnsupportedD
}
@Override
public void writeDocQuery(DocQueryContext context) throws IOException {
public void writeDocQuery(DocQueryContext context) {
throw new IllegalStateException("Not supported");
}
@@ -48,7 +48,7 @@ final class IsEmptyExpression extends AbstractExpression {
}
}
public final String getPropName() {
public String getPropName() {
return propName;
}
@@ -868,7 +868,7 @@ final class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expr
}
@Override
public Query<T> select(FetchGroup fetchGroup) {
public Query<T> select(FetchGroup<T> fetchGroup) {
return exprList.select(fetchGroup);
}
@@ -14,7 +14,7 @@ import io.ebeaninternal.server.deploy.BeanDescriptor;
import java.io.IOException;
/**
* A logical And or Or for joining two expressions.
* A logical And or, Or for joining two expressions.
*/
abstract class LogicExpression implements SpiExpression {
@@ -1,16 +1,9 @@
package io.ebeaninternal.server.expression;
import io.ebean.event.BeanQueryRequest;
import io.ebeaninternal.api.BindValuesKey;
import io.ebeaninternal.api.ManyWhereJoins;
import io.ebeaninternal.api.NaturalKeyQueryData;
import io.ebeaninternal.api.SpiExpression;
import io.ebeaninternal.api.SpiExpressionRequest;
import io.ebeaninternal.api.SpiExpressionValidation;
import io.ebeaninternal.api.*;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import java.io.IOException;
/**
* Effectively an expression that has no effect.
*/
@@ -40,7 +33,7 @@ final class NoopExpression implements SpiExpression {
}
@Override
public void writeDocQuery(DocQueryContext context) throws IOException {
public void writeDocQuery(DocQueryContext context) {
}
@Override
@@ -16,7 +16,7 @@ final class RawExpressionBuilder {
*/
static RawExpression buildSingle(String raw, Object value) {
if (isExpand(value, raw, BP_1)) {
Collection val = (Collection) value;
Collection<?> val = (Collection<?>) value;
raw = raw.replace(BP_1, expand(val));
return new RawExpression(raw, val.toArray());
}
@@ -50,8 +50,7 @@ final class RawExpressionBuilder {
return "?" + (i + 1);
}
private static String expand(Collection values) {
private static String expand(Collection<?> values) {
StringBuilder sqlExpand = new StringBuilder(values.size() * 2);
for (int i = 0; i < values.size(); i++) {
if (i > 0) {
@@ -72,7 +71,7 @@ final class RawExpressionBuilder {
if (!isExpand(values[i], raw, match)) {
params.add(values[i]);
} else {
Collection val = (Collection) values[i];
Collection<?> val = (Collection<?>) values[i];
params.addAll(val);
raw = raw.replace(match, expand(val));
}
@@ -10,7 +10,7 @@ import java.util.Objects;
final class Same {
/**
* Return true if both values are null or both an not null.
* Return true if both values are null or both not null.
*/
static boolean sameByNull(Object v1, Object v2) {
return (v1 == null) == (v2 == null);
@@ -55,7 +55,7 @@ public final class SimpleExpression extends AbstractValueExpression {
}
}
public final String getPropName() {
public String getPropName() {
return propName;
}
@@ -21,7 +21,7 @@ Expressions for building WHERE clauses.
<p>
In the code above the LIKE and GREATER THAN Expressions are added to the where clause.
The way this works is that where() returns an ExpressionList which has methods on
it to create the standard expressions (EQUAL TO, LIKE etc).
it to create the standard expressions (EQUAL TO, LIKE etc.)
</p>
<p>
I expect most people to add their expressions in this way. The Expr expression factory
@@ -15,6 +15,7 @@ import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
import io.ebeaninternal.server.querydefn.OrmQueryProperties;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.locks.Lock;
@@ -66,7 +67,7 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
}
}
protected void register(EntityBeanIntercept ebi) {
void register(EntityBeanIntercept ebi) {
if (currentBuffer.isFull()) {
currentBuffer = createBuffer(batchSize);
}
@@ -91,7 +92,7 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
try {
if (bufferList != null) {
for (LoadBuffer loadBuffer : bufferList) {
if (!loadBuffer.list.isEmpty()) {
if (!loadBuffer.batch.isEmpty()) {
parent.getEbeanServer().loadBean(new LoadBeanRequest(loadBuffer, parentRequest));
}
if (forEach) {
@@ -115,13 +116,13 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
private final ReentrantLock bufferLock = new ReentrantLock();
private final DLoadBeanContext context;
private final int batchSize;
private final List<EntityBeanIntercept> list;
private final Set<EntityBeanIntercept> batch;
private PersistenceContext persistenceContext;
LoadBuffer(DLoadBeanContext context, int batchSize) {
this.context = context;
this.batchSize = batchSize;
this.list = new ArrayList<>(batchSize);
this.batch = new HashSet<>(Math.max((int) (batchSize/.75f) + 1, 16));
}
@Override
@@ -139,7 +140,7 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
* Return true if the buffer is full.
*/
public boolean isFull() {
return batchSize == list.size();
return batchSize == batch.size();
}
/**
@@ -150,12 +151,12 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
// get persistenceContext from first loaded bean into the buffer
persistenceContext = ebi.getPersistenceContext();
}
list.add(ebi);
batch.add(ebi);
}
@Override
public List<EntityBeanIntercept> batch() {
return list;
public Set<EntityBeanIntercept> batch() {
return batch;
}
@Override
@@ -190,13 +191,13 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
// lazy load property was a Many
return;
}
if (list.isEmpty()) {
if (!batch.contains(ebi)) {
// re-add to the batch and lazy load from DB skipping l2 cache
list.add(ebi);
batch.add(ebi);
} else if (context.hitCache) {
Set<EntityBeanIntercept> hits = context.desc.cacheBeanLoadAll(list, persistenceContext, ebi.getLazyLoadPropertyIndex(), ebi.getLazyLoadProperty());
list.removeAll(hits);
if (list.isEmpty() || hits.contains(ebi)) {
Set<EntityBeanIntercept> hits = context.desc.cacheBeanLoadAll(batch, persistenceContext, ebi.getLazyLoadPropertyIndex(), ebi.getLazyLoadProperty());
batch.removeAll(hits);
if (batch.isEmpty() || hits.contains(ebi)) {
// successfully hit the L2 cache so don't invoke DB lazy loading
return;
}
@@ -204,7 +205,7 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
LoadBeanRequest req = new LoadBeanRequest(this, ebi, context.hitCache);
context.desc.ebeanServer().loadBean(req);
list.clear();
batch.clear();
}
}
@@ -81,8 +81,7 @@ public final class DefaultPersister implements Persister {
int rc = request.executeOrQueue();
request.commitTransIfRequired();
return rc;
} catch (RuntimeException e) {
} catch (Throwable e) {
request.rollbackTransIfRequired();
throw e;
} finally {
@@ -383,8 +382,7 @@ public final class DefaultPersister implements Persister {
req.resetDepth();
req.commitTransIfRequired();
req.flushBatchOnCascade();
} catch (RuntimeException ex) {
} catch (Throwable ex) {
req.rollbackTransIfRequired();
throw ex;
} finally {
@@ -420,8 +418,7 @@ public final class DefaultPersister implements Persister {
req.resetDepth();
req.commitTransIfRequired();
req.flushBatchOnCascade();
} catch (RuntimeException ex) {
} catch (Throwable ex) {
req.rollbackTransIfRequired();
throw ex;
} finally {
@@ -559,7 +556,7 @@ public final class DefaultPersister implements Persister {
req.flushBatchOnCascade();
return rows;
} catch (RuntimeException ex) {
} catch (Throwable ex) {
req.rollbackTransIfRequired();
throw ex;
} finally {
@@ -757,7 +757,7 @@ final class CQueryBuilder {
}
boolean isPlatformDistinctOn() {
return dbPlatform.isPlatform(Platform.POSTGRES) || dbPlatform.isPlatform(Platform.YUGABYTE);
return dbPlatform.isPlatform(Platform.POSTGRES) || dbPlatform.isPlatform(Platform.YUGABYTE) || dbPlatform.isPlatform(Platform.COCKROACH);
}
boolean isPlatformDistinctNoLobs() {
@@ -3,7 +3,6 @@ package io.ebeaninternal.server.query;
import io.ebean.QueryIterator;
import io.ebeaninternal.server.core.OrmQueryRequest;
import javax.persistence.PersistenceException;
import java.sql.SQLException;
/**

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