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,104 @@ 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
+
[[metamodel]]
260
+
=== Metamodel
261
+
262
+
`org.hibernate.Metamodel` has been removed in favor of `org.hibernate.metamodel.model.domain.JpaMetamodel`
263
+
264
+
265
+
[[session-by-natural-id]]
266
+
=== Session#byNaturalId
267
+
268
+
Both `NaturalIdLoadAccess#using(Map)` and `NaturalIdMultiLoadAccess#compoundValue()` have been removed in favor of `Map#of()`
269
+
270
+
271
+
[[removal-annotations]]
272
+
=== Annotations
273
+
274
+
* Removed `@Persister`
275
+
* Removed `@Proxy` - see <<proxy-annotation>>
276
+
* Removed `@SelectBeforeUpdate` - see <<flush-persist>>
277
+
* Removed `@DynamicInsert#value` and `@DynamicUpdate#value` - usage indicates true
278
+
* Removed `@Loader`
279
+
* Removed `@Table` -> use JPA `@Table`
280
+
* Removed `@Where` and `@WhereJoinTable` -> use `@SQLRestriction` or `@SQLJoinTableRestriction`
281
+
* Removed `@OrderBy` -> use `@SQLOrder` or JPA `@OrderBy`
282
+
* Removed `@ForeignKey` -> use JPA `@ForeignKey`
283
+
* Removed `@Index` -> use JPA `@Index`
284
+
* Removed `@IndexColumn` -> use JPA `@OrderColumn`
* Replaced uses of `CacheModeType` with `CacheMode`
289
+
* Removed `@Cache#include` -> use `@Cache#includeLazy`
290
+
* Removed `@TestForIssue` (for testing purposes) -> use `org.hibernate.testing.orm.junit.JiraKey` or `org.hibernate.testing.orm.junit.JiraKeyGroup`
291
+
292
+
293
+
[[proxy-annotation]]
294
+
=== Replace @Proxy
295
+
296
+
Applications will need to replace usages of the removed `@Proxy` annotation.
297
+
298
+
`@Proxy#proxyClass` has no direct replacement, but was also never needed/useful.
299
+
300
+
Here we focus on `@Proxy#lazy` attribute which, again, was hardly ever useful.
301
+
By default (true), Hibernate would proxy an entity when possible and when asked for.
302
+
"Asked for" includes calls to `Session#getReference` and lazy associations.
303
+
All such cases though are already controllable by the application.
304
+
305
+
* Instead of `Session#getReference`, use `Session#find`
306
+
* Use eager association fetching, for example,
307
+
** `FetchType.EAGER` (the default for to-one associations anyway), possibly combined with `@Fetch`,
308
+
** `EntityGraph`, or a
309
+
** `@FetchProfile`.
310
+
311
+
The effect can also often be mitigated using Hibernate's bytecode-based laziness (possibly combined with `@ConcreteProxy`).
312
+
313
+
314
+
[[misc-api]]
315
+
=== Miscellaneous
316
+
317
+
* Removed `SqmQualifiedJoin` - all joins are qualified.
318
+
* Removed `Session.LockRequest` - use `LockOptions` instead
319
+
223
320
224
321
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
225
322
// SPI changes
@@ -233,6 +330,37 @@ However, the preferred approach is to explicitly batch operations via `insertMul
233
330
234
331
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
332
333
+
[[integrator]]
334
+
=== Integrator
335
+
336
+
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)`
337
+
338
+
[[interceptor]]
339
+
=== Interceptor
340
+
341
+
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`.
342
+
343
+
* `Interceptor#onLoad`
344
+
* `Interceptor#onFlushDirty`
345
+
* `Interceptor#onSave`
346
+
* `Interceptor#onDelete`
347
+
* `Interceptor#onCollectionRecreate`
348
+
* `Interceptor#onCollectionRemove`
349
+
* `Interceptor#onCollectionUpdate`
350
+
* `Interceptor#findDirty`
351
+
* `Interceptor#getEntity`
352
+
353
+
Additionally, `EmptyInterceptor` was removed. As `org.hibernate.Interceptor` now uses default methods, one can simply implement `Interceptor` to the same end.
* 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
702
+
[[settings]]
703
+
=== Changes Related to Settings
646
704
647
705
* 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
709
671
710
[[pools]]
672
-
=== Connection Pools
711
+
== Connection Pools
673
712
674
713
Since Vibur and Proxool are no longer actively developed, support for these connection pools was removed.
675
714
676
715
As part of the effort to relicense, it also became necessary to drop support for UCP connection pool.
677
716
678
-
Use Agroal or HikariCP instead.
717
+
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