Commit Graph

5528 Commits

Author SHA1 Message Date
Steve Ebersole 287808a914 HHH-13778: `@OrderBy` handling using SQL AST
- fixed test
2019-12-12 18:24:36 -06:00
Steve Ebersole b87bbb4720 HHH-13778: `@OrderBy` handling using SQL AST
- checkstyle
2019-12-12 13:38:28 -06:00
Steve Ebersole 284b2c5677 HHH-13778: `@OrderBy` handling using SQL AST
- parsing in PluralAttributeMapping implemented
- still need to convert the OrderByFragment to SQL AST and add to the SQL AST order-by-clause
2019-12-12 13:34:37 -06:00
Steve Ebersole 8600058784 HHH-13778: `@OrderBy` handling using SQL AST
- initial work - Antlr grammar, parse tree visitation and building OrderByFragment (translation) tree
- fixed bug in HQL parsing - was building an unnecessary HqlLexer instance
2019-12-12 11:58:37 -06:00
Steve Ebersole 8c671d98d0 minor 2019-12-11 19:43:37 -06:00
Steve Ebersole 28c0b05d0f `org.hibernate.metamodel.RuntimeMetamodels` 2019-12-11 15:03:32 -06:00
Andrea Boriero 1580613f8a HHH-13777 UnsupportedOperationException is thrown for MappedSuperclass if the id is declared on subclasses 2019-12-11 13:36:24 +00:00
Andrea Boriero 3eed218135 HHH-13769: Avoid unnecessary joins test 2019-12-11 09:43:16 +00:00
Andrea Boriero 31913eaeea Add tests for AttributeOverride 2019-12-11 09:43:16 +00:00
Steve Ebersole 996157fca1 HHH-13769: Avoid unnecessary joins
better support for lazy TableReference handling for collections;
removed TableReferenceCollector and TableReferenceContributor
2019-12-10 14:43:24 -06:00
Steve Ebersole dcbef8705c HHH-13769: Avoid unnecessary joins
better support for lazy TableReference handling for collections
2019-12-10 14:17:39 -06:00
Andrea Boriero becbaea172 Fix Could not resolve binding for Foreign Key for TableReference name with schema 2019-12-10 12:07:25 +00:00
Andrea Boriero 1363844ca0 Implement support for @Embeddable with ToMany and ToOne 2019-12-10 10:00:10 +00:00
Steve Ebersole 3be2369110 HHH-13769: Avoid unnecessary joins 2019-12-09 17:35:56 -06:00
Andrea Boriero 79c83cf8ba Merge remote-tracking branch 'upstream/master' into wip/6.0 2019-12-09 12:07:23 +00:00
Steve Ebersole 033eea4258 minor change
- initialize `#valueMapping` field during `org.hibernate.metamodel.mapping.EmbeddableMappingType` ctor by passing along the creator-function, allowing `#valueMapping` to become physically final (was always logically final).
2019-12-07 08:38:40 -06:00
Jan-Willem Gmelig Meyling a6b924ffe7 HHH-9301 Fix test under PostgreSQL 2019-12-05 14:00:01 +00:00
Andrea Boriero 963a516ea8 Revert "HHH-13752 - Test and fix deletion of entities with many-to-many assocations using non-primary keys for join table"
This reverts commit 58dd469e4c.
2019-12-05 12:34:27 +00:00
Andrea Boriero e924d55fdf Revert "HHH-13752 - Deletion of entities with many-to-many assocations using non-primary keys for join table"
This reverts commit 11455f3467.
2019-12-05 12:34:10 +00:00
Gail Badner 99868fb5f9 HHH-13355 : StaleStateException for updates to optional secondary table using saveOrUpdate 2019-12-05 12:05:24 +00:00
Gail Badner 69dad5fda5 HHH-13355 : test case 2019-12-05 12:05:24 +00:00
Gail Badner 6ce7831f77 HHH-13365 : Entities in joined subclass table are not inserted with batch size > 0 using sequence-identity ID generator 2019-12-05 11:36:04 +00:00
Gail Badner 7d11649d99 HHH-13365 : Added test case 2019-12-05 11:36:04 +00:00
Andrea Boriero 11455f3467 HHH-13752 - Deletion of entities with many-to-many assocations using non-primary keys for join table 2019-12-05 10:18:23 +00:00
Christian Beikov 58dd469e4c HHH-13752 - Test and fix deletion of entities with many-to-many assocations using non-primary keys for join table 2019-12-05 10:05:16 +00:00
Andrea Boriero a133aff97f HHH-13608 Fix failing tests 2019-12-05 09:25:32 +00:00
Jason Jijón 7daf67172a HHH-13758 - Limit Handler for SQL server doesn't work with CTE queries with strings literals 2019-12-04 19:38:56 +00:00
Sanne Grinovero 42752ec89d HHH-8901 Missing data cleanup in the new test 2019-12-04 17:44:02 +00:00
Sanne Grinovero 386d77129e HHH-13761 Debug logging of JPA compliance settings didn't log the value of the settings 2019-12-04 16:56:23 +00:00
Sanne Grinovero b9b15245b7 HHH-8901 Some very minor string handling optimisations 2019-12-04 16:37:34 +00:00
Nathan Xu ab9ae43185 HHH-8901 replace "in ()" SQL with "in (null)" in QueryParameterBindingsImpl 2019-12-04 16:05:10 +00:00
Davide D'Alto 4e449dfafa HHH-13764 Test behaviour doesn't change when @Embedded is on the getter 2019-12-03 20:40:53 +00:00
Davide D'Alto 4fb813f39c HHH-13764 Include getter annotations when required for the enhancements 2019-12-03 20:09:09 +00:00
Steve Ebersole d5125d8e31 HHH-13763 : Update all load-by-key handling to use SQL AST
minor fix-ups
2019-12-03 13:27:37 -06:00
Steve Ebersole e112d9631e HHH-13763 : Update all load-by-key handling to use SQL AST
SingleUniqueKeyEntityLoader
2019-12-03 13:12:57 -06:00
Steve Ebersole 0a41ac8466 HHH-13763 : Update all load-by-key handling to use SQL AST
* dropped `org.hibernate.loader.plan`
* dropped `org.hibernate.loader.custom` (*)
* dropped `org.hibernate.loader.collection`
* dropped `org.hibernate.loader.entity`
* dropped `org.hibernate.loader.hql`
* cleaned-up `org.hibernate.loader`
2019-12-03 11:31:45 -06:00
Davide D'Alto 98101bfc52 HHH-13759 Add AssertJ for testing Hibernate Core 2019-12-03 12:13:56 +00:00
Steve Ebersole 10cdb47a97 HHH-13763 : Update all load-by-key handling to use SQL AST
* Cleanup
* Prep for dropping LoadPlan
2019-12-02 15:05:26 -06:00
Steve Ebersole 264224a49e HHH-13763 : Update all load-by-key handling to use SQL AST
- Preliminary work on NaturalIdLoader
2019-12-02 13:49:27 -06:00
Steve Ebersole c96ad0dcea HHH-13763 : Update all load-by-key handling to use SQL AST
- Initial working support for the following load-by-key Loaders:

  * SingleIdEntityLoader
  * MultiIdEntityLoader
  * SingleKeyCollectionLoader
  * BatchKeyCollectionLoader
  * SubSelectFetchCollectionLoader
2019-12-02 13:49:27 -06:00
Andrea Boriero f836689be8 Fix merge errors 2019-12-02 10:22:56 +00:00
Andrea Boriero d2865a54df Merge remote-tracking branch 'upstream5/master' into wip/6.0_merge_15 2019-12-02 09:14:27 +00:00
Steve Ebersole 75d436ab25 HHH-13720: Implement mapping model support for plural attributes - sorted set;
HHH-13715: HQL/Criteria DELETE support - support for cleaning-up collection tables
2019-11-27 12:06:21 -06:00
Steve Ebersole 7b489b180c HH-13720: Implement mapping model support for plural attributes - sorted set 2019-11-27 07:23:28 -06:00
Andrea Boriero 6a403fa5d9 Fix delete of entity with plural attributes 2019-11-27 12:13:10 +00:00
Steve Ebersole afb9f9770d HHH-13746: Implement Load by Multiple Ids using SQL AST
composite id testing
2019-11-26 15:12:54 -06:00
Steve Ebersole c13bfdc338 initial working support for SQL-AST-based subselect-fetching 2019-11-26 14:54:36 -06:00
Steve Ebersole 0c6c8b4406 more work on multi-id entity loading and key-based loading in general 2019-11-25 15:58:50 -06:00
Vlad Mihalcea f08abf3628 HHH-13608 Oracle8iDialect should use CASE_INSENSITIVE pattern matching when checking the statement type 2019-11-25 15:41:33 +00:00
Jan-Willem Gmelig Meyling 21e79125e6 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/3841804/2104280)).

Jira: https://hibernate.atlassian.net/browse/HHH-9301

Co-authored-by: Sayra Ranjha <S.S.Ranjha@student.tudelft.nl>
2019-11-25 14:57:17 +00:00