[hibernate/hibernate-orm] 75d436: HHH-13720: Implement mapping model support for plu...
by Steve Ebersole
Branch: refs/heads/wip/6.0
Home: https://github.com/hibernate/hibernate-orm
Commit: 75d436ab25ef47ac8bbfdda23df2b11d1df2d0ca
https://github.com/hibernate/hibernate-orm/commit/75d436ab25ef47ac8bbfdda...
Author: Steve Ebersole <steve(a)hibernate.org>
Date: 2019-11-27 (Wed, 27 Nov 2019)
Changed paths:
A hibernate-core/src/main/java/org/hibernate/metamodel/mapping/MappingModelHelper.java
M hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPathConsumer.java
M hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java
M hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SimpleDeleteQueryPlan.java
M hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/SqmMutationStrategyHelper.java
M hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/idtable/RestrictedDeleteExecutionDelegate.java
M hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/idtable/UnrestrictedDeleteExecutionDelegate.java
M hibernate-core/src/main/java/org/hibernate/query/sqm/sql/SimpleSqmDeleteTranslation.java
M hibernate-core/src/main/java/org/hibernate/query/sqm/sql/internal/StandardSqmDeleteTranslator.java
A hibernate-core/src/main/java/org/hibernate/sql/ast/tree/from/MutatingTableReferenceGroupWrapper.java
M hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/MultiIdEntityLoadTests.java
R hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/EntityContainingLists.java
R hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/EntityContainingMaps.java
R hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/EntityContainingSets.java
R hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/EnumValue.java
R hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/EnumValueConverter.java
A hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/ListOperationTests.java
M hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/MapOperationTests.java
M hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/PluralAttributeMappingTests.java
M hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/SetOperationTests.java
R hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/SimpleEntity.java
R hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/SomeStuff.java
R hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/TempDropDataHelper.java
M hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/SelectClauseTests.java
M hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/WhereClauseTests.java
A hibernate-core/src/test/java/org/hibernate/orm/test/query/sqm/mutation/multitable/BasicDeletionTests.java
R hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/PluralAttributeSmokeTests.java
M hibernate-testing/src/main/java/org/hibernate/testing/hamcrest/CollectionMatchers.java
A hibernate-testing/src/main/java/org/hibernate/testing/hamcrest/HasNullElementsMatcher.java
A hibernate-testing/src/main/java/org/hibernate/testing/hamcrest/InitializationCheckMatcher.java
M hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/EntityOfLists.java
M hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/EntityOfMaps.java
M hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/EntityOfSets.java
A hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/EnumValue.java
A hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/EnumValueConverter.java
A hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/SimpleComponent.java
M hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/SimpleEntity.java
Log Message:
-----------
HHH-13720: Implement mapping model support for plural attributes - sorted set;
HHH-13715: HQL/Criteria DELETE support - support for cleaning-up collection tables
4 years, 12 months
[hibernate/hibernate-orm] 7b489b: HH-13720: Implement mapping model support for plur...
by Steve Ebersole
Branch: refs/heads/wip/6.0
Home: https://github.com/hibernate/hibernate-orm
Commit: 7b489b180c35aecd73c6f8e7b0aa634b20d91c77
https://github.com/hibernate/hibernate-orm/commit/7b489b180c35aecd73c6f8e...
Author: Steve Ebersole <steve(a)hibernate.org>
Date: 2019-11-27 (Wed, 27 Nov 2019)
Changed paths:
M hibernate-core/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java
M hibernate-core/src/main/java/org/hibernate/collection/spi/PersistentCollection.java
M hibernate-core/src/main/java/org/hibernate/sql/results/internal/domain/collection/AbstractImmediateCollectionInitializer.java
M hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/EntityContainingSets.java
M hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/MapOperationTests.java
M hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/PluralAttributeMappingTests.java
M hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/collections/SetOperationTests.java
M hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/SelectClauseTests.java
M hibernate-testing/src/main/java/org/hibernate/testing/orm/domain/gambit/EntityOfSets.java
Log Message:
-----------
HH-13720: Implement mapping model support for plural attributes - sorted set
4 years, 12 months
[hibernate/hibernate-orm] c13bfd: initial working support for SQL-AST-based subselec...
by Steve Ebersole
Branch: refs/heads/wip/6.0
Home: https://github.com/hibernate/hibernate-orm
Commit: c13bfdc338adb8329d13bf5ce88e57a64ecdf851
https://github.com/hibernate/hibernate-orm/commit/c13bfdc338adb8329d13bf5...
Author: Steve Ebersole <steve(a)hibernate.org>
Date: 2019-11-26 (Tue, 26 Nov 2019)
Changed paths:
M hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java
M hibernate-core/src/main/java/org/hibernate/engine/spi/SubselectFetch.java
M hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java
M hibernate-core/src/main/java/org/hibernate/loader/BatchLoadSizingStrategy.java
M hibernate-core/src/main/java/org/hibernate/loader/Loader.java
M hibernate-core/src/main/java/org/hibernate/loader/entity/DynamicBatchingEntityLoaderBuilder.java
M hibernate-core/src/main/java/org/hibernate/loader/internal/BatchCollectionKeyLoader.java
M hibernate-core/src/main/java/org/hibernate/loader/internal/MetamodelSelectBuilderProcess.java
M hibernate-core/src/main/java/org/hibernate/loader/internal/MultiIdEntityLoaderStandardImpl.java
M hibernate-core/src/main/java/org/hibernate/loader/internal/SubSelectFetchCollectionLoader.java
M hibernate-core/src/main/java/org/hibernate/loader/plan/exec/process/internal/ResultSetProcessingContextImpl.java
M hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityValuedModelPart.java
M hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/SimpleForeignKeyDescriptor.java
M hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
M hibernate-core/src/main/java/org/hibernate/persister/collection/BasicCollectionPersister.java
M hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java
M hibernate-core/src/main/java/org/hibernate/sql/exec/internal/JdbcSelectExecutorStandardImpl.java
M hibernate-core/src/main/java/org/hibernate/sql/exec/spi/ExecutionContext.java
M hibernate-core/src/main/java/org/hibernate/sql/results/internal/JdbcValuesSourceProcessingStateStandardImpl.java
M hibernate-core/src/main/java/org/hibernate/sql/results/internal/LoadingCollectionEntryImpl.java
M hibernate-core/src/main/java/org/hibernate/sql/results/internal/StandardRowReader.java
M hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/MultiLoadSubSelectCollectionTest.java
Log Message:
-----------
initial working support for SQL-AST-based subselect-fetching
4 years, 12 months
[hibernate/hibernate-orm] 1b7f60: preliminary design docs for SQM and SQL AST
by Steve Ebersole
Branch: refs/heads/wip/6.0
Home: https://github.com/hibernate/hibernate-orm
Commit: 1b7f60c348c9473b9d27490c96d389ef47d9a40f
https://github.com/hibernate/hibernate-orm/commit/1b7f60c348c9473b9d27490...
Author: Steve Ebersole <steve(a)hibernate.org>
Date: 2019-11-24 (Sun, 24 Nov 2019)
Changed paths:
A design/sql-ast.adoc
M design/sqm.adoc
Log Message:
-----------
preliminary design docs for SQM and SQL AST
Commit: 0c6c8b44061548a6449f9bb5cfdffb1bba1542e9
https://github.com/hibernate/hibernate-orm/commit/0c6c8b44061548a6449f9bb...
Author: Steve Ebersole <steve(a)hibernate.org>
Date: 2019-11-25 (Mon, 25 Nov 2019)
Changed paths:
M hibernate-core/src/main/java/org/hibernate/engine/spi/LoadQueryInfluencers.java
M hibernate-core/src/main/java/org/hibernate/event/internal/DefaultMergeEventListener.java
M hibernate-core/src/main/java/org/hibernate/event/internal/DefaultRefreshEventListener.java
A hibernate-core/src/main/java/org/hibernate/loader/internal/BatchCollectionKeyLoader.java
M hibernate-core/src/main/java/org/hibernate/loader/internal/SingleCollectionKeyLoader.java
R hibernate-core/src/main/java/org/hibernate/loader/internal/SingleIdEntityLoaderLegacyBatch.java
R hibernate-core/src/main/java/org/hibernate/loader/internal/SingleIdEntityLoaderPaddedBatch.java
M hibernate-core/src/main/java/org/hibernate/loader/internal/SingleIdEntityLoaderStandardImpl.java
A hibernate-core/src/main/java/org/hibernate/loader/spi/CascadingFetchProfile.java
R hibernate-core/src/main/java/org/hibernate/loader/spi/InternalFetchProfile.java
A hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityAssociationMapping.java
M hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EntityCollectionPart.java
M hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java
M hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/PluralAttributeMappingImpl.java
M hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/SingularAssociationAttributeMapping.java
M hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
M hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
R hibernate-core/src/test/java/org/hibernate/orm/test/loading/MultiIdEntityLoadTests.java
A hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/MultiIdEntityLoadTests.java
A hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/MultiLoadSubSelectCollectionTest.java
A hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/MultiLoadTest.java
R hibernate-core/src/test/java/org/hibernate/test/ops/multiLoad/MultiLoadSubSelectCollectionTest.java
R hibernate-core/src/test/java/org/hibernate/test/ops/multiLoad/MultiLoadTest.java
M hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DomainModel.java
Log Message:
-----------
more work on multi-id entity loading and key-based loading in general
Compare: https://github.com/hibernate/hibernate-orm/compare/0ec5af29855f...0c6c8b4...
4 years, 12 months
[hibernate/hibernate-orm] 21e791: HHH-9301 - Support select variable refs in group b...
by Jan-Willem Gmelig Meyling
Branch: refs/heads/master
Home: https://github.com/hibernate/hibernate-orm
Commit: 21e79125e601160101f1f27e1aea026ede9c36a9
https://github.com/hibernate/hibernate-orm/commit/21e79125e601160101f1f27...
Author: Jan-Willem Gmelig Meyling <jan-willem(a)youngmediaexperts.nl>
Date: 2019-11-25 (Mon, 25 Nov 2019)
Changed paths:
M hibernate-core/src/main/antlr/hql-sql.g
M hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java
M hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java
M hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java
M hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL81Dialect.java
M hibernate-core/src/main/java/org/hibernate/hql/internal/ast/HqlSqlWalker.java
A hibernate-core/src/test/java/org/hibernate/query/GroupByAliasTest.java
M hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java
Log Message:
-----------
HHH-9301 - Support select variable refs in group by for DBMS dialects that support it
While not strictly compliant with the SQL specification, the MySQL, PostgreSQL and H2 support the use of select aliases in the GROUP BY clause. An obvious benefit is that produced SQL queries will be easier to read, because complex select expressions from aggregrate queries will have to be included in the group by clause as well. These can now simply reference the aliases of the respective columns for the tuple element. However, there is also a functional difference. For function invocations that have parameterized arguments, the query optimizer can't guarantee the that the function result between the selection projection and grouping process are equal. This results in an error because a value is projected which is not grouped by. An example where this for example becomes relevant, is when parameterizing TimeScaleDB's [`time_bucket_gapfill()`](https://docs.timescale.com/latest/api#time_bucket_gapfill-examples) function.
For example, using `time_bucket_gapfill()` one might want to produce a criteria query that produces the following SQL:
```sql
SELECT
time_bucket_gapfill(?, time, ?, ?) AS ts,
avg(tg) as tg
FROM iaqmeasurement
GROUP BY ts
ORDER BY ts;
```
When the alias is not used as grouping value, the query will yield an error:
```sql
SELECT
time_bucket_gapfill(?, time, ?, ?) AS ts,
avg(tg) as tg
FROM iaqmeasurement
GROUP BY time_bucket_gapfill(?, time, ?, ?)
ORDER BY ts;
```
Of course the parameter values can just be stored in a CTE as well, but I think we should consider support for variable refs in group by for DBMS dialects that support it. This pull request implements the feature equivalently to how its currently done for order by clauses, and only enables the feature for known supported dialects (H2, PostgreSQL and MySQL - based on [https://stackoverflow.com/a/3841804/2104280](https://stackoverflow.com/a/...).
Jira: https://hibernate.atlassian.net/browse/HHH-9301
Co-authored-by: Sayra Ranjha <S.S.Ranjha(a)student.tudelft.nl>
4 years, 12 months