You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -219,7 +219,114 @@ However, the preferred approach is to explicitly batch operations via `insertMul
219
219
[[api-changes]]
220
220
== Changes to API
221
221
222
-
7.0 contains no changes to API, aside from some <<removals, removals>>.
222
+
A general theme in 7.0 has been to remove Hibernate-specific features that have a direct replacement in JPA.
223
+
224
+
[[session-load]]
225
+
=== Session#load
226
+
227
+
`Session#load` methods have been removed in favor of `Session#getReference` which has the same semantic.
228
+
229
+
[[session-refresh]]
230
+
=== Session#refresh
231
+
232
+
The forms of `Session#refresh` accepting an entity-name have been removed; the passed entity already indicates the entity-name (even with dynamic models).
All forms of `Session#save`, `Session#update`, `Session#saveOrUpdate` have been removed. See the discussion at <<flush-persist>>.
243
+
244
+
`Session#save`::
245
+
Removed in favor of `Session#persist`.
246
+
`Session#update`::
247
+
Removed in favor of `Session#merge`
248
+
`Session#saveOrUpdate`::
249
+
Removed in favor `#persist` if the entity is transient or `#merge` if the entity is detached
250
+
251
+
Relatedly, `org.hibernate.annotations.CascadeType#SAVE_UPDATE` has been removed in favor of `org.hibernate.annotations.CascadeType#PERSIST` and/or `org.hibernate.annotations.CascadeType#MERGE`
252
+
253
+
254
+
[[session-delete]]
255
+
=== Session#delete
256
+
257
+
`Session#delete` methods has been removed in favor of `Session#remove` (via `EntityManager`). Relatedly, `org.hibernate.annotations.CascadeType#DELETE` was removed in favor of `org.hibernate.annotations.CascadeType#REMOVE`
258
+
259
+
[[load-fetch-graphs]]
260
+
=== org.hibernate.graph Package
261
+
262
+
The `EntityGraph` API was enhanced in JPA 3.2, and made much more useful.
263
+
The incubating package `org.hibernate.graph` contains extensions to that API, which have been significantly impacted by the migration to JPA 3.2, and by the addition of new functionality.
264
+
Furthermore, some legacy operations were declared with incorrect generic type signatures (by both JPA, and by Hibernate).
265
+
266
+
This package has been significantly re-engineered, and the impact of this effort includes:
267
+
268
+
- some breaking changes to type signatures, and
269
+
- a number of deprecations of legacy operations which are now covered by JPA.
270
+
271
+
Also, a key subgraph now always refers to a `Map` key, and never to an entity id.
272
+
273
+
We encourage migration to the use of the new JPA-standard operations.
274
+
275
+
Or, alternatively, when building graphs, consider Hibernate's support for
276
+
textual link:{user-guide-url}#fetching-strategies-dynamic-fetching-entity-graph-parsing[graph parsing]. See also <<NamedEntityGraph>>.
277
+
278
+
279
+
[[removal-annotations]]
280
+
=== Annotations
281
+
282
+
* Removed `@Persister`
283
+
* Removed `@Proxy` - see <<proxy-annotation>>
284
+
* Removed `@SelectBeforeUpdate` - see <<flush-persist>>
285
+
* Removed `@DynamicInsert#value` and `@DynamicUpdate#value` - usage indicates true
286
+
* Removed `@Loader`
287
+
* Removed `@Table` -> use JPA `@Table`
288
+
* Removed `@Where` and `@WhereJoinTable` -> use `@SQLRestriction` or `@SQLJoinTableRestriction`
289
+
* Removed `@OrderBy` -> use `@SQLOrder` or JPA `@OrderBy`
290
+
* Removed `@ForeignKey` -> use JPA `@ForeignKey`
291
+
* Removed `@Index` -> use JPA `@Index`
292
+
* Removed `@IndexColumn` -> use JPA `@OrderColumn`
* Replaced uses of `CacheModeType` with `CacheMode`
297
+
* Removed `@Cache#include` -> use `@Cache#includeLazy`
298
+
* Removed `@TestForIssue` (for testing purposes) -> use `org.hibernate.testing.orm.junit.JiraKey` or `org.hibernate.testing.orm.junit.JiraKeyGroup`
299
+
300
+
301
+
[[proxy-annotation]]
302
+
=== Replace @Proxy
303
+
304
+
Applications will need to replace usages of the removed `@Proxy` annotation.
305
+
306
+
`@Proxy#proxyClass` has no direct replacement, but was also never needed/useful.
307
+
308
+
Here we focus on `@Proxy#lazy` attribute which, again, was hardly ever useful.
309
+
By default (true), Hibernate would proxy an entity when possible and when asked for.
310
+
"Asked for" includes calls to `Session#getReference` and lazy associations.
311
+
All such cases though are already controllable by the application.
312
+
313
+
* Instead of `Session#getReference`, use `Session#find`
314
+
* Use eager association fetching, for example,
315
+
** `FetchType.EAGER` (the default for to-one associations anyway), possibly combined with `@Fetch`,
316
+
** `EntityGraph`, or a
317
+
** `@FetchProfile`.
318
+
319
+
The effect can also often be mitigated using Hibernate's bytecode-based laziness (possibly combined with `@ConcreteProxy`).
320
+
321
+
322
+
[[misc-api]]
323
+
=== Miscellaneous
324
+
325
+
* Removed `org.hibernate.Metamodel` in favor of `org.hibernate.metamodel.model.domain.JpaMetamodel`
326
+
* Removed `SqmQualifiedJoin` - all joins are qualified.
327
+
* Both `NaturalIdLoadAccess#using(Map)` and `NaturalIdMultiLoadAccess#compoundValue()` have been removed in favor of `Map#of()`
328
+
* Removed `Session.LockRequest` - use `LockOptions` instead
329
+
223
330
224
331
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
225
332
// SPI changes
@@ -233,6 +340,37 @@ However, the preferred approach is to explicitly batch operations via `insertMul
233
340
234
341
The signature of the `Configurable#configure` method changed from accepting just a `ServiceRegistry` instance to the new `GeneratorCreationContext` interface, which exposes a lot more useful information when configuring the generator itself. The old signature has been deprecated for removal, so you should migrate any custom `Configurable` generator implementation to the new one. Or better yet, consider migrating to `@IdGeneratorType`.
235
342
343
+
[[integrator]]
344
+
=== Integrator
345
+
346
+
The previously deprecated method `org.hibernate.integrator.spi.Integrator#integrate(Metadata,SessionFactoryImplementor,SessionFactoryServiceRegistry)` have been removed in favor of its replacement `org.hibernate.integrator.spi.Integrator#integrate(Metadata,BootstrapContext,SessionFactoryImplementor)`
347
+
348
+
[[interceptor]]
349
+
=== Interceptor
350
+
351
+
Quite a few (again, previously deprecated) methods on `Interceptor` have been removed in favor of their replacement. This mainly deals with the change in expected Java type of identifiers (done in 6.0) from `Serializable` to `Object`.
352
+
353
+
* `Interceptor#onLoad`
354
+
* `Interceptor#onFlushDirty`
355
+
* `Interceptor#onSave`
356
+
* `Interceptor#onDelete`
357
+
* `Interceptor#onCollectionRecreate`
358
+
* `Interceptor#onCollectionRemove`
359
+
* `Interceptor#onCollectionUpdate`
360
+
* `Interceptor#findDirty`
361
+
* `Interceptor#getEntity`
362
+
363
+
Additionally, `EmptyInterceptor` was removed. As `org.hibernate.Interceptor` now uses default methods, one can simply implement `Interceptor` to the same end.
was removed in favor of `org.hibernate.metamodel.MappingMetmodel` or `org.hibernate.metamodel.model.domain.JpaMetamodel`
371
+
* Removed `AdditionalJaxbMappingProducer` in favor of `AdditionalMappingContributor`.
372
+
* Removed `MetadataContributor` in favor of `AdditionalMappingContributor`
373
+
236
374
237
375
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
238
376
// Changes in Behavior
@@ -323,21 +461,8 @@ This includes auto-applied converters.
323
461
To suppress the error for an auto-applied converter, use `@Convert(disableConversion=true)`.
324
462
325
463
326
-
[[load-fetch-graphs]]
327
-
=== org.hibernate.graph Package
328
464
329
-
The `EntityGraph` API was enhanced in JPA 3.2, and made much more useful.
330
-
The incubating package `org.hibernate.graph` contains extensions to that API, which have been significantly impacted by the migration to JPA 3.2, and by the addition of new functionality.
331
-
Furthermore, some legacy operations were declared with incorrect generic type signatures (by both JPA, and by Hibernate).
332
465
333
-
This package has been significantly re-engineered, and the impact of this effort includes:
334
-
335
-
- some breaking changes to type signatures, and
336
-
- a number of deprecations of legacy operations which are now covered by JPA.
337
-
338
-
Also, a key subgraph now always refers to a `Map` key, and never to an entity id.
339
-
340
-
We encourage migration to the use of the new JPA-standard operations.
341
466
342
467
[[create-query]]
343
468
=== Query with Implicit SELECT and No Explicit Result Type
@@ -571,109 +696,20 @@ However, MySQL treats a `char(1)` containing a single space as an empty string,
571
696
Now, `varchar(1)` is used by default.
572
697
573
698
574
-
575
-
576
-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
577
-
// Removals
578
-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
579
-
580
-
[[removals]]
581
-
== Removals
582
-
583
-
As this is a major release, a few things have been removed.
584
-
585
-
[[removal-annotations]]
586
-
=== Annotations
587
-
588
-
* Removed `@Persister`
589
-
* Removed `@Proxy` - see <<proxy-annotation>>
590
-
* Removed `@SelectBeforeUpdate` - see <<flush-persist>>
591
-
* Removed `@DynamicInsert#value` and `@DynamicUpdate#value`
592
-
* Removed `@Loader`
593
-
* Removed `@Table` -> use JPA `@Table`
594
-
* Removed `@Where` and `@WhereJoinTable` -> use `@SQLRestriction` or `@SQLJoinTableRestriction`
595
-
* Removed `@OrderBy` -> use `@SQLOrder` or JPA `@OrderBy`
596
-
* Removed `@ForeignKey` -> use JPA `@ForeignKey`
597
-
* Removed `@Index` -> use JPA `@Index`
598
-
* Removed `@IndexColumn` -> use JPA `@OrderColumn`
* Removed `Session.LockRequest` -> use `LockOptions`
614
-
* See also,
615
-
616
-
[[removal-methods]]
617
-
=== Methods
618
-
619
-
* Removed code related to save, update and saveOrUpdate - see <<flush-persist>>:
620
-
** Removed `Session.save` in favor of `Session.persist`
621
-
** Removed `Session.saveOrUpdate` in favor `persist` if the entity is transient or `merge` if the entity is detached
622
-
** Removed `Session.update` in favor of `Session.merge`
623
-
** Removed `org.hibernate.annotations.CascadeType.SAVE_UPDATE` in favor of `org.hibernate.annotations.CascadeType.PERSIST` + `org.hibernate.annotations.CascadeType.MERGE`
624
-
625
-
* Removed `Session.delete` in favor of `Session.remove`
626
-
* Removed `org.hibernate.annotations.CascadeType.DELETE` in favor of `org.hibernate.annotations.CascadeType.REMOVE`
627
-
* Removed `Session.load` in favor of `Session.find`
628
-
* Removed `Session.refresh(String entityName, Object object)` in favor of `Session.refresh(Object object)`
629
-
* Removed `Session.refresh(String entityName, Object object, LockOptions lockOptions)` in favor of `Session.refresh(Object object, LockOptions lockOptions)`
630
-
* Removed `org.hibernate.integrator.spi.Integrator.integrate(Metadata,SessionFactoryImplementor,SessionFactoryServiceRegistry)` in favor of `org.hibernate.integrator.spi.Integrator.integrate(Metadata,BootstrapContext,SessionFactoryImplementor)`
631
-
* Removed quite a few deprecated `Interceptor` in favor of their replacements:
632
-
** Removed `Interceptor.onLoad(Object, Serializable, Object[] , String[] , Type[] )` in favour of `Interceptor.onLoad(Object, Object, Object[], String[], Type[] )`
** Removed `Interceptor.onSave(Object, Serializable, Object[], String[], Type[])` in favour of `Interceptor.onSave(Object, Object, Object[], String[], Type[])`
635
-
** Removed `Interceptor.onDelete(Object, Serializable, Object[], String[], Type[])` in favour of `Interceptor.onDelete(Object, Serializable, Object[], String[], Type[])`
636
-
** Removed `Interceptor.onCollectionRecreate(Object, Serializable)` in favour of `Interceptor.onCollectionRecreate(Object, Object)`
637
-
** Removed `Interceptor.onCollectionRemove(Object, Serializable)` in favour of `Interceptor.onCollectionRemove(Object, Object)`
638
-
** Removed `Interceptor.onCollectionUpdate(Object, Serializable)` in favour of `Interceptor.onCollectionUpdate(Object, Object)`
639
-
** Removed `Interceptor.findDirty(Object, Serializable, Object[], Object[], String[], Type[])` in favour of `Interceptor.findDirty(Object, Object, Object[], Object[], String[], Type[])`
640
-
** Removed `Interceptor.getEntity(String, Serializable)` in favour of `Interceptor.getEntity(String, Serializable)`
641
-
* Removed `org.hibernate.metamodel.spi.MetamodelImplementor` in favor of `org.hibernate.metamodela.MappingMetmodel` or `org.hibernate.metamodel.model.domain.JpaMetamodel`
642
-
* Removed `org.hibernate.Metamodel` in favor of `org.hibernate.metamodel.model.domain.JpaMetamodel`
643
-
* Removed `NaturalIdLoadAccess.using(Map)` and `NaturalIdMultiLoadAccess.compoundValue()` in favor of `Map.of()`
644
-
645
-
=== Settings
699
+
[[settings]]
700
+
=== Changes Related to Settings
646
701
647
702
* Removed `hibernate.mapping.precedence` and friends
Applications will need to replace usages of the removed `@Proxy` annotation.
655
-
656
-
`@Proxy#proxyClass` has no direct replacement, but was also never needed/useful.
657
-
658
-
Here we focus on `@Proxy#lazy` attribute which, again, was hardly ever useful.
659
-
By default (true), Hibernate would proxy an entity when possible and when asked for.
660
-
"Asked for" includes calls to `Session#getReference` and lazy associations.
661
-
All such cases though are already controllable by the application.
662
-
663
-
* Instead of `Session#getReference`, use `Session#find`
664
-
* Use eager association fetching, for example,
665
-
** `FetchType.EAGER` (the default for to-one associations anyway), possibly combined with `@Fetch`,
666
-
** `EntityGraph`, or a
667
-
** `@FetchProfile`.
668
-
669
-
The effect can also often be mitigated using Hibernate's bytecode-based laziness (possibly combined with `@ConcreteProxy`).
670
706
671
707
[[pools]]
672
-
=== Connection Pools
708
+
== Connection Pools
673
709
674
710
Since Vibur and Proxool are no longer actively developed, support for these connection pools was removed.
675
711
676
712
As part of the effort to relicense, it also became necessary to drop support for UCP connection pool.
677
713
678
-
Use Agroal or HikariCP instead.
714
+
We recommend using Agroal or HikariCP instead; or implement the `ConnectionProvider` yourself to integrate with the Connection Pool of your choice (in fact other Connection Pools are known to ship implementations of the Hibernate `ConnectionProvider` already).
0 commit comments