Compare commits

...
235 Commits
Author SHA1 Message Date
Rob Bygrave 70eb557929 Version 13.23.2-jakarta 2023-10-27 22:13:05 +13:00
Rob Bygrave fdb3a3759b Bump ebean-agent to 13.23.2 2023-10-27 22:10:40 +13:00
Rob BygraveandGitHub 7a5e8d0e17 Merge pull request #3256 from ebean-orm/feature/upgrade-antlr4-4_13_1
Upgrade ANTLR4 from version 4.8-1 to 4.13.1
2023-10-27 21:45:37 +13:00
robin.bygrave a0748f8139 Upgrade ANTLR4 from version 4.8-1 to 4.13.1 2023-10-26 13:52:44 +13:00
Rob BygraveandGitHub 9f65673f54 Merge pull request #3255 from ebean-orm/feature/bump-junit-bytebuddy
Bump io.avaje:junit and bytebuddy version to support JDK 22+
2023-10-25 22:12:49 +13:00
Rob Bygrave 8f6a3c59d1 Bump io.avaje:junit and bytebuddy version to support JDK 22+ 2023-10-25 21:58:19 +13:00
Rob BygraveandGitHub 05210ec411 Merge pull request #3254 from ebean-orm/feature/query-plan-capture-yuga
Use DIST with query plan capture for Yugabyte plus simplify
2023-10-25 08:23:01 +13:00
Rob Bygrave faffda8318 Use DIST with query plan capture for Yugabyte plus simplify
Change QueryPlanLoggerExplain to take the options for PG, Yugabyte and others
2023-10-25 08:22:25 +13:00
Rob BygraveandGitHub af3901ce01 Merge pull request #3253 from ebean-orm/feature/3251
#3251 - QueryBeans: Entities can not have same name as some Ebean API…
2023-10-25 08:11:40 +13:00
Rob Bygrave acd538207f #3251 - QueryBeans: Entities can not have same name as some Ebean API classes 2023-10-24 23:08:30 +13:00
Rob Bygrave 84f0ef9fce Use querybean-generator via provided scope rather than maven compiler plugin
This is because when releasing both jakarta and javax versions these
need to have their versions adjusted
2023-10-24 23:07:14 +13:00
Rob BygraveandGitHub 7ab447b21c Merge pull request #3252 from ebean-orm/feature/querybean-generator-provided
Use querybean-generator via provided scope rather than maven compiler plugin
2023-10-24 22:23:56 +13:00
Rob Bygrave 6f8805a6b3 Use querybean-generator via provided scope rather than maven compiler plugin
This is because when releasing both jakarta and javax versions these
need to have their versions adjusted
2023-10-24 22:17:28 +13:00
Rob Bygrave 0171c1afef Version 13.23.1 2023-10-18 15:47:04 +13:00
Rob Bygrave 31c106f604 Bump ebean-agent to 13.23.1 2023-10-18 15:16:20 +13:00
Rob BygraveandGitHub 20d2838be4 Merge pull request #3250 from ebean-orm/feature/bump-parent
Make Jackson a transitive dependency of ebean-jackson-mapper
2023-10-17 23:25:43 +13:00
Rob Bygrave 4238a951ca Make Jackson a transitive dependency of ebean-jackson-mapper
So jackson-core and jackson-databind are both transitive dependencies
of ebean-jackson-mapper.
2023-10-17 23:25:09 +13:00
Rob BygraveandGitHub b5d4bed615 Merge pull request #3249 from ebean-orm/feature/bump-parent
Support native-image via querybean-generator
2023-10-17 23:18:17 +13:00
Rob Bygrave 3ef715ef64 Support native-image via querybean-generator 2023-10-17 23:09:18 +13:00
Rob BygraveandGitHub aea39528ab Merge pull request #3248 from ebean-orm/feature/bump-parent
Bump dependency for avaje-config to 3.9
2023-10-17 22:39:04 +13:00
Rob Bygrave dd498409e0 Bump dependency for avaje-config to 3.9 2023-10-17 22:38:33 +13:00
Rob BygraveandGitHub bae33101df Merge pull request #3247 from ebean-orm/feature/bump-parent
Bump parent pom
2023-10-17 22:37:53 +13:00
Rob Bygrave e1972ac544 Bump parent pom 2023-10-17 22:37:20 +13:00
Rob Bygrave c7241ba3dc Fix test for java 16+ annotation processor version 2023-10-16 23:30:45 +13:00
Rob Bygrave 73416ed65a For testing java 16+ include JDK 17 and 21 only 2023-10-16 23:19:48 +13:00
Rob Bygrave cd70c178f1 For testing java 16+ include JDK 17 and 21 only 2023-10-16 23:17:25 +13:00
Rob Bygrave aa298235f3 For testing java 16+ include JDK 21 and 22 2023-10-16 23:15:32 +13:00
Rob BygraveandGitHub 8733fed14b Merge pull request #3246 from ebean-orm/feature/annotation-processing-jdk-22
Explicit annotation processors required with JDK 22
2023-10-16 22:06:20 +13:00
Rob Bygrave 169d170247 Explicit annotation processors required with JDK 22
JDK 22 changes such that annotation processors are not found by default on
the classpath. As such they either need to be explicitly registered with
the compiler (e.g. maven-compiler-plugin) or use -proc:full
2023-10-16 21:54:32 +13:00
Rob Bygrave d0ee42e0de Include <compilerArgument>-proc:full</compilerArgument> for JDK 22 EA build 2023-10-16 20:32:41 +13:00
Rob BygraveandGitHub 91ecc074a7 Merge pull request #3243 from ebean-orm/feature/postgis-dependency
Fix ebean-bom dependencies for ebean-test
2023-10-11 20:04:12 +13:00
Rob Bygrave c2b381af1e Fix ebean-bom dependencies for ebean-test
Fix by removing the scopes test and provided in the ebean-bom
2023-10-11 20:03:12 +13:00
Rob BygraveandGitHub eeb0a15617 Merge pull request #3242 from ebean-orm/feature/postgis-dependency
Add missing dependency for ebean-postgis-types to ebean-postgis
2023-10-11 19:59:48 +13:00
Rob Bygrave 6abed0dd73 Add missing dependency for ebean-postgis-types to ebean-postgis 2023-10-11 19:58:12 +13:00
Rob BygraveandGitHub 1318cd706f Merge pull request #3241 from ebean-orm/feature/StdOperators-dep
Remove the Deprecated(experimental) from StdOperators
2023-10-10 23:43:29 +13:00
Rob Bygrave 1e8c609dec Remove the Deprecated(experimental) from StdOperators 2023-10-10 23:42:47 +13:00
Rob Bygrave 4506596379 Tidy remove old stylesheet.css from source 2023-10-10 23:41:42 +13:00
Rob Bygrave 0b2c016af2 Version 13.23.0 2023-10-10 22:46:30 +13:00
Rob Bygrave 29d946ec59 Bump ebean-agent 2023-10-10 22:33:35 +13:00
Rob Bygrave da76b422c8 Fix test with sql logging including executeBatch() for sqlserver 2023-10-10 22:26:25 +13:00
Rob Bygrave a1a3b33fc6 Fix test with sql logging including executeBatch() for sqlserver 2023-10-10 21:47:14 +13:00
Rob BygraveandGitHub 7ecd7877d5 Merge pull request #3240 from ebean-orm/feature/OneToOne-softDelete-join
OneToOne with SoftDelete join missing deleted predicate
2023-10-10 21:38:50 +13:00
Rob Bygrave e5f64f4211 Fix test with sql logging including executeBatch() 2023-10-10 21:38:17 +13:00
Rob Bygrave 90a6b71b7e #3240 followup no functional change, tidy use of ctx.joinAdded() 2023-10-10 21:33:23 +13:00
Rob Bygrave 131d531922 #3240 followup no functional change, tidy use of ctx.joinAdded() 2023-10-10 21:32:28 +13:00
Rob Bygrave 5684919a9f Fix for OneToOne with SoftDelete join missing deleted predicate 2023-10-10 21:27:26 +13:00
Rob Bygrave 80fc0723c8 Failing test for OneToOne with SoftDelete join missing deleted predicate 2023-10-10 21:24:35 +13:00
Rob BygraveandGitHub 3ae4c8981e Merge pull request #3238 from ebean-orm/feature/sql-log-executeBatch
Change SQL log to include executeBatch() via BatchedPstmt
2023-10-10 09:15:06 +13:00
Rob Bygrave b80c67286b Change SQL log to include executeBatch() via BatchedPstmt
Adjustments to tests to support this
2023-10-10 01:02:11 +13:00
Rob Bygrave 0bead4135e Change SQL log to include executeBatch() via BatchedPstmt
Adjustments to tests to support this
2023-10-10 00:59:25 +13:00
Rob Bygrave ac6473e039 Change SQL log to include executeBatch() via BatchedPstmt 2023-10-10 00:59:06 +13:00
Rob BygraveandGitHub 32188bdd54 Merge pull request #3237 from ebean-orm/feature/3233
#3234 - Query Bean Generator Generates Non-Compilable Code When Entit…
2023-10-09 22:04:05 +13:00
Rob Bygrave b3a577e3f9 #3234 - Query Bean Generator Generates Non-Compilable Code When Entity Uses @Embeddable Inner Class For Primary Key Type 2023-10-09 22:03:02 +13:00
Rob BygraveandGitHub 7d1774e2ed Merge pull request #3236 from ebean-orm/feature/3233
In version 13.22 if the entity definition is in a different package, …
2023-10-09 22:01:38 +13:00
Rob Bygrave 395edb62bf In version 13.22 if the entity definition is in a different package, the generated query bean cannot resolve the symbol erro 2023-10-09 21:10:56 +13:00
Rob BygraveandGitHub 716b7e7b93 Merge pull request #3232 from ebean-orm/feature/postgis-rename-types-add-composite
Add ebean-postgres-types to ebean-bom
2023-10-06 23:16:27 +13:00
Rob Bygrave 9aadc347d7 Add ebean-postgres-types to ebean-bom 2023-10-06 23:15:43 +13:00
Rob BygraveandGitHub d2d1423c88 Merge pull request #3231 from ebean-orm/feature/postgis-rename-types-add-composite
Rename ebean-postgis -> ebean-postgis-types + add new composite ebean…
2023-10-06 23:07:03 +13:00
Rob Bygrave 73cfea6053 For postgres dependency exclude checker framework dependency 2023-10-06 23:06:41 +13:00
Rob Bygrave 1614166d75 Rename ebean-postgis -> ebean-postgis-types + add new composite ebean-postgis
With this, people can depend on ebean-postgis (the composite) and get all the
dependencies they need (which is ebean-platform-postgres + ebean-postgis-types
+ others).

This should just make it easier for people in that currently we need both
ebean-postgis + ebean-postgres which isn't obvious enough.
2023-10-06 22:59:00 +13:00
Rob BygraveandGitHub 3d9b122a9f Merge pull request #3230 from ebean-orm/feature/deprecate-servletContextListener
Deprecate ServletContextListener (for shutdown in servlet container)
2023-10-06 22:40:07 +13:00
Rob Bygrave 1cc1d29c2f Deprecate ServletContextListener (for shutdown in servlet container)
Deprecated for removal - no intention to replace. Create your own
ServletContextListener if needed for your application.
2023-10-06 22:38:26 +13:00
Rob Bygrave 45467a3358 Bump ebean-agent 2023-10-06 22:07:01 +13:00
Rob Bygrave bdc236159b Bump avaje-config to 3.8 2023-10-06 22:03:45 +13:00
Rob BygraveandGitHub f0047ffd75 Merge pull request #3228 from ebean-orm/feature/3209
#3209 MetricsAsJson escape the SQL string content
2023-10-04 23:43:07 +13:00
Rob Bygrave 429843c358 #3209 MetricsAsJson escape the SQL string content 2023-10-04 23:15:14 +13:00
Rob Bygrave eab4f9c739 Add Java 21 to Multi-JDK Build 2023-09-20 23:12:04 +12:00
Rob BygraveandGitHub b445857227 Merge pull request #3224 from FOCONIS/use-glassfish-jaxb
use glassfish jaxb instead of old com.sun jaxb
2023-09-19 23:14:42 +12:00
Rob Bygrave dc7b73fc25 Follow up #3223 - modify test, could use @Column(insertable = false, updatable = false) instead of @Formula 2023-09-19 23:03:30 +12:00
Rob Bygrave d5048db2c6 Follow up #3223 - Add @IdClass example test 2023-09-19 23:02:31 +12:00
Rob Bygrave 0b0b7cbc67 Follow up #3223 - tidy test only
Make Embedded Id bean more immutable via final fields and constructor
2023-09-19 22:47:23 +12:00
Rob BygraveandGitHub 008f132453 Merge pull request #3223 from FOCONIS/fix-find-props-for-id-class
Regression of #3133 with formula properties
2023-09-19 22:39:29 +12:00
Roland Praml 6d2038355f use glassfish jaxb instead of old com.sun jaxb 2023-09-19 08:37:20 +02:00
Roland Praml 004f4deae3 Regression of #3133 with formula properties 2023-09-18 14:59:17 +02:00
Rob BygraveandGitHub 9223796f02 Merge pull request #3221 from ebean-orm/feature/jakarta-master
Move source to Jakarta (use ./jakarta-to-javax.sh)
2023-09-11 23:34:15 +12:00
Rob Bygrave ff43672f4e Move source to Jakarta (use ./jakarta-to-javax.sh)
Moving the master branch to use jakarta based code and
dependencies. Change to use ./jakarta-to-javax.sh to convert
back to javax when releasing that.
2023-09-11 23:31:01 +12:00
Rob Bygrave 811255200e Update jakarta-to-javax.sh for jakarta.transaction module name 2023-09-11 23:21:55 +12:00
Rob BygraveandGitHub 6db1b86e12 Merge pull request #3220 from ebean-orm/feature/3216
#3216 - Fix querybean generation for @Embedded beans (fix for 13.22.0…
2023-09-11 23:06:31 +12:00
Rob Bygrave 400e840c22 Fix test for MariaDB which does not support delete with subquery with limit
like:

delete from bbookmark_user where id in (select t0.id from bbookmark_user t0 where t0.name = ? limit 10)
2023-09-11 23:05:55 +12:00
Rob Bygrave f03892a4bd #3216 - Fix querybean generation for @Embedded beans (fix for 13.22.0 change)
Version 13.22.0 added a change to query bean generation that has an issue for
embedded beans. This fixes that issue.
2023-09-11 23:01:44 +12:00
Rob Bygrave 0842a3f3e2 Version 13.22.0 2023-08-30 22:17:31 +12:00
Rob Bygrave bd0cad723d Add test for Map @OneToMany without orphanRemoval
Without orphanRemoval then map.clear() does not invoke any lazy loading.
2023-08-29 22:16:37 +12:00
Rob BygraveandGitHub c83c85efc3 Merge pull request #3206 from ebean-orm/feature/3173-beanMap-clear
Map.clear() on a @OneToMany orphanRemoval=true invokes 1+N queries du…
2023-08-29 22:10:36 +12:00
Rob Bygrave b6b8f77213 Map.clear() on a @OneToMany orphanRemoval=true invokes 1+N queries due to MapKey
The fix is for LoadManyRequest to detect when a MapKey is on the collection
and include that in the lazy loading query (to avoid the N queries invoked)
2023-08-29 22:08:56 +12:00
Rob Bygrave 770eb06cab Add test for lazy loading @OneToMany using Map 2023-08-29 22:03:58 +12:00
Rob BygraveandGitHub 180b4d6e46 Merge pull request #3205 from ebean-orm/feature/3173-beanSet-clear
Follow up #3173 - Change BeanSet clear() to lazy load ALL properties
2023-08-29 22:02:07 +12:00
Rob Bygrave 5377454476 Follow up #3173 - Change BeanSet clear() to lazy load ALL properties
To avoid the 1+N lazy loading queries that are invoked due to the clear()
when the entity bean in the Set has a hashCode/equals implementation
2023-08-29 21:20:19 +12:00
Rob BygraveandGitHub dbbf6dd566 Merge pull request #3204 from ebean-orm/feature/3173-beanSet-clear
Follow up #3173 - Add test for BeanSet clear() when hashCode/equals used
2023-08-29 21:16:44 +12:00
Rob Bygrave 4b9d4d0a90 Follow up #3173 - Add test for BeanSet clear() when hashCode/equals used
This shows the extra lazy loading that is occurring when clear() is
called on the [Bean]Set DUE to the hashcode/equals implementation that
is present on the entity bean that is in the Set.
2023-08-29 21:13:19 +12:00
Rob Bygrave 90fc4466bf Follow up #3173 - Add test for BeanSet lazy loading OneToMany with hashCode/equals 2023-08-29 18:43:16 +12:00
Rob BygraveandGitHub 0d69377f8b Merge pull request #3203 from ebean-orm/feature/3173-BeanSet
#3173 - BeanSet lazy loading / Too many DataSource connections used
2023-08-29 18:32:04 +12:00
Rob Bygrave 359a55d7a5 #3173 - BeanSet lazy loading / Too many DataSource connections used
- The error reported was that a DataSource connection pool maxed out
- The symptom was that there was an additional lazy loading queries invoked via the hashCode/equals implementation of ManyToMany Set.
- The fix is for BeanSet init() to lazy load with onlyIds = false, that avoids the extra lazy loading query from being executed
2023-08-29 18:28:09 +12:00
Rob BygraveandGitHub b7804e7486 Merge pull request #3197 from ebean-orm/feature/parent-poms
Update ebean-agent to 13.22.0, required to support change in query bean generation
2023-08-27 22:48:17 +12:00
Rob Bygrave febb018036 Update ebean-agent to 13.22.0 2023-08-27 21:59:34 +12:00
Rob BygraveandGitHub dc0585246f Merge pull request #3196 from ebean-orm/feature/parent-poms
Use ebean-parent as parent pom for composites and platforms
2023-08-27 21:55:34 +12:00
Rob Bygrave 22c1848f58 Use ebean-parent as parent pom for composites and platforms 2023-08-27 21:53:11 +12:00
Rob BygraveandGitHub 054ea26893 Merge pull request #3195 from ebean-orm/feature/deprecate-database-commitTransaction
Deprecate for removal Database.commitTransaction() and Database.rollb…
2023-08-27 20:32:07 +12:00
Rob Bygrave 8c30b66d39 Add forRemoval = true on existing @Deprecated 2023-08-27 20:31:03 +12:00
Rob Bygrave 14f9fe68f7 Deprecate for removal Database.commitTransaction() and Database.rollbackTransaction() 2023-08-27 20:30:33 +12:00
Rob Bygrave d56ca5b841 Deprecate for removal Database.commitTransaction() and Database.rollbackTransaction()
Migrate to using try-with-resources and transaction.commit() and transaction.rollback()
2023-08-27 20:29:05 +12:00
Rob BygraveandGitHub 3f97f0f212 Merge pull request #3192 from ebean-orm/feature/spiEbeanServer
Refactor internal SpiEbeanServer API - transaction from SpiQuery
2023-08-26 00:19:16 +12:00
Rob Bygrave 60e0c552ab Fix test for MySql, which does not support delete statement with limit clause 2023-08-26 00:17:57 +12:00
Rob Bygrave f889628677 No functional change, tidy in persist.dml and dmlbind packages only 2023-08-26 00:15:37 +12:00
Rob Bygrave 128bd171f5 Refactor SpiEbeanServer for SpiSqlQuery with transaction (vs passing transaction) 2023-08-25 23:51:09 +12:00
Rob Bygrave 6402a346a1 Reuse via adding SpiOrmQueryRequest.isGetAllFromBeanCache() 2023-08-25 23:28:07 +12:00
Rob Bygrave 0ab0f9c569 Refactor internal SpiEbeanServer API - transaction from SpiQuery
Originally the API took explicit transactions but then the API changed
toward query.usingTransaction(), which means the SpiQuery holds the
explicit transaction.

This change is to update the SpiEbeanServer API to reflect that it can get
explicit transaction from SpiQuery.transaction() rather than pass transaction
around.

Doing this also identified a small bug where L2 cache could be hit when it should
not after there is some update on the transaction (hence the adjustment to the
test TestBeanCache missCount)
2023-08-25 23:15:51 +12:00
Rob BygraveandGitHub 19e21e17cc Merge pull request #3191 from ebean-orm/feature/spiEbeanServer
#3188 Fix findFutureCount() when there is a current transaction in scope
2023-08-25 21:15:15 +12:00
Rob Bygrave 7e60c66759 Follow up for #3188 Add tests for futures when creating new transaction 2023-08-25 21:05:14 +12:00
Rob Bygrave 4f18dc339f Follow up for #3188 Fix findFutureList() and findFutureIds() when txn in scope
Apply the same fix to findFutureList() and findFutureIds()
2023-08-25 20:56:55 +12:00
Rob Bygrave 60a2626f61 #3188 Fix findFutureCount() when there is a current transaction in scope 2023-08-25 20:32:48 +12:00
Rob BygraveandGitHub e3a6f12478 Merge pull request #3190 from ebean-orm/feature/spiEbeanServer
Refactor SpiEbeanServer to use SpiQuery
2023-08-25 20:31:29 +12:00
Rob Bygrave 2e980b06f6 Refactor SpiEbeanServer to use SpiQuery 2023-08-25 17:53:23 +12:00
Rob BygraveandGitHub b27b5512e3 Merge pull request #3189 from ebean-orm/feature/bump-datasource-dependency
Bump to ebean-datasource 8.7
2023-08-25 15:40:39 +12:00
Rob Bygrave 3a013d50d6 Bump to ebean-datasource 8.7 2023-08-25 15:40:09 +12:00
Rob Bygrave 3ebfd2e9e6 Update test only - TestDeleteCascadingOneToMany 2023-08-24 21:01:11 +12:00
Rob BygraveandGitHub f51b69445a Merge pull request #3187 from ebean-orm/feature/3183-deleteQueryIn
Update test only - TestDeleteCascadeById
2023-08-24 20:55:14 +12:00
Rob Bygrave 96904d525f Update test only - TestDeleteCascadeById 2023-08-24 20:54:43 +12:00
Rob BygraveandGitHub 26fa885adb Merge pull request #3186 from ebean-orm/feature/3183-deleteQueryIn
#3183 - Fix for: Wrong limit using setMaxRows on delete between calls
2023-08-24 20:38:32 +12:00
Rob Bygrave f4ca4ec476 #3183 - Fix for: Wrong limit using setMaxRows on delete between calls
Reproduces when the delete needs to perform a select due to caching or
cascading of the delete
2023-08-24 20:35:11 +12:00
Rob Bygrave 327995526e Fix tests for Postgres 2023-08-24 20:17:41 +12:00
Rob BygraveandGitHub dfbbdc7d58 Merge pull request #3182 from ebean-orm/feature/delete-batch-v2
When delete batching, use number of id properties
2023-08-23 10:54:21 +12:00
Rob Bygrave 35894b3d8f When delete batching, ALSO in deleteManyDetails use number of properties
Use int batch = maxDeleteBatch / targetDesc.idBinder().size()
2023-08-22 23:55:55 +12:00
Rob Bygrave 0f219b4cd0 When delete batching, use number of id properties 2023-08-22 23:49:38 +12:00
Rob Bygrave bfe94786de Merge branch 'FOCONIS-experimental-elliminate-not-in-with-too-many-params' 2023-08-22 23:43:41 +12:00
Rob Bygrave 6cab2498dc Merge branch 'experimental-elliminate-not-in-with-too-many-params' of github.com:FOCONIS/ebean into FOCONIS-experimental-elliminate-not-in-with-too-many-params 2023-08-22 23:22:11 +12:00
Rob BygraveandGitHub dbe81bdb6e Merge pull request #3180 from FOCONIS/bugfix/setId-or-idEq-in-subquery
BUG: Using a subquery with idEq or setId is missing the bind value
2023-08-22 22:35:31 +12:00
Jonas Pöhler 2e2b3844fe Tidy test 2023-08-22 11:36:44 +02:00
Jonas Pöhler 78b77dcd82 Potential Fix for using idEq or setId in subquery 2023-08-22 11:04:48 +02:00
Jonas Pöhler 90614adb2b ADD: Testcase to show missing bind values when using idEq or setId in subquery 2023-08-22 11:04:24 +02:00
Rob BygraveandGitHub 019ef43fe7 Merge pull request #3177 from ebean-orm/feature/remove-InTuples-literal-mode
#3166 Remove InTuples literal mode
2023-08-22 08:23:54 +12:00
Rob Bygrave cfb6f0a908 #3166 Remove InTuples literal mode, remove related plan useCache() 2023-08-22 08:18:19 +12:00
Roland Praml 77aeda1753 draft: elliminate the "not in" query that may 'explode' on SqlServer 2023-08-21 17:10:23 +02:00
Roland Praml 2a24ec3d49 Added some tests 2023-08-21 16:51:19 +02:00
Roland Praml d9d09b31b4 Refactored delete-by-id 2023-08-21 15:36:05 +02:00
Rob Bygrave 56550a9534 #3166 Remove InTuples literal mode 2023-08-21 23:16:55 +12:00
Rob BygraveandGitHub f40beb8234 Merge pull request #3175 from ebean-orm/feature/ListsPartition
For Lists.partition() fix for empty list input
2023-08-21 20:37:32 +12:00
Rob Bygrave cb06052c86 For Lists.partition() fix for empty list input
Fix such that empty list input produces an empty list
2023-08-21 20:19:59 +12:00
Rob BygraveandGitHub e09265fbc5 Merge pull request #3174 from FOCONIS/more-char-append
Use char-append instead of String-append
2023-08-21 19:58:42 +12:00
Roland Praml dede93ca62 Use char-append instead of String-append 2023-08-21 08:22:18 +02:00
Rob BygraveandGitHub caf8bd0c0f Merge pull request #3172 from ebean-orm/feature/filterManyRaw
Add filterManyRaw() and Deprecate filterMany( <string expressions> )
2023-08-21 11:30:43 +12:00
Rob Bygrave 01d89a01a5 Fix new test in QCustomerTest 2023-08-21 11:22:02 +12:00
Rob Bygrave b0da647b0e Fix javadoc for filterManyRaw() 2023-08-21 11:17:29 +12:00
Rob Bygrave fbcd4c3133 Add filterManyRaw() and Deprecate filterMany( <string expressions> )
The filterMany( <string expressions> ) uses the language parser which
ultimately will we probably remove in ebean 15.x

Code can migrate to filterManyRaw() instead or better yet change to
use the improved query beans filterMany( <closure> ) option that will
be included in this same ebean release.
2023-08-21 11:15:39 +12:00
Rob BygraveandGitHub 3e41c5973b Merge pull request #3171 from ebean-orm/feature/filterMany-raw-expression
FIX for filterMany with raw expression with single SQL query
2023-08-21 09:39:40 +12:00
Rob Bygrave 1933beed9b Tidy unused import in CQueryPredicates 2023-08-20 23:52:10 +12:00
Rob Bygrave defb35b258 FIX for filterMany with raw expression with single SQL query
Fix for the case where the filterMany is not executed on a separate
query but instead part of the origin query.

The fix is to use the appropriate DeployParser and also fix the path
alias like ${} -> ${contacts}
2023-08-20 23:32:55 +12:00
Rob Bygrave 8a4024ecfc FIX for filterMany with raw expression with single SQL query
Fix for the case where the filterMany is not executed on a separate
query but instead part of the origin query.

The fix is to use the appropriate DeployParser and also fix the path
alias like ${} -> ${contacts}
2023-08-19 13:54:38 +12:00
Rob Bygrave 9756c9133e Improve existing test for filterMany using raw with separate SQL query for filterMany 2023-08-19 13:46:45 +12:00
Rob BygraveandGitHub c07d5e2c97 Merge pull request #3170 from ebean-orm/feature/prefer-char-append
Refactor prefer char append
2023-08-19 11:11:35 +12:00
Rob Bygrave 00e594d4fa Refactor prefer char append 2023-08-19 11:01:15 +12:00
Rob Bygrave 3bf316af2b Update Test QCustomerTest removing extra space character in the SQL 2023-08-19 10:17:00 +12:00
Rob BygraveandGitHub b116d3da28 Merge pull request #3169 from ebean-orm/feature/filterMany-TQAssoc
Add Query bean filterMany() taking a closure
2023-08-19 10:11:46 +12:00
Rob BygraveandGitHub 804618d699 Merge pull request #3168 from ebean-orm/feature/like-extra-space
Remove extra space added to the generated SQL via the LIKE expression
2023-08-19 10:05:17 +12:00
Rob Bygrave 0e9fe6a096 Remove extra space added to the generated SQL via the LIKE expression 2023-08-19 09:29:19 +12:00
Rob Bygrave ded4b94e54 Add Query bean filterMany() taking a closure
Query beans also generate a "Assoc" query bean that is used
for the relationships. Previously these were generated into a
.query.assoc package and with this they are generated as an
inner class of the query bean.

This then allows the change where an additional filterMany()
is generated on the "Assoc" bean that takes a closure. This
simplifies the use of query beans for filterMany.

This change to the generated query beans needs a change to the
ebean-agent enhancement.
2023-08-18 22:12:30 +12:00
Rob Bygrave eb0812df16 Bump to next snapshot 2023-08-17 23:26:26 +12:00
Rob Bygrave 9ccaa824e0 Version 13.21.0 2023-08-17 22:51:00 +12:00
Rob BygraveandGitHub d6e46b15a3 Merge pull request #3167 from ebean-orm/feature/InTuples-Literal-skipCache
Change Lists.partition() argument order to match Guava's
2023-08-17 15:36:35 +12:00
robin.bygrave bab9be0228 Change Lists.partition() argument order to match Guava's
- May as well match what they have in terms of arg order
- Change from interface to class might be better
2023-08-17 15:36:03 +12:00
Rob BygraveandGitHub 9331050a43 Merge pull request #3166 from ebean-orm/feature/InTuples-Literal-skipCache
InTuples literal mode - don't cache ebean compiled query plan
2023-08-17 15:34:17 +12:00
robin.bygrave 9bcd189730 Test TestInTuplesWithLocalDate does not support SQLServer and DB2 yet 2023-08-17 15:24:28 +12:00
Rob BygraveandGitHub 428365ceb9 Merge pull request #3164 from FOCONIS/bugfix/drop_foreign_key_without_index
BUG: Include drop for foreign keys without index when dropping table
2023-08-17 15:12:19 +12:00
robin.bygrave 76c889c6d9 InTuples literal mode - don't cache ebean compiled query plan
- Don't cache ebean compiled query plan when InTuples goes into literal mode
- Postgres maxInBinding = 32_000;
- SQLite maxInBinding = 800;
- Note that not caching the compiled query plan means that metrics visitor isn't
  going to see it, we lose collection of that query execution metric. We might
  need a plan to fix this later.
2023-08-17 15:08:16 +12:00
Rob BygraveandGitHub 9e4007d25a Merge pull request #3165 from ebean-orm/feature/Lists-partitions
Add support for literal mode for InTuples with lots of entries
2023-08-17 10:31:03 +12:00
Rob Bygrave 9d7754b92d Add support for literal mode for InTuples with lots of entries
So as to not exceed the limit on bind values, the InTuples expression can
go into literal mode where it uses literal values for supported types -
Numbers, Strings, UUID, and LocalDate.
2023-08-17 00:33:56 +12:00
Rob BygraveandGitHub 3c80032063 Merge pull request #3163 from ebean-orm/feature/Lists-partitions
Add Lists.partition() helper method and use in DefaultPersister batch deletion
2023-08-17 00:32:04 +12:00
Jonas Pöhler 7dae937491 Generate working migration 2023-08-16 12:00:23 +02:00
Jonas Pöhler 6ce5e865ca FIX: also include foreign keys without index in drop statement 2023-08-16 11:59:50 +02:00
Jonas Pöhler b0d8fa0286 Generate failing migration 2023-08-16 11:58:57 +02:00
Jonas Pöhler 83c85adbde ADD: testcase 2023-08-16 11:57:34 +02:00
Rob Bygrave a1b51fd8ef For DefaultPersister batch deletion, use more explicit maxDeleteBatch 2023-08-16 17:55:41 +12:00
Rob Bygrave bcc4034371 Add Lists.partition() helper method and use in DefaultPersister batch deletion 2023-08-16 17:39:10 +12:00
Rob BygraveandGitHub 3dde07fc9f Merge pull request #3162 from ebean-orm/feature/3133-postgres
Tidy IdBinderEmbedded - merge use of getIdProperty() and idSelect()
2023-08-16 00:17:23 +12:00
Rob Bygrave 87ada9e999 IdBinder - refactor rename methods 2023-08-16 00:11:46 +12:00
Rob Bygrave ea55f25d44 Tidy IdBinderEmbedded - merge use of getIdProperty() and idSelect() to use idSelect()
Means we can remove getIdProperty()
2023-08-15 23:36:59 +12:00
Rob BygraveandGitHub 2231f723f8 Merge pull request #3161 from ebean-orm/feature/3133-postgres
Fix to #3133 changes for Postgres adding back support for MultiValue binding
2023-08-15 23:18:53 +12:00
Rob Bygrave 7c16694d4b Fix to #3133 changes for Postgres adding back support for MultiValue binding
The MultiValue binding that we use for Postgres, Yugabyte etc was lost with
the changes in #3133 and this puts that back.

We desire to use Postgres ANY Array binding for these cases.
2023-08-15 23:17:31 +12:00
Rob BygraveandGitHub ea60ff47cf Merge pull request #3160 from ebean-orm/feature/alsoIf
Add Query alsoIf() to conditionally apply changes to a query
2023-08-15 22:25:28 +12:00
Rob BygraveandGitHub 1f7912dab6 Merge pull request #3159 from ebean-orm/feature/idClass
Change IdClass property name to _$IdClass$
2023-08-15 21:59:56 +12:00
Rob Bygrave ec0c00eb72 Add Query alsoIf() to conditionally apply changes to a query 2023-08-15 21:56:50 +12:00
Rob Bygrave dd99e32cc6 Change IdClass property name to _$IdClass$ 2023-08-15 21:55:09 +12:00
Rob BygraveandGitHub 1decbe0152 Merge pull request #3147 from FOCONIS/rethrow-error-in-commit
FIX: Rethrow error in commit path of callbacks
2023-08-14 23:25:04 +12:00
Rob BygraveandGitHub d58e3d023f Merge pull request #3158 from ebean-orm/feature/tidy-idBinderEmbedded
Followup for #3133 - "Embedded id expansion on parentIds" for SQLServer and DB2
2023-08-14 23:06:28 +12:00
Rob Bygrave 1598b40c36 Followup for #3133 - "Embedded id expansion on parentIds" for SQLServer and DB2 2023-08-14 23:00:41 +12:00
Rob BygraveandGitHub 66ef667a0a Merge pull request #3157 from ebean-orm/feature/tidy-idBinderEmbedded
Tidy IdBinderEmbedded final fields, StringBuilder sizes and reuse code
2023-08-14 22:59:15 +12:00
Rob Bygrave e821d66268 Tidy IdBinderEmbedded final fields, StringBuilder sizes and reuse code 2023-08-14 15:10:00 +12:00
Rob BygraveandGitHub b8e164e04c Merge pull request #3148 from FOCONIS/fix-recursive-batch-flush
FIX: Recursive batch flush can save beans in wrong order
2023-08-14 13:55:50 +12:00
Rob BygraveandGitHub 9097466a7b Merge pull request #3145 from FOCONIS/m2m-where-formula
FIX: Query on formula m2o-property uses wrong alias:
2023-08-14 13:55:21 +12:00
Rob BygraveandGitHub 99604d8ec3 Merge pull request #3155 from ebean-orm/feature/3133-IdClass-match-on-name
#3133 - For IdClass match on property name
2023-08-14 13:53:58 +12:00
Rob Bygrave 95d37fc3dc Temporary ignore test TestCompositeForeignKey for DB2 and SQLServer 2023-08-14 13:41:34 +12:00
Rob Bygrave 76d85adc98 Fix tests for #3133 MySql and SQLServer which require column ordering of PK and FK to match 2023-08-14 11:14:43 +12:00
Rob Bygrave 2f233db465 #3133 - For IdClass match on property name 2023-08-10 23:22:57 +12:00
Rob Bygrave 1ca73ca6aa Test only - Update test IdClass CEPProductCategoryId to match expectations 2023-08-10 23:17:47 +12:00
Rob BygraveandGitHub d5e4c13fa8 Merge pull request #3154 from ebean-orm/feature/3134-idClass-delete
#3134 - String cannot be cast to class io.ebean.bean.EntityBean" when deleting entities that use cascade = [CascadeType.ALL] with composite keys
2023-08-10 21:15:09 +12:00
Rob Bygrave b5ac31838c #3134 Fix for - String cannot be cast to class io.ebean.bean.EntityBean" when deleting entities that use cascade = [CascadeType.ALL] with composite keys 2023-08-10 21:11:58 +12:00
Rob Bygrave e3e9412eea #3134 Failing test - String cannot be cast to class io.ebean.bean.EntityBean" when deleting entities that use cascade = [CascadeType.ALL] with composite keys 2023-08-10 20:50:40 +12:00
Roland PramlandRoland Praml d3427876b7 FIX: Recursive batch flush can save dependant beans in wrong order 2023-08-08 16:59:46 +02:00
Roland Praml 4b2976e31b Rethrow error in commit path of callbacks 2023-08-08 16:35:25 +02:00
Roland Praml 5720ee65b3 Ignored Postgres Platform 2023-08-08 14:02:49 +02:00
Roland Praml 7f441ce72e FIX: M2M Where Formula joins 2023-08-08 14:02:34 +02:00
Rob BygraveandGitHub 83e87b0c67 Merge pull request #3140 from ebean-orm/feature/bump-datasource
Bump ebean-datasource to 8.6, increases validation timeout default to 30 secs
2023-07-23 14:35:57 +12:00
Rob Bygrave 578feac87f Bump ebean-datasource to 8.6, increases validation timeout default to 30 secs 2023-07-21 17:02:08 +12:00
Rob BygraveandGitHub 42a64e715d Merge pull request #3138 from ebean-orm/feature/postgres-queryplan-capture-buffers
[Postgres] Include buffers in Postgres explain - explain (analyze, buffers)
2023-07-18 14:35:24 +12:00
robin.bygrave 12a3a180f4 [Postgres] Include buffers in Postgres explain - explain (analyze, buffers) 2023-07-18 13:52:21 +12:00
Rob BygraveandGitHub 8acd5bcb39 Merge pull request #3131 from ebean-orm/feature/h2-nonKeyWords
Modify ebean-test H2Database setup to default KEY,VALUE as non-keywords
2023-07-11 12:49:15 +12:00
Rob BygraveandGitHub eb71756c65 Merge pull request #3136 from ebean-orm/dependabot/maven/com.h2database-h2-2.2.220
Bump h2 from 2.1.214 to 2.2.220
2023-07-11 12:48:04 +12:00
dependabot[bot]andGitHub 8c8cadd471 Bump h2 from 2.1.214 to 2.2.220
Bumps [h2](https://github.com/h2database/h2database) from 2.1.214 to 2.2.220.
- [Release notes](https://github.com/h2database/h2database/releases)
- [Commits](https://github.com/h2database/h2database/compare/version-2.1.214...version-2.2.220)

---
updated-dependencies:
- dependency-name: com.h2database:h2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-07 21:57:51 +00:00
Rob BygraveandGitHub 222c49c59b Merge pull request #3130 from ebean-orm/feature/3123-root-error-suppressed
#3123 Root cause error can be suppressed on initialisation
2023-07-05 23:47:11 +12:00
Rob Bygrave 1e860112e6 Modify ebean-test H2Database setup to default KEY,VALUE as non-keywords
H2Database 2.x changed KEY and VALUE to be deemed keywords for SQL compliance. This is actually a bit of a pain as all the other databases we test allow KEY and VALUE as column names.

This changes the setup for H2Database to treat KEY and VALUE as non keywords as before and be more consistent with the other databases.
2023-07-05 23:46:06 +12:00
Rob Bygrave ffc21daaba Bump to next snapshot 2023-07-05 23:28:49 +12:00
Rob Bygrave f9adcb2c5a #3123 Root cause error can be suppressed on initialisation 2023-07-05 23:16:00 +12:00
Rob Bygrave d051bba71f Version 13.20.1 2023-07-04 12:05:30 +12:00
Rob Bygrave f414f04033 Add note on lack of support for InTuples with SQLServer and DB2 2023-07-04 12:05:10 +12:00
Rob Bygrave ac466ecd79 #3125 Add query.usingMaster() for query beans 2023-07-03 23:30:02 +12:00
Rob Bygrave 262a7f9bab Bump ebean-agent version 2023-07-03 22:57:55 +12:00
Rob BygraveandGitHub bb02d74005 Merge pull request #3125 from ebean-orm/feature/query-usingMaster
Add query.usingMaster() to explicitly choose master data source
2023-07-03 22:48:47 +12:00
Rob BygraveandGitHub e9b2b8d266 Merge pull request #3017 from ebean-orm/feature/db2luw9
Initial DB2Luw9Platform using row_number() for row limiting sql
2023-07-03 22:43:55 +12:00
Rob Bygrave fc16bde227 Modify ImplicitReadOnlyTransaction, call deactivate in finally 2023-07-03 22:43:13 +12:00
Rob Bygrave d1775dfcc4 #3017 Change DB2LegacyPlatform to also use the row_number limiters 2023-07-03 22:35:46 +12:00
3d5937f6da Update platforms/db2/src/main/java/io/ebean/platform/db2/DB2RowNumberBasicLimiter.java
Bump StringBuilder to use 120

Co-authored-by: Roland Praml <roland.praml@foconis.de>
2023-07-03 22:31:01 +12:00
Rob BygraveandGitHub adca8cd8fa Merge branch 'master' into feature/db2luw9 2023-07-03 22:28:43 +12:00
Rob BygraveandGitHub 6d30e6310b Merge pull request #3127 from ebean-orm/feature/3126
#3126 - Incorrect complex indexes generation
2023-07-03 22:22:32 +12:00
Rob Bygrave 79ed0a5f8e #3126 - Incorrect complex indexes generation 2023-07-03 22:19:38 +12:00
Rob Bygrave 94b3a020d5 Modify ImplicitReadOnlyTransaction useCommit to check connection.getAutoCommit() 2023-07-03 21:40:21 +12:00
Rob Bygrave 3e241907e6 Modify internal ImplicitReadOnlyTransaction to also support calling commit()
Originally, ImplicitReadOnlyTransaction was built to support read-only DataSource where the connections are using autoCommit true. This change modified ImplicitReadOnlyTransaction to also support use with the main DataSource where the connection are not using autoCommit true.

This is also now needed for the query.usingMaster() case where we have an implicit read only transaction but use the main DataSource with underlying connection requiring explicit commit() at the end of the transaction.
2023-07-03 21:27:58 +12:00
Rob Bygrave c4af1d9b23 Add query.usingMaster() to explicitly choose master data source
When we have a read replica with potential for replication lag, and config a read only DataSource to use that read replica, by default a query executed without a current transaction will use the read replica.

We specify usingMaster() when we explicitly want to execute a query and use the master data source.
2023-07-03 16:41:22 +12:00
Rob BygraveandGitHub 7702169762 Merge pull request #3124 from ebean-orm/feature/InTuples
Add InTuples expression for multi-column IN expression
2023-07-03 12:48:21 +12:00
Rob Bygrave 8209d9e229 Add SpiInTuples to hide more details from InTuples 2023-07-03 12:41:31 +12:00
Rob Bygrave 664120f369 Add InTuples expression for multi-column IN expression 2023-07-03 11:54:38 +12:00
Rob Bygrave e952b555e0 Add InTuples expression for multi-column IN expression 2023-07-03 11:49:53 +12:00
Rob BygraveandGitHub d99c50da75 Merge pull request #3122 from ebean-orm/feature/3109-jta-txn-fix
#3109 Fix for JtaTransactionManager when no active transaction
2023-06-26 21:30:55 +12:00
Rob Bygrave d4bec166f7 #3109 Fix for JtaTransactionManager when no active transaction
The call to registry() can throw an exception so
pulling that inside the try catch block and handle
that as no active transaction returning null.
2023-06-26 21:30:01 +12:00
Rob Bygrave 9a4b9d4bec Bump to next snapshot version 2023-06-21 07:08:13 +12:00
Rob Bygrave 63a23904ac Update for DB2Luw9 with rn column as last column 2023-04-13 21:52:09 +12:00
Rob Bygrave 1807fc201e Initial DB2Luw9Platform using row_number() for row limiting sql 2023-03-30 22:56:55 +13:00
1597 changed files with 9624 additions and 5563 deletions
+3 -1
View File
@@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java_version: [11, 17]
java_version: [11, 17, 21]
os: [ubuntu-latest]
steps:
@@ -34,6 +34,8 @@ jobs:
path:
~/.m2
key: build-${{ env.cache-name }}
- name: Maven version
run: mvn --version
- name: Build with Maven
run: mvn package
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-clickhouse</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-clickhouse</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-cockroach</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-db2</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-db2</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-h2</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-hana</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-hana</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-mariadb</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-mariadb</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-mysql</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-mysql</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-nuodb</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-nuodb</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-oracle</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-oracle</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+85
View File
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-postgis</name>
<description>ebean-postgis composite</description>
<artifactId>ebean-postgis</artifactId>
<properties>
<postgis.jdbc.version>2.5.1</postgis.jdbc.version>
<postgres.jdbc.version>42.6.0</postgres.jdbc.version>
</properties>
<dependencies>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-datasource</artifactId>
<version>${ebean-datasource.version}</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-migration</artifactId>
<version>${ebean-migration.version}</version>
</dependency>
<!-- Technically optional but most expected to use query beans -->
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-postgis-types</artifactId>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgres.jdbc.version}</version>
<exclusions>
<!-- exclude unnecessary checker framework -->
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.postgis</groupId>
<artifactId>postgis-jdbc</artifactId>
<version>${postgis.jdbc.version}</version>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,7 @@
package io.ebean.postgis.assembly;
/**
* Nothing interesting here - required placeholder for javadoc.
*/
public class Assembly {
}
@@ -0,0 +1,10 @@
module io.ebean.postgis {
requires transitive io.ebean.api;
requires transitive io.ebean.core;
requires transitive io.ebean.datasource;
requires transitive io.ebean.querybean;
requires transitive io.ebean.platform.postgres;
// requires transitive io.ebean.postgis.types;
}
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-postgres</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-sqlite</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlite</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-sqlserver</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlserver</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+7 -6
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean-yugabyte</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -41,13 +42,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+8 -7
View File
@@ -2,9 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>composites</artifactId>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<relativePath>../..</relativePath>
</parent>
<name>ebean (all platforms)</name>
@@ -16,13 +17,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -40,7 +41,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-jackson-mapper</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -59,13 +60,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-all</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+2 -1
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</parent>
<artifactId>composites</artifactId>
@@ -23,6 +23,7 @@
<module>ebean-nuodb</module>
<module>ebean-oracle</module>
<module>ebean-postgres</module>
<module>ebean-postgis</module>
<!-- <module>sqlanywhere</module>-->
<module>ebean-sqlite</module>
<module>ebean-sqlserver</module>
+7 -14
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</parent>
<name>ebean api</name>
@@ -39,12 +39,12 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-config</artifactId>
<version>3.4</version>
<version>3.9</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>persistence-api</artifactId>
<artifactId>jakarta-persistence-api</artifactId>
<version>${ebean-persistence-api.version}</version>
</dependency>
@@ -90,29 +90,22 @@
<optional>true</optional>
</dependency>
<!-- JAVAX-DEPENDENCY-START -->
<!-- JAVAX-DEPENDENCY-START ___
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<optional>true</optional>
</dependency>
<!-- JAVAX-DEPENDENCY-END -->
<!-- JAKARTA-DEPENDENCY-START ___
____ JAVAX-DEPENDENCY-END -->
<!-- JAKARTA-DEPENDENCY-START -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<optional>true</optional>
</dependency>
____ JAKARTA-DEPENDENCY-END -->
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.1</version>
<scope>test</scope>
</dependency>
<!-- JAKARTA-DEPENDENCY-END -->
</dependencies>
@@ -1,6 +1,6 @@
package io.ebean;
import javax.persistence.PessimisticLockException;
import jakarta.persistence.PessimisticLockException;
/**
* Thrown when failing to acquire a pessimistic lock.
+8 -2
View File
@@ -7,8 +7,8 @@ import io.ebean.cache.ServerCacheManager;
import io.ebean.plugin.Property;
import io.ebean.text.json.JsonContext;
import javax.persistence.OptimisticLockException;
import javax.persistence.PersistenceException;
import jakarta.persistence.OptimisticLockException;
import jakarta.persistence.PersistenceException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -267,15 +267,21 @@ public final class DB {
}
/**
* Deprecated for removal migrate using try-with-resources and commit on the transaction itself.
* <p>
* Commit the current transaction.
*/
@Deprecated(forRemoval = true)
public static void commitTransaction() {
getDefault().commitTransaction();
}
/**
* Deprecated for removal migrate to using try-with-resources and rollback on the transaction itself.
* <p>
* Rollback the current transaction.
*/
@Deprecated(forRemoval = true)
public static void rollbackTransaction() {
getDefault().rollbackTransaction();
}
@@ -0,0 +1,49 @@
package io.ebean;
import io.ebean.service.SpiInTuples;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Default implementation of SpiInTuples.
*/
final class DInTuples implements SpiInTuples {
private final String[] properties;
private final int propertyCount;
private final List<Object[]> entries = new ArrayList<>();
DInTuples(String[] properties) {
this.properties = properties;
this.propertyCount = properties.length;
}
@Override
public InTuples add(Object... values) {
if (values.length != propertyCount) {
throw new IllegalArgumentException("Require " + propertyCount + " values but got " + values.length);
}
entries.add(values);
return this;
}
/**
* Return the first property name.
*/
@Override
public String[] properties() {
return properties;
}
/**
* Return all the value pairs.
*/
@Override
public List<Object[]> entries() {
return Collections.unmodifiableList(entries);
}
}
@@ -1,6 +1,6 @@
package io.ebean;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
/**
* Thrown when a foreign key constraint is enforced.
@@ -11,8 +11,8 @@ import io.ebean.plugin.Property;
import io.ebean.plugin.SpiServer;
import io.ebean.text.json.JsonContext;
import javax.persistence.OptimisticLockException;
import javax.persistence.PersistenceException;
import jakarta.persistence.OptimisticLockException;
import jakarta.persistence.PersistenceException;
import javax.sql.DataSource;
import java.util.Collection;
import java.util.List;
@@ -650,13 +650,19 @@ public interface Database {
void flush();
/**
* Deprecated for removal migrate using try-with-resources and commit on the transaction itself.
* <p>
* Commit the current transaction.
*/
@Deprecated(forRemoval = true)
void commitTransaction();
/**
* Deprecated for removal migrate to using try-with-resources and rollback on the transaction itself.
* <p>
* Rollback the current transaction.
*/
@Deprecated(forRemoval = true)
void rollbackTransaction();
/**
@@ -5,7 +5,7 @@ import io.ebean.config.DatabaseConfig;
import io.ebean.service.SpiContainer;
import io.ebean.service.SpiContainerFactory;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.util.Iterator;
import java.util.Properties;
import java.util.ServiceLoader;
@@ -3,7 +3,7 @@ package io.ebean;
import io.ebean.config.BeanNotEnhancedException;
import io.ebean.datasource.DataSourceConfigurationException;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock;
@@ -38,12 +38,15 @@ final class DbContext {
}
}
} catch (BeanNotEnhancedException e) {
String msg = "Bean is not enhanced? See https://ebean.io/docs/trouble-shooting#not-enhanced";
log.log(ERROR, msg, e);
throw e;
} catch (DataSourceConfigurationException e) {
String msg = "Configuration error creating DataSource for the default Database." +
" This typically means a missing application-test.yaml or missing ebean-test dependency." +
" See https://ebean.io/docs/trouble-shooting#datasource";
log.log(ERROR, msg, e);
throw new DataSourceConfigurationException(msg, e);
} catch (Throwable e) {
@@ -205,4 +205,16 @@ public interface DtoQuery<T> extends CancelableQuery {
* Use the explicit transaction to execute the query.
*/
DtoQuery<T> usingTransaction(Transaction transaction);
/**
* Ensure that the master DataSource is used if there is a read only data source
* being used (that is using a read replica database potentially with replication lag).
* <p>
* When the database is configured with a read-only DataSource via
* say {@link io.ebean.config.DatabaseConfig#setReadOnlyDataSource(DataSource)} then
* by default when a query is run without an active transaction, it uses the read-only data
* source. We we use {@code usingMaster()} to instead ensure that the query is executed
* against the master data source.
*/
DtoQuery<T> usingMaster();
}
@@ -36,6 +36,11 @@ import java.util.Map;
*/
public interface ExpressionFactory {
/**
* Return a new ExpressionList.
*/
<T> ExpressionList<T> expressionList();
/**
* Path exists - for the given path in a JSON document.
*/
@@ -369,6 +374,11 @@ public interface ExpressionFactory {
*/
Expression inPairs(Pairs pairs);
/**
* In expression using multiple columns.
*/
Expression inTuples(InTuples pairs);
/**
* In - property has a value in the array of values.
*/
@@ -4,7 +4,7 @@ import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import io.ebean.search.*;
import javax.persistence.NonUniqueResultException;
import jakarta.persistence.NonUniqueResultException;
import java.sql.Connection;
import java.sql.Timestamp;
import java.util.*;
@@ -56,7 +56,7 @@ public interface ExpressionList<T> {
/**
* Deprecated migrate to {@link #orderBy(String)}
*/
@Deprecated(since = "13.19")
@Deprecated(since = "13.19", forRemoval = true)
default ExpressionList<T> order(String orderByClause) {
return orderBy(orderByClause);
}
@@ -74,7 +74,7 @@ public interface ExpressionList<T> {
/**
* Deprecated migrate to orderBy().
*/
@Deprecated
@Deprecated(forRemoval = true)
default OrderBy<T> order() {
return orderBy();
}
@@ -508,6 +508,8 @@ public interface ExpressionList<T> {
ExpressionList<T> filterMany(String manyProperty);
/**
* Deprecated for removal - migrate to filterManyRaw()
* <p>
* Add filter expressions to the many property.
*
* <pre>{@code
@@ -524,8 +526,29 @@ public interface ExpressionList<T> {
* @param expressions Filter expressions with and, or and ? or ?1 type bind parameters
* @param params Bind parameters used in the expressions
*/
@Deprecated(forRemoval = true)
ExpressionList<T> filterMany(String manyProperty, String expressions, Object... params);
/**
* Add filter expressions for the many path. The expressions can include SQL functions if
* desired and the property names are translated to column names.
* <p>
* The expressions can contain placeholders for bind values using <code>?</code> or <code>?1</code> style.
*
* <pre>{@code
*
* new QCustomer()
* .name.startsWith("Postgres")
* .contacts.filterManyRaw("status = ? and firstName like ?", Contact.Status.NEW, "Rob%")
* .findList();
*
* }</pre>
*
* @param rawExpressions The raw expressions which can include ? and ?1 style bind parameter placeholders
* @param params The parameter values to bind
*/
ExpressionList<T> filterManyRaw(String manyProperty, String rawExpressions, Object... params);
/**
* Specify specific properties to fetch on the main/root bean (aka partial
* object).
@@ -1131,6 +1154,11 @@ public interface ExpressionList<T> {
*/
ExpressionList<T> inPairs(Pairs pairs);
/**
* In expression using multiple columns.
*/
ExpressionList<T> inTuples(InTuples pairs);
/**
* EXISTS a raw SQL SubQuery.
*
@@ -1,6 +1,6 @@
package io.ebean;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.util.List;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -0,0 +1,36 @@
package io.ebean;
/**
* IN expression using multiple columns.
* <p>
* Currently this is not supported with SQLServer or DB2.
* <p>
* Produces SQL expression in the form of (A,B,C) IN ((a0,b0,c0), (a1,b1,c1), ... )
* where A,B,C are the properties in the tuples.
*/
public interface InTuples {
/**
* Create given the properties in the tuples.
*/
static InTuples of(String... properties) {
return new DInTuples(properties);
}
/**
* Create given the properties in the tuples.
*/
static InTuples of(Query.Property<?>... properties) {
String[] props = new String[properties.length];
for (int i = 0; i < properties.length; i++) {
props[i] = properties[i].toString();
}
return new DInTuples(props);
}
/**
* Add a tuple entry. All values must be non-null.
*/
InTuples add(Object... values);
}
@@ -0,0 +1,42 @@
package io.ebean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Helper methods for Lists.
*/
public final class Lists {
private Lists() {
}
/**
* Partition the source List into sub-lists with a maximum size.
* <p>
* The sub-lists will all be the max size except for the last sub-list
* which can potentially be smaller.
*
* @param source The source list
* @param max The max size of each partition
* @param <T> The list element type
* @return List of sub-list partitions
*/
public static <T> List<List<T>> partition(List<T> source, int max) {
final int totalCount = source.size();
if (totalCount == 0) {
return Collections.emptyList();
} else if (totalCount <= max) {
return List.of(source);
}
final int numOfPartitions = (totalCount + max - 1) / max; // round up
final var dest = new ArrayList<List<T>>(numOfPartitions);
for (int i = 0; i < numOfPartitions; i++) {
final int from = i * max;
final int to = Math.min(from + max, totalCount);
dest.add(source.subList(from, to));
}
return dest;
}
}
@@ -333,10 +333,10 @@ public class OrderBy<T> implements Serializable {
sb.append(property);
}
if (!ascending) {
sb.append(" ").append("desc");
sb.append(' ').append("desc");
}
if (nulls != null) {
sb.append(" ").append(nulls).append(" ").append(highLow);
sb.append(' ').append(nulls).append(' ').append(highLow);
}
return sb.toString();
}
@@ -1,6 +1,6 @@
package io.ebean;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
/**
* Captures and wraps IOException's occurring during ElasticSearch processing etc.
+28 -4
View File
@@ -3,13 +3,15 @@ package io.ebean;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
import javax.persistence.NonUniqueResultException;
import jakarta.persistence.NonUniqueResultException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
@@ -670,6 +672,16 @@ public interface Query<T> extends CancelableQuery {
*/
Query<T> apply(FetchPath fetchPath);
/**
* Apply changes to the query conditional on the supplied predicate.
* <p>
* Typically, the changes are extra predicates etc.
*
* @param predicate The predicate which when true the changes are applied
* @param apply The changes to apply to the query
*/
Query<T> alsoIf(BooleanSupplier predicate, Consumer<Query<T>> apply);
/**
* Execute the query using the given transaction.
*/
@@ -685,6 +697,18 @@ public interface Query<T> extends CancelableQuery {
*/
Query<T> usingDatabase(Database database);
/**
* Ensure that the master DataSource is used if there is a read only data source
* being used (that is using a read replica database potentially with replication lag).
* <p>
* When the database is configured with a read-only DataSource via
* say {@link io.ebean.config.DatabaseConfig#setReadOnlyDataSource(DataSource)} then
* by default when a query is run without an active transaction, it uses the read-only data
* source. We we use {@code usingMaster()} to instead ensure that the query is executed
* against the master data source.
*/
Query<T> usingMaster();
/**
* Execute the query returning the list of Id's.
* <p>
@@ -1374,7 +1398,7 @@ public interface Query<T> extends CancelableQuery {
/**
* Deprecated migrate to orderBy().
*/
@Deprecated(since = "13.19")
@Deprecated(since = "13.19", forRemoval = true)
default Query<T> order(String orderByClause) {
return orderBy(orderByClause);
}
@@ -1393,7 +1417,7 @@ public interface Query<T> extends CancelableQuery {
/**
* Deprecated migrate to orderBy().
*/
@Deprecated(since = "13.19")
@Deprecated(since = "13.19", forRemoval = true)
default OrderBy<T> order() {
return orderBy();
}
@@ -1406,7 +1430,7 @@ public interface Query<T> extends CancelableQuery {
/**
* Deprecated migrate to setOrderBy().
*/
@Deprecated(since = "13.19")
@Deprecated(since = "13.19", forRemoval = true)
default Query<T> setOrder(OrderBy<T> orderBy) {
return setOrderBy(orderBy);
}
@@ -1,6 +1,6 @@
package io.ebean;
import javax.persistence.OptimisticLockException;
import jakarta.persistence.OptimisticLockException;
/**
* Thrown at SERIALIZABLE isolation level for non-recoverable concurrent conflict.
@@ -45,6 +45,18 @@ public interface SqlQuery extends Serializable, CancelableQuery {
*/
SqlQuery usingTransaction(Transaction transaction);
/**
* Ensure that the master DataSource is used if there is a read only data source
* being used (that is using a read replica database potentially with replication lag).
* <p>
* When the database is configured with a read-only DataSource via
* say {@link io.ebean.config.DatabaseConfig#setReadOnlyDataSource(DataSource)} then
* by default when a query is run without an active transaction, it uses the read-only data
* source. We we use {@code usingMaster()} to instead ensure that the query is executed
* against the master data source.
*/
SqlQuery usingMaster();
/**
* Execute the query returning a list.
*/
@@ -9,7 +9,6 @@ import java.util.Collection;
* <p>
* This is currently deemed to be experimental and subject to change.
*/
@Deprecated(since = "experimental")
public final class StdOperators {
// ---- Functions ---- //
@@ -77,9 +76,9 @@ public final class StdOperators {
StringBuilder expression = new StringBuilder(50);
expression.append("concat(").append(property.toString());
for (Object value : values) {
expression.append(",").append(sqlConcatString(value));
expression.append(',').append(sqlConcatString(value));
}
expression.append(")");
expression.append(')');
return Property.of(expression.toString());
}
@@ -5,7 +5,7 @@ import io.ebean.annotation.PersistBatch;
import io.ebean.config.DatabaseConfig;
import io.ebean.config.DocStoreConfig;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.sql.Connection;
/**
@@ -4,8 +4,8 @@ import io.ebean.DB;
import io.ebean.Database;
import io.ebean.ValuePair;
import javax.persistence.EntityNotFoundException;
import javax.persistence.PersistenceException;
import jakarta.persistence.EntityNotFoundException;
import jakarta.persistence.PersistenceException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -45,7 +45,7 @@ public final class ToStringBuilder {
id.putIfAbsent(bean, 0);
}
if (counter <= MAX) {
sb.append(bean.getClass().getSimpleName()).append("@").append(counter).append("(");
sb.append(bean.getClass().getSimpleName()).append('@').append(counter).append('(');
}
}
@@ -77,7 +77,7 @@ public final class ToStringBuilder {
*/
public void end() {
if (counter <= MAX) {
sb.append(")");
sb.append(')');
}
}
@@ -90,7 +90,7 @@ public final class ToStringBuilder {
} else {
sb.append(", ");
}
sb.append(name).append(":");
sb.append(name).append(':');
}
private void value(Object value) {
@@ -125,20 +125,20 @@ public final class ToStringBuilder {
sb.append("{}");
} else {
boolean firstElement = true;
sb.append("{");
sb.append('{');
for (Map.Entry<?, ?> entry : map.entrySet()) {
if (firstElement) {
firstElement = false;
} else {
sb.append(", ");
}
sb.append(entry.getKey()).append(":");
sb.append(entry.getKey()).append(':');
value(entry.getValue());
if (counter > MAX) {
return;
}
}
sb.append("}");
sb.append('}');
}
}
@@ -151,7 +151,7 @@ public final class ToStringBuilder {
return;
}
boolean firstElement = true;
sb.append("[");
sb.append('[');
for (Object o : c) {
if (firstElement) {
firstElement = false;
@@ -163,7 +163,7 @@ public final class ToStringBuilder {
return;
}
}
sb.append("]");
sb.append(']');
}
private boolean push(Object bean) {
@@ -178,7 +178,7 @@ public final class ToStringBuilder {
Integer idx = id.putIfAbsent(bean, counter++);
if (idx != null) {
--counter;
sb.append(bean.getClass().getSimpleName()).append("@").append(idx);
sb.append(bean.getClass().getSimpleName()).append('@').append(idx);
return false;
}
first = true;
+1 -1
View File
@@ -69,7 +69,7 @@ public class TenantAwareKey {
public String toString() {
StringBuilder sb = new StringBuilder(key.toString());
if (tenantId != null) {
sb.append(":").append(tenantId);
sb.append(':').append(tenantId);
}
return sb.toString();
}
@@ -119,7 +119,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<>();
}
@@ -136,7 +136,7 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
if (disableLazyLoad) {
set = new LinkedHashSet<>();
} else {
lazyLoadCollection(true);
lazyLoadCollection(false);
}
}
} finally {
@@ -3,9 +3,9 @@ package io.ebean.config;
import io.ebean.config.dbplatform.DatabasePlatform;
import io.ebean.util.AnnotationUtil;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Inheritance;
import javax.persistence.Table;
import jakarta.persistence.DiscriminatorValue;
import jakarta.persistence.Inheritance;
import jakarta.persistence.Table;
import static io.ebean.util.StringHelper.isNull;
@@ -228,7 +228,7 @@ public abstract class AbstractNamingConvention implements NamingConvention {
public TableName getM2MJoinTableName(TableName lhsTable, TableName rhsTable) {
StringBuilder buffer = new StringBuilder();
buffer.append(unQuote(lhsTable.getName()));
buffer.append("_");
buffer.append('_');
String rhsTableName = unQuote(rhsTable.getName());
if (rhsTableName.indexOf('_') < rhsPrefixLength) {
@@ -271,10 +271,10 @@ public abstract class AbstractNamingConvention implements NamingConvention {
public String getTableName(String catalog, String schema, String name) {
StringBuilder sb = new StringBuilder();
if (!isNull(catalog)) {
sb.append(quoteIdentifiers(catalog)).append(".");
sb.append(quoteIdentifiers(catalog)).append('.');
}
if (!isNull(schema)) {
sb.append(quoteIdentifiers(schema)).append(".");
sb.append(quoteIdentifiers(schema)).append('.');
}
return sb.append(quoteIdentifiers(name)).toString();
}
@@ -19,7 +19,7 @@ import io.ebean.event.readaudit.ReadAuditPrepare;
import io.ebean.meta.MetricNamingMatch;
import io.ebean.util.StringHelper;
import javax.persistence.EnumType;
import jakarta.persistence.EnumType;
import javax.sql.DataSource;
import java.time.Clock;
import java.time.ZonedDateTime;
@@ -2376,7 +2376,7 @@ public class DatabaseConfig {
* Sorry if returning Set rather than List breaks code but it feels safer to
* do that than a subtle change to return a shallow copy which you will not detect.
*/
@Deprecated
@Deprecated(forRemoval = true)
public Set<Class<?>> getClasses() {
return classes;
}
@@ -3389,7 +3389,7 @@ public class DatabaseConfig {
/**
* Deprecated - migrate to isLoadModuleInfo().
*/
@Deprecated
@Deprecated(forRemoval = true)
public boolean isAutoLoadModuleInfo() {
return loadModuleInfo;
}
@@ -135,12 +135,12 @@ public class DbConstraintNaming {
*/
protected String joinColumnNames(String[] columns) {
if (columns.length == 1) {
return normaliseColumn(columns[0]);
return normaliseColumn(columns[0]).replace(" ", "_");
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < columns.length; i++) {
if (i > 0) {
sb.append("_");
sb.append('_');
}
sb.append(normaliseColumn(columns[i]));
}
@@ -1,7 +1,7 @@
package io.ebean.config;
/**
* Matches the functionality of javax.persistence.AttributeConverter
* Matches the functionality of jakarta.persistence.AttributeConverter
* <p>
* In general AttributeConverter should be used in preference to this
* ScalarTypeConverter as it is JPA standard and offers the same functionality.
@@ -117,12 +117,12 @@ public final class TableName {
// Add schema
if (schema != null) {
if (buffer.length() > 0) {
buffer.append(".");
buffer.append('.');
}
buffer.append(schema);
}
if (buffer.length() > 0) {
buffer.append(".");
buffer.append('.');
}
return buffer.append(name).toString();
}
@@ -23,11 +23,11 @@ public class BasicSqlLimitOffset implements BasicSqlLimiter {
sb.append(dbSql);
if (maxRows > 0) {
sb.append(" ").append(LIMIT);
sb.append(" ").append(maxRows);
sb.append(' ').append(LIMIT);
sb.append(' ').append(maxRows);
}
if (firstRow > 0) {
sb.append(" ").append(OFFSET).append(" ");
sb.append(' ').append(OFFSET).append(' ');
sb.append(firstRow);
}
return sb.toString();
@@ -9,7 +9,7 @@ import io.ebean.config.CustomDbTypeMapping;
import io.ebean.config.PlatformConfig;
import io.ebean.util.JdbcClose;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import javax.sql.DataSource;
import java.sql.*;
@@ -5,7 +5,7 @@ import io.ebean.BackgroundExecutor;
import io.ebean.Transaction;
import io.ebean.util.JdbcClose;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -3,7 +3,7 @@ package io.ebean.config.dbplatform;
import io.ebean.Transaction;
import io.ebean.util.JdbcClose;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -5,7 +5,7 @@ import io.ebean.DataIntegrityException;
import io.ebean.DuplicateKeyException;
import io.ebean.SerializableConflictException;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.sql.SQLException;
import java.util.Collections;
import java.util.Map;
@@ -1,6 +1,6 @@
package io.ebean.config.dbplatform;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.sql.SQLException;
/**
@@ -1,8 +1,11 @@
package io.ebean.event;
import javax.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextEvent;
/**
* Deprecated for removal - no intention to replace. Create your own copy of this
* ServletContextListener if needed for your application.
* <p>
* Listens for webserver server starting and stopping events.
* <p>
* This should be used when the deployment is into a servlet container where the webapp
@@ -15,7 +18,8 @@ import javax.servlet.ServletContextEvent;
* hook that Ebean registers.
* </p>
*/
public class ServletContextListener implements javax.servlet.ServletContextListener {
@Deprecated(forRemoval = true)
public class ServletContextListener implements jakarta.servlet.ServletContextListener {
/**
* The servlet container is stopping.
@@ -118,28 +118,28 @@ final class MetricsAsJson implements ServerMetricsAsJson {
private void objStart() throws IOException {
objKeyCounter = 0;
writer.append("{");
writer.append('{');
}
private void objEnd() throws IOException {
writer.append("}");
writer.append('}');
}
private void listStart() throws IOException {
listCounter = 0;
writer.append("[");
writer.append('[');
writer.append(newLine);
}
private void listEnd() throws IOException {
writer.append("]");
writer.append(']');
}
private void key(String key) throws IOException {
if (objKeyCounter++ > 0) {
writer.append(", ");
}
writer.append("\"").append(key).append("\":");
writer.append('"').append(key).append("\":");
}
private void val(long count) throws IOException {
@@ -147,12 +147,12 @@ final class MetricsAsJson implements ServerMetricsAsJson {
}
private void val(String val) throws IOException {
writer.append("\"").append(val).append("\"");
writer.append('"').append(val).append('"');
}
private void metricStart(MetaMetric metric) throws IOException {
if (listCounter++ > 0) {
writer.append(",").append(newLine);
writer.append(',').append(newLine);
}
objStart();
key("name");
@@ -187,11 +187,22 @@ final class MetricsAsJson implements ServerMetricsAsJson {
}
if (isIncludeDetail(metric)) {
append("loc", metric.location());
append("sql", metric.sql());
append("sql", escape(metric.sql()));
}
metricEnd();
}
static String escape(String sql) {
return sql == null ? null : sql
.replace("\\", "\\\\")
.replace("\"", "\\\"")
.replace("\b", "\\b")
.replace("\f", "\\f")
.replace("\n", "\\n")
.replace("\r", "\\r")
.replace("\t", "\\t");
}
private boolean isIncludeDetail(MetaTimedMetric metric) {
return includeExtraAttributes == 2 || includeExtraAttributes == 1 && metric.initialCollection();
}
@@ -0,0 +1,22 @@
package io.ebean.service;
import io.ebean.InTuples;
import java.util.List;
/**
* Internal extension to InTuples.
*/
public interface SpiInTuples extends InTuples {
/**
* Return the properties of the tuples.
*/
String[] properties();
/**
* Return all the tuple entries.
*/
List<Object[]> entries();
}
@@ -1,91 +0,0 @@
/* Javadoc style sheet */
/* Define colors, fonts and other style attributes here to override the defaults */
/* Page background color */
body {
background-color: #FFFFFF;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
}
pre.code {
padding: 1em;
margin-left: 2em;
border: 1px solid #ccc;
background-color: #eee;
}
/* Headings */
h1 {
font-size: 14pt
}
#overviewexamples h3 {
font-size: 10pt
}
/* Table colors */
.TableHeadingColor {
background: #CCCCFF
}
/* Dark mauve */
.TableSubHeadingColor {
background: #EEEEFF
}
/* Light mauve */
.TableRowColor {
background: #FFFFFF
}
/* White */
/* Font used in left-hand frame lists */
.FrameTitleFont {
font-size: 12pt;
font-family: Helvetica, Arial, sans-serif
}
.FrameHeadingFont {
font-size: 10pt;
font-family: Helvetica, Arial, sans-serif
}
.FrameItemFont {
font-size: 10pt;
font-family: Helvetica, Arial, sans-serif
}
/* Navigation bar fonts and colors */
.NavBarCell1 {
background-color: #EEEEFF;
}
/* Light mauve */
.NavBarCell1Rev {
background-color: #00008B;
}
/* Dark Blue */
.NavBarFont1 {
font-family: Arial, Helvetica, sans-serif;
color: #000000;
}
.NavBarFont1Rev {
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
}
.NavBarCell2 {
font-family: Arial, Helvetica, sans-serif;
background-color: #FFFFFF;
}
.NavBarCell3 {
font-family: Arial, Helvetica, sans-serif;
background-color: #FFFFFF;
}
@@ -205,7 +205,7 @@ public class PathProperties implements FetchPath {
sb.append(it.next());
hasNext = it.hasNext();
if (hasNext) {
sb.append(",");
sb.append(',');
}
}
return sb.toString();
@@ -25,14 +25,14 @@ public final class CamelCaseHelper {
lastUpper = i;
} else if (Character.isDigit(c)) {
if (i > lastUpper + 1 && !digitsCompressed) {
sb.append("_");
sb.append('_');
lastUpper = i;
}
sb.append(c);
} else if (Character.isUpperCase(c)) {
if (i > lastUpper + 1) {
sb.append("_");
sb.append('_');
}
sb.append(Character.toLowerCase(c));
lastUpper = i;
+2 -2
View File
@@ -12,7 +12,7 @@ module io.ebean.api {
requires transitive java.sql;
requires transitive io.avaje.config;
requires transitive io.avaje.lang;
requires transitive persistence.api;
requires transitive jakarta.persistence.api;
requires transitive io.ebean.annotation;
requires transitive io.ebean.datasource.api;
requires transitive io.avaje.applog;
@@ -21,7 +21,7 @@ module io.ebean.api {
requires static io.ebean.types;
requires static com.fasterxml.jackson.core;
requires static com.fasterxml.jackson.databind;
requires static javax.servlet.api;
requires static jakarta.servlet;
exports io.ebean;
exports io.ebean.bean;
@@ -0,0 +1,82 @@
package io.ebean;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
class ListsTest {
@Test
void partition_empty() {
List<List<Integer>> partitions = Lists.partition(List.of(), 5);
assertThat(partitions).isEmpty();
}
@Test
void partition_lt() {
List<List<Integer>> partitions = Lists.partition(List.of(1, 2, 3, 4), 5);
assertThat(partitions).hasSize(1);
assertThat(partitions.get(0)).hasSize(4);
}
@Test
void partition_eq() {
List<List<Integer>> partitions = Lists.partition(List.of(1, 2, 3, 4, 5), 5);
assertThat(partitions).hasSize(1);
assertThat(partitions.get(0)).hasSize(5);
}
@Test
void partition_gt() {
List<List<Integer>> partitions = Lists.partition(List.of(1, 2, 3, 4, 5, 6), 5);
assertThat(partitions).hasSize(2);
assertThat(partitions.get(0)).hasSize(5);
assertThat(partitions.get(1)).hasSize(1);
assertThat(partitions.get(0)).containsExactly(1, 2, 3, 4, 5);
assertThat(partitions.get(1)).containsExactly(6);
}
@Test
void partition_gt1_letters() {
var partitions = Lists.partition(List.of("a", "b", "c", "d"), 3);
assertThat(partitions).hasSize(2);
assertThat(partitions.get(0)).hasSize(3);
assertThat(partitions.get(1)).hasSize(1);
assertThat(partitions.get(0)).containsExactly("a", "b", "c");
assertThat(partitions.get(1)).containsExactly("d");
}
@Test
void partition_gt1a_letters() {
var partitions = Lists.partition(List.of("a", "b", "c", "d", "e"), 3);
assertThat(partitions).hasSize(2);
assertThat(partitions.get(0)).hasSize(3);
assertThat(partitions.get(1)).hasSize(2);
assertThat(partitions.get(0)).containsExactly("a", "b", "c");
assertThat(partitions.get(1)).containsExactly("d", "e");
}
@Test
void partition_eq2_letters() {
var partitions = Lists.partition(List.of("a", "b", "c", "d", "e", "f"), 3);
assertThat(partitions).hasSize(2);
assertThat(partitions.get(0)).hasSize(3);
assertThat(partitions.get(1)).hasSize(3);
assertThat(partitions.get(0)).containsExactly("a", "b", "c");
assertThat(partitions.get(1)).containsExactly("d", "e", "f");
}
@Test
void partition_gt2_letters() {
var partitions = Lists.partition(List.of("a", "b", "c", "d", "e", "f", "g"), 3);
assertThat(partitions).hasSize(3);
assertThat(partitions.get(0)).hasSize(3);
assertThat(partitions.get(1)).hasSize(3);
assertThat(partitions.get(2)).hasSize(1);
assertThat(partitions.get(0)).containsExactly("a", "b", "c");
assertThat(partitions.get(1)).containsExactly("d", "e", "f");
assertThat(partitions.get(2)).containsExactly("g");
}
}
@@ -0,0 +1,25 @@
package io.ebean.meta;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class MetricsAsJsonTest {
@Test
void trimIt() {
assertThat(MetricsAsJson.escape(null)).isNull();
assertThat(MetricsAsJson.escape("abc")).isEqualTo("abc");
}
@Test
void escape() {
assertThat(MetricsAsJson.escape("a\"bc")).isEqualTo("a\\\"bc");
assertThat(MetricsAsJson.escape("a\tbc")).isEqualTo("a\\tbc");
assertThat(MetricsAsJson.escape("a\bbc")).isEqualTo("a\\bbc");
assertThat(MetricsAsJson.escape("a\bc")).isEqualTo("a\\bc");
assertThat(MetricsAsJson.escape("a\rbc")).isEqualTo("a\\rbc");
assertThat(MetricsAsJson.escape("a\nbc")).isEqualTo("a\\nbc");
assertThat(MetricsAsJson.escape("a\\bc")).isEqualTo("a\\\\bc");
}
}
+37 -34
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</parent>
<name>ebean bom</name>
@@ -20,7 +20,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>persistence-api</artifactId>
<artifactId>jakarta-persistence-api</artifactId>
<version>${ebean-persistence-api.version}</version>
</dependency>
@@ -89,25 +89,25 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -125,13 +125,13 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-jackson-mapper</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-ddl-generator</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -155,46 +155,37 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-querybean</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>querybean-generator</artifactId>
<version>13.20.0</version>
<scope>provided</scope>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>kotlin-querybean-generator</artifactId>
<version>13.20.0</version>
<scope>provided</scope>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.20.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-postgis</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-redis</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-spring-txn</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<!-- platforms -->
@@ -202,67 +193,79 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-clickhouse</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-db2</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-h2</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-hana</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-mariadb</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-mysql</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-nuodb</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-oracle</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-postgres</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-postgis</artifactId>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-postgis-types</artifactId>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-sqlite</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-sqlserver</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
</dependencies>
+3 -10
View File
@@ -4,7 +4,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</parent>
<artifactId>ebean-core-type</artifactId>
@@ -16,7 +16,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -30,17 +30,10 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.4.3</version>
<version>42.6.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
+12 -19
View File
@@ -3,7 +3,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</parent>
<artifactId>ebean-core</artifactId>
@@ -22,7 +22,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-api</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -46,7 +46,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core-type</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
</dependency>
<dependency>
@@ -58,7 +58,7 @@
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.8-1</version>
<version>4.13.1</version>
</dependency>
<!--
@@ -81,15 +81,15 @@
<scope>provided</scope>
</dependency>
<!-- JAVAX-DEPENDENCY-START -->
<!-- JAVAX-DEPENDENCY-START ___
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<version>1.3</version>
<optional>true</optional>
</dependency>
<!-- JAVAX-DEPENDENCY-END -->
<!-- JAKARTA-DEPENDENCY-START ___
____ JAVAX-DEPENDENCY-END -->
<!-- JAKARTA-DEPENDENCY-START -->
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
@@ -102,7 +102,7 @@
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
____ JAKARTA-DEPENDENCY-END -->
<!-- JAKARTA-DEPENDENCY-END -->
<!-- validation annotations Size etc -->
<dependency>
@@ -151,7 +151,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.1</version>
<version>42.6.0</version>
<optional>true</optional>
</dependency>
@@ -159,21 +159,21 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-h2</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-postgres</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-platform-sqlserver</artifactId>
<version>13.20.0</version>
<version>13.23.2-jakarta</version>
<scope>test</scope>
</dependency>
@@ -184,13 +184,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.avaje</groupId>
<artifactId>junit</artifactId>
<version>1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@@ -73,13 +73,13 @@ public final class BindParams implements Serializable {
for (Param param : positionedParameters) {
tempBindCount = param.queryBindCount();
bc += tempBindCount;
builder.append("p").append(bc).append(" ?:").append(tempBindCount).append(",");
builder.append('p').append(bc).append(" ?:").append(tempBindCount).append(',');
}
for (Map.Entry<String, Param> entry : namedParameters.entrySet()) {
tempBindCount = entry.getValue().queryBindCount();
bc += tempBindCount;
builder.append("n").append(bc).append(" k:").append(entry.getKey()).append(" ?:").append(tempBindCount).append(",");
builder.append('n').append(bc).append(" k:").append(entry.getKey()).append(" ?:").append(tempBindCount).append(',');
}
}
@@ -111,7 +111,12 @@ public final class LoadManyRequest extends LoadRequest {
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,7 +3,7 @@ package io.ebeaninternal.api;
import io.ebeaninternal.server.transaction.TransactionScopeManager;
import io.ebeaninternal.server.util.ArrayStack;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
/**
* Manage scoped (typically thread local) transactions.
@@ -1,6 +1,6 @@
package io.ebeaninternal.api;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import io.ebean.CancelableQuery;
@@ -61,9 +61,4 @@ public interface SpiDtoQuery<T> extends DtoQuery<T>, SpiSqlBinding {
*/
SpiQuery<?> ormQuery();
/**
* Return the explicit transaction used to execute the query.
*/
Transaction transaction();
}
@@ -66,6 +66,11 @@ public interface SpiEbeanServer extends SpiServer, ExtendedServer, BeanCollectio
*/
CallOrigin createCallOrigin();
/**
* Override in order to return SpiQuery
*/
<T> SpiQuery<T> createQuery(Class<T> beanType);
/**
* Return the PersistenceContextScope to use defined at query or server level.
*/
@@ -135,8 +140,9 @@ public interface SpiEbeanServer extends SpiServer, ExtendedServer, BeanCollectio
* Create a ServerTransaction for query purposes.
*
* @param tenantId For multi-tenant lazy loading provide the tenantId to use.
* @param useMaster Set to true when the query should use the master data source.
*/
SpiTransaction createReadOnlyTransaction(Object tenantId);
SpiTransaction createReadOnlyTransaction(Object tenantId, boolean useMaster);
/**
* An event from another server in the cluster used to notify local
@@ -147,7 +153,7 @@ public interface SpiEbeanServer extends SpiServer, ExtendedServer, BeanCollectio
/**
* Compile a query.
*/
<T> CQuery<T> compileQuery(Type type, Query<T> query, Transaction transaction);
<T> CQuery<T> compileQuery(Type type, SpiQuery<T> query, Transaction transaction);
/**
* Execute the findId's query but without copying the query.
@@ -156,12 +162,12 @@ public interface SpiEbeanServer extends SpiServer, ExtendedServer, BeanCollectio
* the query has finished (if executing in a background thread).
* </p>
*/
<A, T> List<A> findIdsWithCopy(Query<T> query, Transaction transaction);
<A, T> List<A> findIdsWithCopy(SpiQuery<T> query);
/**
* Execute the findCount query but without copying the query.
*/
<T> int findCountWithCopy(Query<T> query, Transaction transaction);
<T> int findCountWithCopy(SpiQuery<T> query);
/**
* Load a batch of Associated One Beans.
@@ -289,7 +295,7 @@ public interface SpiEbeanServer extends SpiServer, ExtendedServer, BeanCollectio
/**
* Execute the underlying ORM query returning as a JDBC ResultSet to map to DTO beans.
*/
SpiResultSet findResultSet(SpiQuery<?> ormQuery, SpiTransaction transaction);
SpiResultSet findResultSet(SpiQuery<?> ormQuery);
/**
* Visit all the metrics (typically reporting them).
@@ -321,136 +327,57 @@ public interface SpiEbeanServer extends SpiServer, ExtendedServer, BeanCollectio
*/
SpiQueryBindCapture createQueryBindCapture(SpiQueryPlan queryPlan);
<T> boolean exists(SpiQuery<T> ormQuery);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> boolean exists(Query<T> ormQuery, Transaction transaction);
<T> int findCount(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> int findCount(Query<T> query, Transaction transaction);
<A, T> List<A> findIds(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<A, T> List<A> findIds(Query<T> query, Transaction transaction);
<T> QueryIterator<T> findIterate(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> QueryIterator<T> findIterate(Query<T> query, Transaction transaction);
<T> Stream<T> findStream(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> Stream<T> findStream(Query<T> query, Transaction transaction);
<T> void findEach(SpiQuery<T> query, Consumer<T> consumer);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> void findEach(Query<T> query, Consumer<T> consumer, Transaction transaction);
<T> void findEach(SpiQuery<T> query, int batch, Consumer<List<T>> consumer);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> void findEach(Query<T> query, int batch, Consumer<List<T>> consumer, Transaction t);
<T> void findEachWhile(SpiQuery<T> query, Predicate<T> consumer);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> void findEachWhile(Query<T> query, Predicate<T> consumer, Transaction transaction);
<T> List<Version<T>> findVersions(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> List<Version<T>> findVersions(Query<T> query, Transaction transaction);
<T> List<T> findList(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> List<T> findList(Query<T> query, Transaction transaction);
<T> FutureRowCount<T> findFutureCount(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> FutureRowCount<T> findFutureCount(Query<T> query, Transaction transaction);
<T> FutureIds<T> findFutureIds(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> FutureIds<T> findFutureIds(Query<T> query, Transaction transaction);
<T> FutureList<T> findFutureList(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> FutureList<T> findFutureList(Query<T> query, Transaction transaction);
<T> PagedList<T> findPagedList(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> PagedList<T> findPagedList(Query<T> query, Transaction transaction);
<T> Set<T> findSet(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> Set<T> findSet(Query<T> query, Transaction transaction);
<K, T> Map<K, T> findMap(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<K, T> Map<K, T> findMap(Query<T> query, Transaction transaction);
<A, T> List<A> findSingleAttributeList(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<A, T> List<A> findSingleAttributeList(Query<T> query, Transaction transaction);
<A, T> Set<A> findSingleAttributeSet(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<A, T> Set<A> findSingleAttributeSet(Query<T> query, Transaction transaction);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
@Nullable
<T> T findOne(Query<T> query, Transaction transaction);
<T> T findOne(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> Optional<T> findOneOrEmpty(Query<T> query, Transaction transaction);
<T> Optional<T> findOneOrEmpty(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> int delete(Query<T> query, Transaction transaction);
<T> int delete(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
<T> int update(Query<T> query, Transaction transaction);
<T> int update(SpiQuery<T> query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
List<SqlRow> findList(SqlQuery query, Transaction transaction);
List<SqlRow> findList(SpiSqlQuery query);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
void findEach(SqlQuery query, Consumer<SqlRow> consumer, Transaction transaction);
void findEach(SpiSqlQuery query, Consumer<SqlRow> consumer);
/**
* Deprecated migrate to using {@link Query#usingTransaction(Transaction)}.
*/
void findEachWhile(SqlQuery query, Predicate<SqlRow> consumer, Transaction transaction);
void findEachWhile(SpiSqlQuery query, Predicate<SqlRow> consumer);
/**
* Deprecated migrate to using {@link SqlQuery#usingTransaction(Transaction)}.
*/
@Nullable
SqlRow findOne(SqlQuery query, Transaction transaction);
SqlRow findOne(SpiSqlQuery query);
}
@@ -36,6 +36,11 @@ public interface SpiExpressionRequest {
*/
SpiExpressionRequest append(String expression);
/**
* Append to the expression sql without any parsing.
*/
SpiExpressionRequest append(char c);
/**
* Append to the expression sql with logical property parsing to db columns with logical path prefix.
* <p>
@@ -235,6 +235,16 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
*/
String planLabel();
/**
* Return the transaction explicitly assigned or null.
*/
SpiTransaction transaction();
/**
* Return true if this query should not use the read only data source.
*/
boolean isUseMaster();
/**
* Return true if this is a "find by id" query. This includes a check for a single "equal to" expression for the Id.
*/
@@ -867,17 +877,6 @@ public interface SpiQuery<T> extends Query<T>, SpiQueryFetch, TxnProfileEventCod
*/
boolean isDisableReadAudit();
/**
* Return true if this is a query executing in the background.
*/
boolean isFutureFetch();
/**
* Set to true to indicate the query is executing in a background thread
* asynchronously.
*/
void setFutureFetch(boolean futureFetch);
/**
* Set the readEvent for future queries (as prepared in foreground thread).
*/
@@ -1,10 +1,23 @@
package io.ebeaninternal.api;
import io.avaje.lang.Nullable;
/**
* SQL query binding (for SqlQuery and DtoQuery).
*/
public interface SpiSqlBinding extends SpiCancelableQuery {
/**
* Return the transaction explicitly associated to the query.
*/
@Nullable
SpiTransaction transaction();
/**
* Return true if this query should not use the read only data source.
*/
boolean isUseMaster();
/**
* Return the named or positioned parameters.
*/
@@ -1,17 +1,10 @@
package io.ebeaninternal.api;
import io.avaje.lang.Nullable;
import io.ebean.SqlQuery;
import io.ebean.Transaction;
/**
* SQL query - Internal extension to SqlQuery.
*/
public interface SpiSqlQuery extends SqlQuery, SpiSqlBinding {
/**
* Return the transaction explicitly associated to the query.
*/
@Nullable
Transaction transaction();
}
@@ -11,7 +11,7 @@ import io.ebeaninternal.server.persist.BatchControl;
import io.ebeaninternal.server.transaction.ProfileStream;
import io.ebeanservice.docstore.api.DocStoreTransaction;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.sql.Connection;
import java.sql.SQLException;
@@ -11,7 +11,7 @@ import io.ebeaninternal.server.persist.BatchControl;
import io.ebeaninternal.server.transaction.ProfileStream;
import io.ebeanservice.docstore.api.DocStoreTransaction;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.sql.Connection;
import java.sql.SQLException;
@@ -33,10 +33,10 @@ public abstract class AbstractSqlQueryRequest implements CancelableQuery {
/**
* Create the BeanFindRequest.
*/
AbstractSqlQueryRequest(SpiEbeanServer server, SpiSqlBinding query, Transaction t) {
AbstractSqlQueryRequest(SpiEbeanServer server, SpiSqlBinding query) {
this.server = server;
this.query = query;
this.transaction = (SpiTransaction) t;
this.transaction = query.transaction();
this.query.setCancelableQuery(this);
}
@@ -48,7 +48,7 @@ public abstract class AbstractSqlQueryRequest implements CancelableQuery {
transaction = server.currentServerTransaction();
if (transaction == null || !transaction.isActive()) {
// create a local readOnly transaction
transaction = server.createReadOnlyTransaction(null);
transaction = server.createReadOnlyTransaction(null, query.isUseMaster());
createdTransaction = true;
}
}
@@ -48,7 +48,7 @@ public abstract class BeanRequest {
*/
public void commitTransIfRequired() {
if (createdTransaction) {
server.commitTransaction();
transaction.commit();
}
}
@@ -7,7 +7,7 @@ import io.ebean.util.IOUtils;
import io.ebeaninternal.api.SpiEbeanServer;
import io.ebeaninternal.util.UrlHelper;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.io.*;
import java.net.URL;
import java.nio.file.Path;
@@ -6,7 +6,7 @@ import io.ebean.config.dbplatform.DatabasePlatformProvider;
import io.ebeaninternal.api.CoreLog;
import io.ebeaninternal.api.DbOffline;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
@@ -13,7 +13,7 @@ import io.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
import io.ebeaninternal.server.deploy.BeanPropertyAssocMany;
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
import javax.persistence.EntityNotFoundException;
import jakarta.persistence.EntityNotFoundException;
import java.util.List;
import static java.lang.System.Logger.Level.DEBUG;
@@ -87,7 +87,7 @@ final class DefaultBeanLoader {
query.setLoadDescription("+lazy", null);
}
query.select(parentDesc.idBinder().getIdProperty());
query.select(parentDesc.idBinder().idSelect());
if (onlyIds) {
query.fetch(many.name(), many.targetIdProperty());
} else {
@@ -106,7 +106,7 @@ final class DefaultBeanLoader {
query.setReadOnly(true);
}
server.findOne(query, null);
server.findOne(query);
if (beanCollection != null) {
if (beanCollection.checkEmptyLazyLoad()) {
if (log.isLoggable(DEBUG)) {
@@ -127,6 +127,7 @@ final class DefaultBeanLoader {
throw new RuntimeException("Nothing in batch?");
}
final SpiQuery<?> query = server.createQuery(loadRequest.beanType());
query.usingTransaction(loadRequest.transaction());
loadRequest.configureQuery(query);
loadRequest.postLoad(executeQuery(loadRequest, query));
}
@@ -137,14 +138,15 @@ final class DefaultBeanLoader {
private List<?> executeQuery(LoadRequest loadRequest, SpiQuery<?> query) {
if (onIterateUseExtraTxn && loadRequest.isParentFindIterate()) {
// MySql - we need a different transaction to execute the secondary query
SpiTransaction extraTxn = server.createReadOnlyTransaction(query.tenantId());
SpiTransaction extraTxn = server.createReadOnlyTransaction(query.tenantId(), query.isUseMaster());
try {
return server.findList(query, extraTxn);
query.usingTransaction(extraTxn);
return server.findList(query);
} finally {
extraTxn.end();
}
} else {
return server.findList(query, loadRequest.transaction());
return server.findList(query);
}
}
@@ -13,7 +13,7 @@ import io.ebeaninternal.server.core.bootup.BootupClassPathSearch;
import io.ebeaninternal.server.core.bootup.BootupClasses;
import io.ebeaninternal.server.executor.DefaultBackgroundExecutor;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.net.URL;
import java.sql.Connection;
import java.sql.SQLException;
@@ -45,10 +45,10 @@ import io.ebeaninternal.util.ParamTypeHelper;
import io.ebeaninternal.util.ParamTypeHelper.TypeInfo;
import io.ebeanservice.docstore.api.DocStoreIntegration;
import javax.persistence.EntityNotFoundException;
import javax.persistence.NonUniqueResultException;
import javax.persistence.OptimisticLockException;
import javax.persistence.PersistenceException;
import jakarta.persistence.EntityNotFoundException;
import jakarta.persistence.NonUniqueResultException;
import jakarta.persistence.OptimisticLockException;
import jakarta.persistence.PersistenceException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
@@ -440,8 +440,9 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
* Compile a query. Only valid for ORM queries.
*/
@Override
public <T> CQuery<T> compileQuery(Type type, Query<T> query, Transaction transaction) {
SpiOrmQueryRequest<T> qr = createQueryRequest(type, query, transaction);
public <T> CQuery<T> compileQuery(Type type, SpiQuery<T> query, Transaction transaction) {
query.usingTransaction(transaction);
SpiOrmQueryRequest<T> qr = createQueryRequest(type, query);
OrmQueryRequest<T> orm = (OrmQueryRequest<T>) qr;
return cqueryEngine.buildQuery(orm);
}
@@ -903,8 +904,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public SpiResultSet findResultSet(SpiQuery<?> ormQuery, SpiTransaction transaction) {
SpiOrmQueryRequest<?> request = createQueryRequest(ormQuery.type(), ormQuery, transaction);
public SpiResultSet findResultSet(SpiQuery<?> ormQuery) {
SpiOrmQueryRequest<?> request = createQueryRequest(ormQuery.type(), ormQuery);
request.initTransIfRequired();
return request.findResultSet();
}
@@ -935,24 +936,26 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
public <T> T find(Class<T> beanType, Object id, @Nullable Transaction transaction) {
Objects.requireNonNull(id);
Query<T> query = createQuery(beanType).setId(id);
return findId(query, transaction);
SpiQuery<T> query = createQuery(beanType);
query.usingTransaction(transaction);
query.setId(id);
return findId(query);
}
<T> SpiOrmQueryRequest<T> createQueryRequest(Type type, Query<T> query, @Nullable Transaction transaction) {
SpiOrmQueryRequest<T> request = buildQueryRequest(type, query, transaction);
<T> SpiOrmQueryRequest<T> createQueryRequest(Type type, SpiQuery<T> query) {
SpiOrmQueryRequest<T> request = buildQueryRequest(type, query);
request.prepareQuery();
return request;
}
<T> SpiOrmQueryRequest<T> buildQueryRequest(Type type, Query<T> query, @Nullable Transaction transaction) {
SpiQuery<T> spiQuery = (SpiQuery<T>) query;
spiQuery.setType(type);
spiQuery.checkNamedParameters();
return buildQueryRequest(spiQuery, transaction);
<T> SpiOrmQueryRequest<T> buildQueryRequest(Type type, SpiQuery<T> query) {
query.setType(type);
query.checkNamedParameters();
return buildQueryRequest(query);
}
private <T> SpiOrmQueryRequest<T> buildQueryRequest(SpiQuery<T> query, @Nullable Transaction transaction) {
private <T> SpiOrmQueryRequest<T> buildQueryRequest(SpiQuery<T> query) {
SpiTransaction transaction = query.transaction();
if (transaction == null) {
transaction = currentServerTransaction();
}
@@ -973,7 +976,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
if (query.parentNode() == null) {
query.setOrigin(createCallOrigin());
}
return new OrmQueryRequest<>(this, queryEngine, query, (SpiTransaction) transaction);
return new OrmQueryRequest<>(this, queryEngine, query, transaction);
}
/**
@@ -981,8 +984,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
*/
@Nullable
@SuppressWarnings("unchecked")
private <T> T findIdCheckPersistenceContextAndCache(@Nullable Transaction transaction, SpiQuery<T> query, Object id) {
SpiTransaction t = (SpiTransaction) transaction;
private <T> T findIdCheckPersistenceContextAndCache(SpiQuery<T> query, Object id) {
SpiTransaction t = query.transaction();
if (t == null) {
t = currentServerTransaction();
}
@@ -1028,18 +1031,17 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Nullable
@SuppressWarnings("unchecked")
private <T> T findId(Query<T> query, @Nullable Transaction transaction) {
SpiQuery<T> spiQuery = (SpiQuery<T>) query;
spiQuery.setType(Type.BEAN);
if (SpiQuery.Mode.NORMAL == spiQuery.mode() && !spiQuery.isForceHitDatabase()) {
private <T> T findId(SpiQuery<T> query) {
query.setType(Type.BEAN);
if (SpiQuery.Mode.NORMAL == query.mode() && !query.isForceHitDatabase()) {
// See if we can skip doing the fetch completely by getting the bean from the
// persistence context or the bean cache
T bean = findIdCheckPersistenceContextAndCache(transaction, spiQuery, spiQuery.getId());
T bean = findIdCheckPersistenceContextAndCache(query, query.getId());
if (bean != null) {
return bean;
}
}
SpiOrmQueryRequest<T> request = buildQueryRequest(spiQuery, transaction);
SpiOrmQueryRequest<T> request = buildQueryRequest(query);
request.prepareQuery();
if (request.isUseDocStore()) {
return docStore().find(request);
@@ -1053,23 +1055,19 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> Optional<T> findOneOrEmpty(Query<T> query, Transaction transaction) {
return Optional.ofNullable(findOne(query, transaction));
public <T> Optional<T> findOneOrEmpty(SpiQuery<T> query) {
return Optional.ofNullable(findOne(query));
}
@Nullable
@Override
public <T> T findOne(Query<T> query, @Nullable Transaction transaction) {
SpiQuery<T> spiQuery = (SpiQuery<T>) query;
if (spiQuery.isFindById()) {
public <T> T findOne(SpiQuery<T> query) {
if (query.isFindById()) {
// actually a find by Id query
return findId(query, transaction);
}
if (transaction == null) {
transaction = currentServerTransaction();
return findId(query);
}
// a query that is expected to return either 0 or 1 beans
List<T> list = findList(query, transaction, true);
List<T> list = findList(query, true);
return extractUnique(list);
}
@@ -1086,10 +1084,10 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public <T> Set<T> findSet(Query<T> query, Transaction transaction) {
SpiOrmQueryRequest request = buildQueryRequest(Type.SET, query, transaction);
public <T> Set<T> findSet(SpiQuery<T> query) {
SpiOrmQueryRequest request = buildQueryRequest(Type.SET, query);
request.resetBeanCacheAutoMode(false);
if ((transaction == null || !transaction.isSkipCache()) && request.getFromBeanCache()) {
if (request.isGetAllFromBeanCache()) {
// hit bean cache and got all results from cache
return request.beanCacheHitsAsSet();
}
@@ -1108,10 +1106,10 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public <K, T> Map<K, T> findMap(Query<T> query, @Nullable Transaction transaction) {
SpiOrmQueryRequest request = buildQueryRequest(Type.MAP, query, transaction);
public <K, T> Map<K, T> findMap(SpiQuery<T> query) {
SpiOrmQueryRequest request = buildQueryRequest(Type.MAP, query);
request.resetBeanCacheAutoMode(false);
if ((transaction == null || !transaction.isSkipCache()) && request.getFromBeanCache()) {
if (request.isGetAllFromBeanCache()) {
// hit bean cache and got all results from cache
return request.beanCacheHitsAsMap();
}
@@ -1130,8 +1128,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
@SuppressWarnings("unchecked")
public <A, T> List<A> findSingleAttributeList(Query<T> query, Transaction transaction) {
SpiOrmQueryRequest<T> request = buildQueryRequest(Type.ATTRIBUTE, query, transaction);
public <A, T> List<A> findSingleAttributeList(SpiQuery<T> query) {
SpiOrmQueryRequest<T> request = buildQueryRequest(Type.ATTRIBUTE, query);
request.query().setSingleAttribute();
request.prepareQuery();
Object result = request.getFromQueryCache();
@@ -1148,8 +1146,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
@SuppressWarnings("unchecked")
public <A, T> Set<A> findSingleAttributeSet(Query<T> query, Transaction transaction) {
SpiOrmQueryRequest<T> request = buildQueryRequest(Type.ATTRIBUTE_SET, query, transaction);
public <A, T> Set<A> findSingleAttributeSet(SpiQuery<T> query) {
SpiOrmQueryRequest<T> request = buildQueryRequest(Type.ATTRIBUTE_SET, query);
request.query().setSingleAttribute();
request.prepareQuery();
Object result = request.getFromQueryCache();
@@ -1165,17 +1163,16 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> int findCount(Query<T> query, @Nullable Transaction transaction) {
SpiQuery<T> spiQuery = ((SpiQuery<T>) query);
if (!spiQuery.isDistinct()) {
spiQuery = spiQuery.copy();
public <T> int findCount(SpiQuery<T> query) {
if (!query.isDistinct()) {
query = query.copy();
}
return findCountWithCopy(spiQuery, transaction);
return findCountWithCopy(query);
}
@Override
public <T> int findCountWithCopy(Query<T> query, @Nullable Transaction transaction) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.COUNT, query, transaction);
public <T> int findCountWithCopy(SpiQuery<T> query) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.COUNT, query);
Integer result = request.getFromQueryCache();
if (result != null) {
return result;
@@ -1190,13 +1187,17 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
public boolean exists(Class<?> beanType, Object beanId, Transaction transaction) {
return !findIdsWithCopy(find(beanType).setId(beanId), transaction).isEmpty();
final DefaultOrmQuery<?> query = createQuery(beanType);
query.usingTransaction(transaction);
query.setId(beanId);
return !findIdsWithCopy(query).isEmpty();
}
@Override
public <T> boolean exists(Query<T> ormQuery, Transaction transaction) {
Query<T> ormQueryCopy = ormQuery.copy().setMaxRows(1);
SpiOrmQueryRequest<?> request = createQueryRequest(Type.EXISTS, ormQueryCopy, transaction);
public <T> boolean exists(SpiQuery<T> ormQuery) {
SpiQuery<T> ormQueryCopy = ormQuery.copy();
ormQueryCopy.setMaxRows(1);
SpiOrmQueryRequest<?> request = createQueryRequest(Type.EXISTS, ormQueryCopy);
List<Object> ids = request.getFromQueryCache();
if (ids != null) {
return !ids.isEmpty();
@@ -1210,14 +1211,14 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <A, T> List<A> findIds(Query<T> query, Transaction transaction) {
return findIdsWithCopy(((SpiQuery<T>) query).copy(), transaction);
public <A, T> List<A> findIds(SpiQuery<T> query) {
return findIdsWithCopy(query.copy());
}
@SuppressWarnings("unchecked")
@Override
public <A, T> List<A> findIdsWithCopy(Query<T> query, Transaction transaction) {
SpiOrmQueryRequest<?> request = createQueryRequest(Type.ID_LIST, query, transaction);
public <A, T> List<A> findIdsWithCopy(SpiQuery<T> query) {
SpiOrmQueryRequest<?> request = createQueryRequest(Type.ID_LIST, query);
Object result = request.getFromQueryCache();
if (result != null) {
if (Boolean.FALSE.equals(request.query().isReadOnly())) {
@@ -1235,8 +1236,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> int delete(Query<T> query, Transaction transaction) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.DELETE, query, transaction);
public <T> int delete(SpiQuery<T> query) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.DELETE, query);
try {
request.initTransIfRequired();
request.markNotQueryOnly();
@@ -1258,8 +1259,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> int update(Query<T> query, Transaction transaction) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.UPDATE, query, transaction);
public <T> int update(SpiQuery<T> query) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.UPDATE, query);
try {
request.initTransIfRequired();
request.markNotQueryOnly();
@@ -1270,29 +1271,44 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> FutureRowCount<T> findFutureCount(Query<T> query, Transaction transaction) {
SpiQuery<T> copy = ((SpiQuery<T>) query).copy();
copy.setFutureFetch(true);
Transaction newTxn = createTransaction();
QueryFutureRowCount<T> queryFuture = new QueryFutureRowCount<>(new CallableQueryCount<>(this, copy, newTxn));
public <T> FutureRowCount<T> findFutureCount(SpiQuery<T> query) {
SpiQuery<T> copy = query.copy();
boolean createdTransaction = false;
SpiTransaction transaction = query.transaction();
if (transaction == null) {
transaction = currentServerTransaction();
if (transaction == null) {
transaction = (SpiTransaction) createTransaction();
createdTransaction = true;
}
copy.usingTransaction(transaction);
}
var queryFuture = new QueryFutureRowCount<>(new CallableQueryCount<>(this, copy, createdTransaction));
backgroundExecutor.execute(queryFuture.futureTask());
return queryFuture;
}
@Override
public <T> FutureIds<T> findFutureIds(Query<T> query, Transaction transaction) {
SpiQuery<T> copy = ((SpiQuery<T>) query).copy();
copy.setFutureFetch(true);
Transaction newTxn = createTransaction();
QueryFutureIds<T> queryFuture = new QueryFutureIds<>(new CallableQueryIds<>(this, copy, newTxn));
public <T> FutureIds<T> findFutureIds(SpiQuery<T> query) {
SpiQuery<T> copy = query.copy();
boolean createdTransaction = false;
SpiTransaction transaction = query.transaction();
if (transaction == null) {
transaction = currentServerTransaction();
if (transaction == null) {
transaction = (SpiTransaction) createTransaction();
createdTransaction = true;
}
copy.usingTransaction(transaction);
}
QueryFutureIds<T> queryFuture = new QueryFutureIds<>(new CallableQueryIds<>(this, copy, createdTransaction));
backgroundExecutor.execute(queryFuture.futureTask());
return queryFuture;
}
@Override
public <T> FutureList<T> findFutureList(Query<T> query, Transaction transaction) {
SpiQuery<T> spiQuery = (SpiQuery<T>) query.copy();
spiQuery.setFutureFetch(true);
public <T> FutureList<T> findFutureList(SpiQuery<T> query) {
SpiQuery<T> spiQuery = query.copy();
// FutureList query always run in it's own persistence content
spiQuery.setPersistenceContext(new DefaultPersistenceContext());
if (!spiQuery.isDisableReadAudit()) {
@@ -1300,28 +1316,36 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
desc.readAuditFutureList(spiQuery);
}
// Create a new transaction solely to execute the findList() at some future time
Transaction newTxn = createTransaction();
QueryFutureList<T> queryFuture = new QueryFutureList<>(new CallableQueryList<>(this, spiQuery, newTxn));
boolean createdTransaction = false;
SpiTransaction transaction = query.transaction();
if (transaction == null) {
transaction = currentServerTransaction();
if (transaction == null) {
transaction = (SpiTransaction) createTransaction();
createdTransaction = true;
}
spiQuery.usingTransaction(transaction);
}
QueryFutureList<T> queryFuture = new QueryFutureList<>(new CallableQueryList<>(this, spiQuery, createdTransaction));
backgroundExecutor.execute(queryFuture.futureTask());
return queryFuture;
}
@Override
public <T> PagedList<T> findPagedList(Query<T> query, Transaction transaction) {
SpiQuery<T> spiQuery = (SpiQuery<T>) query;
int maxRows = spiQuery.getMaxRows();
public <T> PagedList<T> findPagedList(SpiQuery<T> query) {
int maxRows = query.getMaxRows();
if (maxRows == 0) {
throw new PersistenceException("maxRows must be specified for findPagedList() query");
}
if (spiQuery.isUseDocStore()) {
return docStore().findPagedList(createQueryRequest(Type.LIST, query, transaction));
if (query.isUseDocStore()) {
return docStore().findPagedList(createQueryRequest(Type.LIST, query));
}
return new LimitOffsetPagedList<>(this, spiQuery);
return new LimitOffsetPagedList<>(this, query);
}
@Override
public <T> QueryIterator<T> findIterate(Query<T> query, Transaction transaction) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.ITERATE, query, transaction);
public <T> QueryIterator<T> findIterate(SpiQuery<T> query) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.ITERATE, query);
try {
request.initTransIfRequired();
return request.findIterate();
@@ -1332,8 +1356,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> Stream<T> findStream(Query<T> query, Transaction transaction) {
return toStream(findIterate(query, transaction));
public <T> Stream<T> findStream(SpiQuery<T> query) {
return toStream(findIterate(query));
}
private <T> Stream<T> toStream(QueryIterator<T> queryIterator) {
@@ -1341,8 +1365,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> void findEach(Query<T> query, Consumer<T> consumer, Transaction transaction) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.ITERATE, query, transaction);
public <T> void findEach(SpiQuery<T> query, Consumer<T> consumer) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.ITERATE, query);
if (request.isUseDocStore()) {
docStore().findEach(request, consumer);
return;
@@ -1353,8 +1377,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> void findEach(Query<T> query, int batch, Consumer<List<T>> consumer, Transaction transaction) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.ITERATE, query, transaction);
public <T> void findEach(SpiQuery<T> query, int batch, Consumer<List<T>> consumer) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.ITERATE, query);
// if (request.isUseDocStore()) {
// docStore().findEach(request, consumer);
// return;
@@ -1365,8 +1389,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> void findEachWhile(Query<T> query, Predicate<T> consumer, Transaction transaction) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.ITERATE, query, transaction);
public <T> void findEachWhile(SpiQuery<T> query, Predicate<T> consumer) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.ITERATE, query);
if (request.isUseDocStore()) {
docStore().findEachWhile(request, consumer);
return;
@@ -1377,8 +1401,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> List<Version<T>> findVersions(Query<T> query, @Nullable Transaction transaction) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.LIST, query, transaction);
public <T> List<Version<T>> findVersions(SpiQuery<T> query) {
SpiOrmQueryRequest<T> request = createQueryRequest(Type.LIST, query);
try {
request.initTransIfRequired();
return request.findVersions();
@@ -1388,15 +1412,15 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public <T> List<T> findList(Query<T> query, Transaction transaction) {
return findList(query, transaction, false);
public <T> List<T> findList(SpiQuery<T> query) {
return findList(query, false);
}
@SuppressWarnings("unchecked")
private <T> List<T> findList(Query<T> query, @Nullable Transaction transaction, boolean findOne) {
SpiOrmQueryRequest<T> request = buildQueryRequest(Type.LIST, query, transaction);
private <T> List<T> findList(SpiQuery<T> query, boolean findOne) {
SpiOrmQueryRequest<T> request = buildQueryRequest(Type.LIST, query);
request.resetBeanCacheAutoMode(findOne);
if ((transaction == null || !transaction.isSkipCache()) && request.getFromBeanCache()) {
if (request.isGetAllFromBeanCache()) {
// hit bean cache and got all results from cache
return request.beanCacheHits();
}
@@ -1418,16 +1442,16 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Nullable
@Override
public SqlRow findOne(SqlQuery query, Transaction transaction) {
public SqlRow findOne(SpiSqlQuery query) {
// no findId() method for SqlQuery...
// a query that is expected to return either 0 or 1 rows
List<SqlRow> list = findList(query, transaction);
List<SqlRow> list = findList(query);
return extractUnique(list);
}
@Override
public void findEach(SqlQuery query, Consumer<SqlRow> consumer, Transaction transaction) {
RelationalQueryRequest request = new RelationalQueryRequest(this, relationalQueryEngine, query, transaction);
public void findEach(SpiSqlQuery query, Consumer<SqlRow> consumer) {
RelationalQueryRequest request = new RelationalQueryRequest(this, relationalQueryEngine, query);
try {
request.initTransIfRequired();
request.findEach(consumer);
@@ -1437,8 +1461,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public void findEachWhile(SqlQuery query, Predicate<SqlRow> consumer, Transaction transaction) {
RelationalQueryRequest request = new RelationalQueryRequest(this, relationalQueryEngine, query, transaction);
public void findEachWhile(SpiSqlQuery query, Predicate<SqlRow> consumer) {
RelationalQueryRequest request = new RelationalQueryRequest(this, relationalQueryEngine, query);
try {
request.initTransIfRequired();
request.findEachWhile(consumer);
@@ -1448,8 +1472,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public List<SqlRow> findList(SqlQuery query, Transaction transaction) {
RelationalQueryRequest request = new RelationalQueryRequest(this, relationalQueryEngine, query, transaction);
public List<SqlRow> findList(SpiSqlQuery query) {
RelationalQueryRequest request = new RelationalQueryRequest(this, relationalQueryEngine, query);
try {
request.initTransIfRequired();
return request.findList();
@@ -1459,7 +1483,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
private <P> P executeSqlQuery(Function<RelationalQueryRequest, P> fun, SpiSqlQuery query) {
RelationalQueryRequest request = new RelationalQueryRequest(this, relationalQueryEngine, query, query.transaction());
RelationalQueryRequest request = new RelationalQueryRequest(this, relationalQueryEngine, query);
try {
request.initTransIfRequired();
return fun.apply(request);
@@ -2123,8 +2147,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
@Override
public SpiTransaction createReadOnlyTransaction(Object tenantId) {
return transactionManager.createReadOnlyTransaction(tenantId);
public SpiTransaction createReadOnlyTransaction(Object tenantId, boolean useMaster) {
return transactionManager.createReadOnlyTransaction(tenantId, useMaster);
}
/**
@@ -2179,9 +2203,10 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
Object id = idProperty.getValue(entityBean);
if (entityBean._ebean_getIntercept().isNew() && id != null) {
// Primary Key is changeable only on new models - so skip check if we are not new
Query<?> query = new DefaultOrmQuery<>(beanDesc, this, expressionFactory);
SpiQuery<?> query = new DefaultOrmQuery<>(beanDesc, this, expressionFactory);
query.usingTransaction(transaction);
query.setId(id);
if (findCount(query, transaction) > 0) {
if (findCount(query) > 0) {
return Collections.singleton(idProperty);
}
}
@@ -2200,7 +2225,8 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Nullable
private Set<Property> checkUniqueness(EntityBean entityBean, BeanDescriptor<?> beanDesc, BeanProperty[] props, @Nullable Transaction transaction) {
BeanProperty idProperty = beanDesc.idProperty();
Query<?> query = new DefaultOrmQuery<>(beanDesc, this, expressionFactory);
SpiQuery<?> query = new DefaultOrmQuery<>(beanDesc, this, expressionFactory);
query.usingTransaction(transaction);
ExpressionList<?> exprList = query.where();
if (!entityBean._ebean_getIntercept().isNew()) {
// if model is not new, exclude ourself.
@@ -2213,7 +2239,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
exprList.eq(prop.name(), value);
}
if (findCount(query, transaction) > 0) {
if (findCount(query) > 0) {
Set<Property> ret = new LinkedHashSet<>();
Collections.addAll(ret, props);
return ret;
@@ -281,9 +281,9 @@ public final class DefaultSqlUpdate implements Serializable, SpiSqlUpdate {
int offset = 0;
for (Object val : values) {
if (offset > 0) {
sqlExpand.append(",");
sqlExpand.append(',');
}
sqlExpand.append("?");
sqlExpand.append('?');
bindParams.setParameter(position + offset++, val);
}
bindExpansion += (offset - 1);
@@ -33,7 +33,7 @@ public final class DtoQueryRequest<T> extends AbstractSqlQueryRequest {
private DataReader dataReader;
DtoQueryRequest(SpiEbeanServer server, DtoQueryEngine engine, SpiDtoQuery<T> query) {
super(server, query, query.transaction());
super(server, query);
this.queryEngine = engine;
this.query = query;
query.obtainLocation();
@@ -52,7 +52,8 @@ public final class DtoQueryRequest<T> extends AbstractSqlQueryRequest {
query.setCancelableQuery(ormQuery);
// execute the underlying ORM query returning the ResultSet
SpiResultSet result = server.findResultSet(ormQuery, transaction);
ormQuery.usingTransaction(transaction);
SpiResultSet result = server.findResultSet(ormQuery);
this.pstmt = result.statement();
this.sql = ormQuery.getGeneratedSql();
setResultSet(result.resultSet(), ormQuery.queryPlanKey());
@@ -121,7 +121,7 @@ final class DumpMetrics {
}
private void appendQueryName(MetaQueryMetric metric, StringBuilder sb) {
sb.append("query:").append(padName(metric.name())).append(" ");
sb.append("query:").append(padName(metric.name())).append(' ');
}
private void appendProfileAndSql(MetaQueryMetric metric, StringBuilder sb) {
@@ -136,7 +136,7 @@ final class DumpMetrics {
private void log(MetaTimedMetric metric) {
StringBuilder sb = new StringBuilder();
sb.append(padNameTimed(metric.name())).append(" ");
sb.append(padNameTimed(metric.name())).append(' ');
appendCounters(metric, sb);
out(sb.toString());
}
@@ -7,7 +7,7 @@ import io.ebean.datasource.DataSourceConfig;
import io.ebean.datasource.DataSourceFactory;
import io.ebean.datasource.DataSourcePoolListener;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import javax.sql.DataSource;
/**
@@ -590,14 +590,16 @@ public final class InternalConfiguration {
*/
QueryPlanLogger queryPlanLogger(Platform platform) {
switch (platform.base()) {
case POSTGRES:
return new QueryPlanLoggerPostgres();
case SQLSERVER:
return new QueryPlanLoggerSqlServer();
case ORACLE:
return new QueryPlanLoggerOracle();
case POSTGRES:
return new QueryPlanLoggerExplain("explain (analyze, buffers) ");
case YUGABYTE:
return new QueryPlanLoggerExplain("explain (analyze, buffers, dist) ");
default:
return new QueryPlanLoggerExplain();
return new QueryPlanLoggerExplain("explain ");
}
}
@@ -56,7 +56,10 @@ final class MultiTenantDbCatalogSupplier implements DataSourceSupplier {
}
@Override
public Connection readOnlyConnection(Object tenantId) throws SQLException {
public Connection readOnlyConnection(Object tenantId, boolean useMaster) throws SQLException {
if (readOnly == null || useMaster) {
return catalogDataSource.getConnectionForTenant(tenantId);
}
return readOnly.getConnectionForTenant(tenantId);
}
@@ -103,7 +106,6 @@ final class MultiTenantDbCatalogSupplier implements DataSourceSupplier {
*/
@Override
public Connection getConnection() throws SQLException {
Connection connection = dataSource.getConnection();
connection.setCatalog(tenantCatalog());
return connection;
@@ -56,8 +56,12 @@ final class MultiTenantDbSchemaSupplier implements DataSourceSupplier {
}
@Override
public Connection readOnlyConnection(Object tenantId) throws SQLException {
return readOnly.getConnectionForTenant(tenantId);
public Connection readOnlyConnection(Object tenantId, boolean useMaster) throws SQLException {
if (readOnly == null || useMaster) {
return schemaDataSource.getConnectionForTenant(tenantId);
} else {
return readOnly.getConnectionForTenant(tenantId);
}
}
@Override
@@ -106,7 +110,6 @@ final class MultiTenantDbSchemaSupplier implements DataSourceSupplier {
*/
@Override
public Connection getConnection() throws SQLException {
Connection connection = dataSource.getConnection();
connection.setSchema(tenantSchema());
return connection;
@@ -43,8 +43,8 @@ final class MultiTenantDbSupplier implements DataSourceSupplier {
}
@Override
public Connection readOnlyConnection(Object tenantId) throws SQLException {
throw new SQLException("Not currently supported");
public Connection readOnlyConnection(Object tenantId, boolean useMaster) throws SQLException {
return dataSourceProvider.dataSource(tenantId).getConnection();
}
@Override
@@ -23,7 +23,7 @@ final class ObtainedTransactionImplicit extends ObtainedTransaction {
@Override
public void commitIfCreated() {
server.commitTransaction();
transaction.commit();
}
@Override
@@ -4,7 +4,7 @@ import io.ebean.QueryIterator;
import io.ebean.Version;
import io.ebean.bean.BeanCollection;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
@@ -18,7 +18,7 @@ import io.ebeaninternal.server.loadcontext.DLoadContext;
import io.ebeaninternal.server.query.CQueryPlan;
import io.ebeaninternal.server.transaction.DefaultPersistenceContext;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.sql.SQLException;
import java.util.*;
import java.util.function.Consumer;
@@ -60,6 +60,11 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
return queryEngine.translate(this, bindLog, sql, e);
}
@Override
public boolean isGetAllFromBeanCache() {
return (transaction == null || !transaction.isSkipCache()) && getFromBeanCache();
}
@Override
public boolean isDeleteByStatement() {
if (!transaction.isPersistCascade() || beanDescriptor.isDeleteByStatement()) {
@@ -220,7 +225,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
} else {
// create an implicit transaction to execute this query
// potentially using read-only DataSource with autoCommit
transaction = server.createReadOnlyTransaction(query.tenantId());
transaction = server.createReadOnlyTransaction(query.tenantId(), query.isUseMaster());
}
createdTransaction = true;
}
@@ -44,7 +44,7 @@ public final class PersistDeferredRelationship {
return; // could not bind: TODO: should we log/throw an error?
}
// bind the where clause for the bean
Object[] idValues = beanDescriptor.idBinder().getIdValues(bean);
Object[] idValues = beanDescriptor.idBinder().values(bean);
for (int j = 0; j < idValues.length; j++) {
sqlUpdate.setParameter(pos + j, idValues[j]);
}
@@ -8,7 +8,7 @@ import io.ebeaninternal.server.persist.BatchPostExecute;
import io.ebeaninternal.server.persist.BatchedSqlException;
import io.ebeaninternal.server.persist.PersistExecute;
import javax.persistence.PersistenceException;
import jakarta.persistence.PersistenceException;
import java.sql.SQLException;
/**
@@ -20,9 +20,9 @@ import io.ebeanservice.docstore.api.DocStoreUpdate;
import io.ebeanservice.docstore.api.DocStoreUpdateContext;
import io.ebeanservice.docstore.api.DocStoreUpdates;
import javax.persistence.EntityNotFoundException;
import javax.persistence.OptimisticLockException;
import javax.persistence.PersistenceException;
import jakarta.persistence.EntityNotFoundException;
import jakarta.persistence.OptimisticLockException;
import jakarta.persistence.PersistenceException;
import java.io.IOException;
import java.sql.Statement;
import java.util.*;

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