Skip to content

Commit 6428b20

Browse files
authored
Merge branch 'main' into main
2 parents 9cf5ca0 + 76d6228 commit 6428b20

File tree

67 files changed

+2308
-1360
lines changed

Some content is hidden

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

67 files changed

+2308
-1360
lines changed

changelog.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,51 @@
11
Hibernate 7 Changelog
22
=======================
33

4+
Changes in 7.2.0.CR3 (November 25, 2025)
5+
------------------------------------------------------------------------------------------------------------------------
6+
7+
https://hibernate.atlassian.net/projects/HHH/versions/36014
8+
9+
10+
** Bug
11+
* HHH-19939 broken caching for MERGE and REFRESH load plans
12+
* HHH-19937 duplicate version check after refresh
13+
* HHH-19936 Parameter casts for by-id lookups don't take column definition into account
14+
* HHH-19932 NullPointerException in SqmInterpretationsKey::toString
15+
* HHH-19926 NullPointerException when executing JPQL IN clause with null parameter on entity association
16+
* HHH-19925 Locking root(s) should be based on select-clause, not from-clause
17+
* HHH-19924 Session#find with LockMode.UPGRADE_NOWAIT casues AssetionError when no entity with the provided id exists in the database
18+
* HHH-19922 org.hibernate.orm:hibernate-platform:pom:7.1.7.Final is missing
19+
* HHH-19918 Avoid reflection when instantiating known FormatMapper
20+
* HHH-19910 EntityInitializer#resolveInstance wrongly initializes existing detached instance
21+
* HHH-19906 JsonGeneratingVisitor#visit doesn't handle plural types correctly
22+
* HHH-19905 Implicit join re-use with nested inner and left joins causes ParsingException
23+
* HHH-19895 hibernate-core 6.6.30.Final breaks compatibility on entities with composite keys for multiple variants of DB2
24+
* HHH-19758 HQL parse failure with SLL can lead to wrong parse
25+
* HHH-19749 [Oracle] Merge with @SecondaryTable may generate invalid NUMERIC type casts
26+
* HHH-19739 Exceptions during load of entity with different persistent fields with same name
27+
* HHH-19240 Significant increase in heap allocation for queries after migrating Hibernate ORM 6.5 to 6.6
28+
* HHH-19038 Hibernate.get does not work on detached entities
29+
* HHH-18860 Updates on SecondaryTable cause incorrect cast for BigDecimal
30+
* HHH-16991 EnhancedUserType cannot be used when defining relations
31+
* HHH-14032 Locales with scripts are not round-tripped properly
32+
33+
** Deprecation
34+
* HHH-19941 deprecate Session.contains(String, Object)
35+
36+
** Improvement
37+
* HHH-19953 Relax scopes of methods in EntityInitializerImpl (for Hibernate Reactive)
38+
* HHH-19827 Apply the unified Hibernate Documentation theme
39+
40+
** New Feature
41+
* HHH-19931 SchemaManager.truncateTable()
42+
43+
** Task
44+
* HHH-19944 Upgrade MS SQL JDBC driver to remediate CVE-2025-59250
45+
* HHH-19940 Include maven plugin in the release staging directory
46+
* HHH-19921 Drop last JUnit 4 usages in Hibernate Envers
47+
* HHH-19916 More drop JUnit 4 usage work
48+
449
Note: Please refer to JIRA to learn more about each issue.
550

651
Changes in 7.2.0.CR2 (November 10, 2025)

ci/release/Jenkinsfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,9 @@ pipeline {
222222
withEnv([
223223
"DISABLE_REMOTE_GRADLE_CACHE=true"
224224
]) {
225-
def notesFiles = findFiles(glob: 'release_notes.md')
226-
if ( notesFiles.length < 1 ) {
227-
throw new IllegalStateException( "Could not locate `release_notes.md`" )
228-
}
229-
if ( notesFiles.length > 1 ) {
230-
throw new IllegalStateException( "Located more than 1 `release_notes.md`" )
231-
}
225+
def ghReleaseNote = sh(script: 'realpath -e release_notes.md 2>/dev/null', returnStdout: true).trim()
232226

233-
sh ".release/scripts/publish.sh -j --notes=${notesFiles[0].path} ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH} "
227+
sh ".release/scripts/publish.sh -j ${ghReleaseNote != '' ? '--notes=' + ghReleaseNote : ''} ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH} "
234228
}
235229
}
236230
}

hibernate-core/src/main/java/org/hibernate/annotations/NamedNativeQuery.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@
132132
*
133133
* @see org.hibernate.query.Query#setCacheMode(CacheMode)
134134
* @see org.hibernate.jpa.SpecHints#HINT_SPEC_CACHE_STORE_MODE
135+
*
136+
* @since 6.2
135137
*/
136138
CacheStoreMode cacheStoreMode() default CacheStoreMode.USE;
137139

@@ -140,6 +142,8 @@
140142
*
141143
* @see org.hibernate.query.Query#setCacheMode(CacheMode)
142144
* @see org.hibernate.jpa.SpecHints#HINT_SPEC_CACHE_RETRIEVE_MODE
145+
*
146+
* @since 6.2
143147
*/
144148
CacheRetrieveMode cacheRetrieveMode() default CacheRetrieveMode.USE;
145149

hibernate-core/src/main/java/org/hibernate/annotations/NamedQuery.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
* {@link EntityManager#createNamedQuery(String, Class)}.
5555
*
5656
* @see jakarta.persistence.NamedQuery#resultClass()
57+
*
58+
* @since 7.0
5759
*/
5860
Class<?> resultClass() default void.class;
5961

@@ -127,6 +129,8 @@
127129
*
128130
* @see org.hibernate.query.Query#setCacheStoreMode(CacheStoreMode)
129131
* @see org.hibernate.jpa.SpecHints#HINT_SPEC_CACHE_STORE_MODE
132+
*
133+
* @since 6.2
130134
*/
131135
CacheStoreMode cacheStoreMode() default CacheStoreMode.USE;
132136

@@ -135,6 +139,8 @@
135139
*
136140
* @see org.hibernate.query.Query#setCacheRetrieveMode(CacheRetrieveMode)
137141
* @see org.hibernate.jpa.SpecHints#HINT_SPEC_CACHE_RETRIEVE_MODE
142+
*
143+
* @since 6.2
138144
*/
139145
CacheRetrieveMode cacheRetrieveMode() default CacheRetrieveMode.USE;
140146

hibernate-core/src/main/java/org/hibernate/boot/BootLogging.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public interface BootLogging extends BasicLogger {
4545
@Message(id = 160101, value = "Duplicate generator name: '%s'")
4646
void duplicateGeneratorName(String name);
4747

48-
4948
@LogMessage(level = DEBUG)
5049
@Message(id = 160111, value = "Package not found or no package-info.java: %s")
5150
void packageNotFound(String packageName);
@@ -84,7 +83,6 @@ public interface BootLogging extends BasicLogger {
8483
@ManyToOne and @OneToOne associations mapped with @NotFound are forced to EAGER fetching""")
8584
void ignoreNotFoundWithFetchTypeLazy(String entity, String association);
8685

87-
// --- New typed TRACE/DEBUG messages for boot internals ---
8886
@LogMessage(level = TRACE)
8987
@Message(id = 160140, value = "Binding formula: %s")
9088
void bindingFormula(String formula);
@@ -449,4 +447,12 @@ public interface BootLogging extends BasicLogger {
449447
@LogMessage(level = DEBUG)
450448
@Message(id = 160244, value = "Skipping HBM processing of entity hierarchy [%s], as at least one entity [%s] has been processed")
451449
void skippingHbmProcessingOfEntityHierarchy(String rootEntityName, String processedEntity);
450+
451+
@LogMessage(level = WARN)
452+
@Message(id = 160245, value = "Association '%s' is 'mappedBy' another entity and should not specify a '@MapKeyColumn' (use '@MapKey' instead)")
453+
void mappedByShouldNotSpecifyMapKeyColumn(String associationPath);
454+
455+
@LogMessage(level = WARN)
456+
@Message(id = 160246, value = "Association '%s' is 'mappedBy' another entity and should not specify an '@OrderColumn' (use '@OrderBy' instead)")
457+
void mappedByShouldNotSpecifyOrderColumn(String associationPath);
452458
}

hibernate-core/src/main/java/org/hibernate/boot/MetadataSources.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ public MetadataSources(ServiceRegistry serviceRegistry, XmlMappingBinderAccess x
105105
// service registry really should be either BootstrapServiceRegistry or StandardServiceRegistry type...
106106
if ( !isExpectedServiceRegistryType( serviceRegistry ) ) {
107107
if ( BOOT_LOGGER.isDebugEnabled() ) {
108-
BOOT_LOGGER.unexpectedServiceRegistryType(
109-
serviceRegistry.getClass().getName()
110-
);
108+
BOOT_LOGGER.unexpectedServiceRegistryType( serviceRegistry.getClass().getName() );
111109
}
112110
}
113111
this.serviceRegistry = serviceRegistry;

hibernate-core/src/main/java/org/hibernate/boot/archive/internal/ArchiveHelper.java

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

1515
import org.hibernate.boot.archive.spi.ArchiveException;
1616

17+
import static org.hibernate.boot.BootLogging.BOOT_LOGGER;
18+
1719

1820
/**
1921
* Helper for dealing with archives
@@ -89,7 +91,7 @@ else if ( "zip".equals( protocol )
8991
"Unable to determine JAR Url from " + url + ". Cause: " + e.getMessage()
9092
);
9193
}
92-
org.hibernate.boot.BootLogging.BOOT_LOGGER.jarUrlFromUrlEntry( String.valueOf(url), String.valueOf(jarUrl) );
94+
BOOT_LOGGER.jarUrlFromUrlEntry( String.valueOf(url), String.valueOf(jarUrl) );
9395
return jarUrl;
9496
}
9597

hibernate-core/src/main/java/org/hibernate/boot/beanvalidation/BeanValidationEventListener.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.hibernate.boot.internal.ClassLoaderAccessImpl;
1414
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
1515
import org.hibernate.engine.spi.SessionFactoryImplementor;
16+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1617
import org.hibernate.event.spi.PreCollectionUpdateEvent;
1718
import org.hibernate.event.spi.PreCollectionUpdateEventListener;
1819
import org.hibernate.event.spi.PreDeleteEvent;
@@ -51,8 +52,9 @@ public class BeanValidationEventListener
5152
private final Validator validator;
5253
private final GroupsPerOperation groupsPerOperation;
5354

54-
public BeanValidationEventListener(
55-
ValidatorFactory factory, Map<String, Object> settings, ClassLoaderService classLoaderService) {
55+
private SessionFactoryImplementor sessionFactory;
56+
57+
public BeanValidationEventListener(ValidatorFactory factory, Map<String, Object> settings, ClassLoaderService classLoaderService) {
5658
traversableResolver = new HibernateTraversableResolver();
5759
validator =
5860
factory.usingContext()
@@ -63,9 +65,9 @@ public BeanValidationEventListener(
6365

6466
@Override
6567
public void sessionFactoryCreated(SessionFactory factory) {
66-
var implementor = factory.unwrap( SessionFactoryImplementor.class );
67-
implementor.getMappingMetamodel()
68-
.forEachEntityDescriptor( entityPersister -> traversableResolver.addPersister( entityPersister, implementor ) );
68+
sessionFactory = factory.unwrap( SessionFactoryImplementor.class );
69+
sessionFactory.getMappingMetamodel()
70+
.forEachEntityDescriptor( entityPersister -> traversableResolver.addPersister( entityPersister, sessionFactory ) );
6971
}
7072

7173
public boolean onPreInsert(PreInsertEvent event) {
@@ -110,11 +112,21 @@ public void onPreUpdateCollection(PreCollectionUpdateEvent event) {
110112
final Object entity = castNonNull( event.getCollection().getOwner() );
111113
validate(
112114
entity,
113-
event.getSession().getEntityPersister( event.getAffectedOwnerEntityName(), entity ),
115+
getEntityPersister( event.getSession(), event.getAffectedOwnerEntityName(), entity ),
114116
GroupsPerOperation.Operation.UPDATE
115117
);
116118
}
117119

120+
private EntityPersister getEntityPersister(SharedSessionContractImplementor session, String entityName, Object entity) {
121+
if ( session != null ) {
122+
return session.getEntityPersister( entityName, entity );
123+
}
124+
return entityName == null
125+
? sessionFactory.getMappingMetamodel().getEntityDescriptor( entity.getClass().getName() )
126+
: sessionFactory.getMappingMetamodel().getEntityDescriptor( entityName )
127+
.getSubclassEntityPersister( entity, sessionFactory );
128+
}
129+
118130
private <T> void validate(
119131
T object,
120132
EntityPersister persister,

hibernate-core/src/main/java/org/hibernate/boot/cfgxml/spi/LoadedConfig.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,11 @@ public static LoadedConfig consume(JaxbCfgHibernateConfiguration jaxbCfg) {
100100
final String eventTypeName = listenerGroup.getType().value();
101101
final var eventType = EventType.resolveEventTypeByName( eventTypeName );
102102
for ( var listener : listenerGroup.getListener() ) {
103-
if ( listener.getType() != null ) {
104-
BOOT_LOGGER.listenerDefinedAlsoDefinedEventType(
105-
listener.getClazz()
106-
);
107-
}
108-
cfg.addEventListener( eventType, listener.getClazz() );
103+
final String listenerClassName = listener.getClazz();
104+
if ( listener.getType() != null ) {
105+
BOOT_LOGGER.listenerDefinedAlsoDefinedEventType( listenerClassName );
106+
}
107+
cfg.addEventListener( eventType, listenerClassName );
109108
}
110109
}
111110
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ void injectJpaTempClassLoader(ClassLoader classLoader) {
318318

319319
void injectScanOptions(ScanOptions scanOptions) {
320320
if ( scanOptions != this.scanOptions ) {
321-
BOOT_LOGGER.injectingScanOptions(scanOptions, this.scanOptions);
321+
BOOT_LOGGER.injectingScanOptions( scanOptions, this.scanOptions );
322322
}
323323
this.scanOptions = scanOptions;
324324
}
@@ -332,7 +332,7 @@ void injectScanEnvironment(ScanEnvironment scanEnvironment) {
332332

333333
void injectScanner(Scanner scanner) {
334334
if ( scanner != this.scannerSetting ) {
335-
BOOT_LOGGER.injectingScanner( scanner, scannerSetting );
335+
BOOT_LOGGER.injectingScanner( scanner, this.scannerSetting );
336336
}
337337
this.scannerSetting = scanner;
338338
}

0 commit comments

Comments
 (0)