Skip to content

Commit da5ec20

Browse files
committed
Merge branch 'o-main' into main-perf
2 parents 3a2d4bc + db90880 commit da5ec20

File tree

199 files changed

+6751
-959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+6751
-959
lines changed

changelog.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,64 @@ Hibernate 6 Changelog
33

44
Note: Please refer to JIRA to learn more about each issue.
55

6+
Changes in 6.3.0.CR1 (July 20, 2023)
7+
------------------------------------------------------------------------------------------------------------------------
8+
9+
https://hibernate.atlassian.net/projects/HHH/versions/32084
10+
11+
** Bug
12+
* [HHH-16943] - Column ordering leads to wrong column order in unique constraints
13+
* [HHH-16942] - OneToOne Mapping with PartitionKey fails
14+
* [HHH-16923] - Deleting all entities of a given type fails when using a composite primary key and order_updates
15+
* [HHH-16912] - Hibernate 6.2 breaks backward compatibility
16+
* [HHH-16908] - Fail to compute column mapping on entity with idClass having one field as pk of a OneToOne association
17+
* [HHH-16900] - Iteration of MutationOperation(s) triggers type pollution
18+
* [HHH-16892] - LocalXmlResourceResolver does not resolve dtd URLs that use https scheme
19+
* [HHH-16890] - StackOverflowError when loading entities with @Proxy(lazy = false)
20+
* [HHH-16872] - JDBC fetch size seems to be ignored post migration to hibernate6
21+
* [HHH-16860] - OneToMany with inherited classes on both sides
22+
* [HHH-16857] - JdbcLiteralFormatterCharacterData's lowercase 'n' causes invalid SQL syntax
23+
* [HHH-16853] - Setting Named Query Parameters Is VERY Slow
24+
* [HHH-16849] - When we use partition key in join columns generated query is incorrect and its failing.
25+
* [HHH-16843] - HQL 'value = null'
26+
* [HHH-16839] - Failing to update a one-to-one lazy association with `OptimisticLockType.DIRTY` and enabled bytecode enhancement
27+
* [HHH-16833] - Assertion Error when inserting two entities linked with a OneToOne relation
28+
* [HHH-16832] - Bytecode enhancement leads to broken constructor for a generic embedded field in a MappedSuperclass
29+
* [HHH-16821] - Fail to delete entity that contains an embedded with a many to many association as field
30+
* [HHH-16820] - When batching enabled the LockModeType is ignored
31+
* [HHH-16818] - JPQL parser treats 'N' as a String and fails org.hibernate.query.SemanticException: The assignment expression type [java.lang.String] did not match the assignment path type [java.lang.Character]
32+
* [HHH-16813] - Metamodel Generator adds @Generator annotations that cannot be compiled
33+
* [HHH-16812] - StackOverflowError an embeddable's @Parent is a subclass in an inheritance tree
34+
* [HHH-16811] - Dirty property lost and not detected with Batch Fetch, Embedded and FetchMode SELECT
35+
* [HHH-16810] - Fail to delete entity with a composite id using an @IdClass with one of its fields mapped from the id of a @ManyToOne association
36+
* [HHH-16802] - typecheck subquery predicates
37+
* [HHH-16799] - Using bytecode enhancement may result in incorrect AccessType being picked
38+
* [HHH-16772] - Generated bytecode for HibernateAccessOptimizer class is invalid and causes operand stack overflow issue.
39+
* [HHH-16767] - From#getJoins throws exception if non-attribute was joined
40+
* [HHH-16765] - Cannot parse quoted table name
41+
* [HHH-16747] - interpretation of queries with no 'select', multiple elements in 'from', and no explicit result class
42+
* [HHH-16742] - ArrayIndexOutOfBoundsException when calling Tuple.getElements()
43+
* [HHH-16732] - HQL id() function does not work for @Any mappings
44+
* [HHH-16707] - Saving entities using @MappedSuperclass does not work with classes in foreign packages
45+
* [HHH-16669] - Batch loading prevents throwing ObjectNotFoundException on initialization of non-existent enhanced entity
46+
* [HHH-16663] - TCK failure due to wrong refactoring in schema management Action enum
47+
* [HHH-16619] - associations on fields beginning with underscore
48+
* [HHH-16593] - mappedBy non-association
49+
* [HHH-16586] - When merging a persisted entity with a null Version, Hibernate treats entity as transient instead of throwing an Exception
50+
* [HHH-16578] - Incorrect validation error for tinyint, but and datetime
51+
* [HHH-16563] - Hibernate 6.x.x should use jakarta.annotation.Generated
52+
* [HHH-16556] - SQLServer2016Dialect deprecation javadoc has wrong version
53+
* [HHH-16545] - PersistenceUtilHelper.MetadataCache is not Thread-Safe
54+
* [HHH-16514] - Property sorting can lead to incorrect column mappings with derived embeddable keys
55+
* [HHH-16494] - Right or full joining on single tablepolymorphic entities gives incorrect results
56+
* [HHH-16485] - Insert ordering doesn't consider root entity names
57+
* [HHH-16461] - @Version + session.refresh(entity, LockMode.PESSIMISTIC_WRITE) leads to StaleObjectStateException
58+
* [HHH-16360] - On Postgresql with hbm2ddl.auto=update, timestamp columns are updated even when correct
59+
* [HHH-16275] - LockTest.testLock*FkTarget fail on Sybase with timeout getting lock
60+
* [HHH-16022] - bad error reporting of parsing failures
61+
* [HHH-15917] - Unrelated Entity Join throws IllegalStateException
62+
63+
664
Changes in 6.2.0.CR1 (December 22, 2022)
765
------------------------------------------------------------------------------------------------------------------------
866

checkerstubs/java.lang.astub

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@ package java.lang.reflect;
55
import org.checkerframework.checker.nullness.qual.Nullable;
66

77
public final class Method extends Executable {
8-
void invoke(@Nullable Object obj, Object @Nullable ... args);
8+
void invoke(@Nullable Object obj, @Nullable Object @Nullable ... args);
9+
}
10+
11+
public final
12+
class Field extends AccessibleObject implements Member {
13+
public void set(Object obj, @Nullable Object value);
914
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[[credits]]
2+
== Credits
3+
4+
The full list of contributors to Hibernate ORM can be found on the
5+
https://github.com/hibernate/hibernate-orm/graphs/contributors[GitHub repository].
6+
7+
The following contributors were involved in this documentation:
8+
9+
* Gavin King

documentation/src/main/asciidoc/introduction/Hibernate_Introduction.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
:versionDocBase: {docsBase}/6.3
88
:userGuideBase: {versionDocBase}/userguide/html_single/Hibernate_User_Guide.html
99

10-
= An introduction to Hibernate 6
11-
Gavin King and the Hibernate team
10+
= A Guide to Hibernate 6
1211
:title-logo-image: image:../../style/asciidoctor/images/org/hibernate/logo.png[]
1312
:toc:
1413
:toclevels: 3
@@ -35,3 +34,4 @@ include::Tuning.adoc[]
3534

3635
include::Advanced.adoc[]
3736

37+
include::Credits.adoc[]

documentation/src/main/asciidoc/querylanguage/Concepts.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
This document describes Hibernate Query Language (HQL), which is, I suppose we could say, a dialect of the Java (now Jakarta) Persistence Query Language (JPQL).
55

6-
Or is it the other way around?
7-
86
[NOTE]
97
====
8+
Or is it the other way around?
9+
1010
JPQL was inspired by early versions of HQL, and is a proper subset of modern HQL.
1111
Here we focus on describing the complete, more powerful HQL language as it exists today.
1212
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[[credits]]
2+
== Credits
3+
4+
The full list of contributors to Hibernate ORM can be found on the
5+
https://github.com/hibernate/hibernate-orm/graphs/contributors[GitHub repository].
6+
7+
The following contributors were involved in this documentation:
8+
9+
* Gavin King

documentation/src/main/asciidoc/querylanguage/Expressions.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ For _logical_ operations on <<conditional-expressions,predicates>>, see <<logica
11731173
| `is false` | `is not false` | Binary | `true` if the value to the left is `false`, or `false` otherwise
11741174
|===
11751175

1176-
[[null-predicate-example]]
1176+
[[boolean-predicate-example]]
11771177
[source, hql]
11781178
----
11791179
from Book where discontinued is not true

documentation/src/main/asciidoc/querylanguage/Hibernate_Query_Language.adoc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
:example-dir-hql: {core-project-dir}/src/test/java/org/hibernate/orm/test/hql
1515
:extrasdir: extras
1616

17-
= A guide to Hibernate Query Language 6
18-
Gavin King and the Hibernate team
17+
= A Guide to Hibernate Query Language
1918
:title-logo-image: image:../../style/asciidoctor/images/org/hibernate/logo.png[]
2019
:toc:
2120
:toclevels: 3
@@ -42,3 +41,7 @@ include::From.adoc[]
4241

4342
include::Relational.adoc[]
4443

44+
<<<
45+
46+
include::Credits.adoc[]
47+

documentation/src/main/asciidoc/querylanguage/Preface.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:introductionUrl: {versionDocBase}/querylanguage/html_single/Hibernate_Query_Language.html
2+
13
[[preface]]
24
== Preface
35

@@ -11,5 +13,4 @@ At long last, HQL has a feature set to match that of modern dialects of SQL, and
1113

1214
This document is a reference guide to the full feature set of the language, and is the only up-to-date source for those who wish to learn how to write HQL effectively in Hibernate 6.
1315

14-
But if you don't already know Hibernate, don't start here.
15-
First, read _An introduction to Hibernate 6_, and then come back.
16+
If you don't already know Hibernate, first read link:{introductionUrl}[A Guide to Hibernate 6].

documentation/src/main/asciidoc/userguide/Credits.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[[credits]]
22
== Credits
33

4-
The full list of contributors to Hibernate ORM can be found in the `copyright.txt` file
5-
in the Hibernate ORM sources, available in particular in our https://github.com/hibernate/hibernate-orm/[git repository].
4+
The full list of contributors to Hibernate ORM can be found on the
5+
https://github.com/hibernate/hibernate-orm/graphs/contributors[GitHub repository].
66

77
The following contributors were involved in this documentation:
88

documentation/src/main/asciidoc/userguide/Hibernate_User_Guide.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Hibernate ORM {fullVersion} User Guide
1+
= Hibernate ORM User Guide
22
:toc2:
33
:toclevels: 3
44
:sectanchors:

gradle/java-module.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ checkerFramework {
544544
extraJavacArgs = [
545545
'-AsuppressWarnings=initialization',
546546
// stubs is passed directly through options.compilerArgumentProviders
547-
'-AonlyDefs=^org\\.hibernate\\.(jpamodelgen|spi|pretty|stat|engine\\.(profile|transaction)|(action|context|bytecode)\\.spi)\\.'
547+
'-AonlyDefs=^org\\.hibernate\\.(jdbc|exception|integrator|jpamodelgen|service|spi|pretty|property\\.access|stat|engine\\.(config|jndi|profile|transaction)|(action|context|bytecode)\\.spi)\\.'
548548
]
549549
}
550550

hibernate-core/src/main/java/org/hibernate/HibernateException.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package org.hibernate;
88

99
import jakarta.persistence.PersistenceException;
10+
import org.checkerframework.checker.nullness.qual.Nullable;
1011

1112
/**
1213
* The base type for exceptions thrown by Hibernate.
@@ -31,7 +32,7 @@ public HibernateException(String message) {
3132
*
3233
* @param cause The underlying cause.
3334
*/
34-
public HibernateException(Throwable cause) {
35+
public HibernateException(@Nullable Throwable cause) {
3536
super( cause );
3637
}
3738

@@ -41,7 +42,7 @@ public HibernateException(Throwable cause) {
4142
* @param message The message explaining the reason for the exception.
4243
* @param cause The underlying cause.
4344
*/
44-
public HibernateException(String message, Throwable cause) {
45+
public HibernateException(String message, @Nullable Throwable cause) {
4546
super( message, cause );
4647
}
4748
}

hibernate-core/src/main/java/org/hibernate/Interceptor.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public interface Interceptor {
4848
* Called just before an object is initialized. The interceptor may change the {@code state}, which will
4949
* be propagated to the persistent object. Note that when this method is called, {@code entity} will be
5050
* an empty uninitialized instance of the class.
51-
* <p>
52-
* NOTE: The indexes across the {@code state}, {@code propertyNames} and {@code types} arrays match.
51+
*
52+
* @apiNote The indexes across the {@code state}, {@code propertyNames}, and {@code types} arrays match.
5353
*
5454
* @param entity The entity instance being loaded
5555
* @param id The identifier value being loaded
@@ -73,8 +73,8 @@ default boolean onLoad(Object entity, Serializable id, Object[] state, String[]
7373
* Called just before an object is initialized. The interceptor may change the {@code state}, which will
7474
* be propagated to the persistent object. Note that when this method is called, {@code entity} will be
7575
* an empty uninitialized instance of the class.
76-
* <p>
77-
* NOTE: The indexes across the {@code state}, {@code propertyNames} and {@code types} arrays match.
76+
*
77+
* @apiNote The indexes across the {@code state}, {@code propertyNames}, and {@code types} arrays match.
7878
*
7979
* @param entity The entity instance being loaded
8080
* @param id The identifier value being loaded
@@ -100,9 +100,9 @@ default boolean onLoad(Object entity, Object id, Object[] state, String[] proper
100100
* Note that not all flushes end in actual synchronization with the database, in which case the
101101
* new {@code currentState} will be propagated to the object, but not necessarily (immediately) to
102102
* the database. It is strongly recommended that the interceptor <b>not</b> modify the {@code previousState}.
103-
* <p>
104-
* NOTE: The indexes across the {@code currentState}, {@code previousState}, {@code propertyNames} and
105-
* {@code types} arrays match.
103+
*
104+
* @apiNote The indexes across the {@code currentState}, {@code previousState}, {@code propertyNames}, and
105+
* {@code types} arrays match.
106106
*
107107
* @param entity The entity instance detected as being dirty and being flushed
108108
* @param id The identifier of the entity
@@ -134,9 +134,9 @@ default boolean onFlushDirty(
134134
* Note that not all flushes end in actual synchronization with the database, in which case the
135135
* new {@code currentState} will be propagated to the object, but not necessarily (immediately) to
136136
* the database. It is strongly recommended that the interceptor <b>not</b> modify the {@code previousState}.
137-
* <p>
138-
* NOTE: The indexes across the {@code currentState}, {@code previousState}, {@code propertyNames} and
139-
* {@code types} arrays match.
137+
*
138+
* @apiNote The indexes across the {@code currentState}, {@code previousState}, {@code propertyNames}, and
139+
* {@code types} arrays match.
140140
*
141141
* @param entity The entity instance detected as being dirty and being flushed
142142
* @param id The identifier of the entity

hibernate-core/src/main/java/org/hibernate/PropertyAccessException.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import static org.hibernate.internal.util.StringHelper.qualify;
1010

11+
import org.checkerframework.checker.nullness.qual.Nullable;
12+
1113
/**
1214
* A problem occurred accessing a property of an instance of a
1315
* persistent class by reflection, or via enhanced entities.
@@ -38,7 +40,7 @@ public class PropertyAccessException extends HibernateException {
3840
* @param propertyName The name of the property.
3941
*/
4042
public PropertyAccessException(
41-
Throwable cause,
43+
@Nullable Throwable cause,
4244
String message,
4345
boolean wasSetter,
4446
Class<?> persistentClass,

hibernate-core/src/main/java/org/hibernate/PropertySetterAccessException.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
import java.util.Collection;
1010

11+
import org.hibernate.proxy.HibernateProxy;
12+
13+
import org.checkerframework.checker.nullness.qual.Nullable;
14+
1115
/**
1216
* @author Steve Ebersole
1317
*/
@@ -28,7 +32,7 @@ public PropertySetterAccessException(
2832
String propertyName,
2933
Class<?> expectedType,
3034
Object target,
31-
Object value) {
35+
@Nullable Object value) {
3236
super(
3337
cause,
3438
String.format(
@@ -47,7 +51,7 @@ public PropertySetterAccessException(
4751
}
4852

4953
public static String loggablePropertyValueString(Object value) {
50-
if ( value instanceof Collection ) {
54+
if ( value instanceof Collection || value instanceof HibernateProxy ) {
5155
return value.getClass().getSimpleName();
5256
}
5357
return value.toString();

hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataBuilderImpl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,6 @@ public MetadataBuildingOptionsImpl(StandardServiceRegistry serviceRegistry) {
659659
this.sharedCacheMode = configService.getSetting(
660660
AvailableSettings.JAKARTA_SHARED_CACHE_MODE,
661661
value -> {
662-
if ( value == null ) {
663-
return null;
664-
}
665-
666662
if ( value instanceof SharedCacheMode ) {
667663
return (SharedCacheMode) value;
668664
}

hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -417,18 +417,6 @@ public void orderColumns(boolean forceOrdering) {
417417
primaryKey.reorderColumns( primaryKeyColumns );
418418
}
419419
}
420-
for ( UniqueKey uniqueKey : table.getUniqueKeys().values() ) {
421-
if ( uniqueKey.getColumns().size() > 1 ) {
422-
final List<Column> uniqueKeyColumns = columnOrderingStrategy.orderConstraintColumns(
423-
uniqueKey,
424-
this
425-
);
426-
if ( uniqueKeyColumns != null ) {
427-
uniqueKey.getColumns().clear();
428-
uniqueKey.getColumns().addAll( uniqueKeyColumns );
429-
}
430-
}
431-
}
432420
for ( ForeignKey foreignKey : table.getForeignKeys().values() ) {
433421
final List<Column> columns = foreignKey.getColumns();
434422
if ( columns.size() > 1 ) {

hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,12 @@ protected void bindOneToManySecondPass(Map<String, PersistentClass> persistentCl
16581658
inheritanceStatePerClass
16591659
) );
16601660
foreignJoinColumns.setJoins( joins );
1661-
collection.setCollectionTable( foreignJoinColumns.getTable() );
1661+
if ( foreignJoinColumns.hasMappedBy() ) {
1662+
collection.setCollectionTable( associatedClass.getRecursiveProperty( foreignJoinColumns.getMappedBy() ).getValue().getTable() );
1663+
}
1664+
else {
1665+
collection.setCollectionTable( foreignJoinColumns.getTable() );
1666+
}
16621667
if ( LOG.isDebugEnabled() ) {
16631668
LOG.debugf( "Mapping collection: %s -> %s", collection.getRole(), collection.getCollectionTable().getName() );
16641669
}

hibernate-core/src/main/java/org/hibernate/boot/model/internal/OneToOneSecondPass.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private void bindTargetManyToOne(
208208
final KeyValue targetEntityIdentifier = targetEntity.getIdentifier();
209209
boolean referenceToPrimaryKey = mappedBy == null
210210
|| targetEntityIdentifier instanceof Component
211-
&& !( (Component) targetEntityIdentifier ).hasProperty( mappedBy );
211+
&& ( (Component) targetEntityIdentifier ).hasProperty( mappedBy );
212212
oneToOne.setReferenceToPrimaryKey( referenceToPrimaryKey );
213213

214214
final String propertyRef = oneToOne.getReferencedPropertyName();

0 commit comments

Comments
 (0)