Skip to content

Commit c847036

Browse files
jrenaatsebersole
authored andcommitted
HHH-17162 - Add a note on the bulk mutation strategies to the user guide
Signed-off-by: Jan Schatteman <[email protected]>
1 parent cc306ac commit c847036

File tree

1 file changed

+23
-4
lines changed
  • documentation/src/main/asciidoc/userguide/chapters/batch

1 file changed

+23
-4
lines changed

documentation/src/main/asciidoc/userguide/chapters/batch/Batching.adoc

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,14 @@ The temporary table can be either global or local, depending on the underlying d
386386
[[batch-bulk-hql-strategies-non-temporary-table]]
387387
===== Non-temporary table bulk mutation strategies
388388

389-
When the temporary table strategy can not be used because the database user lacks privilege to create temporary tables,
390-
the `InlineMutationStrategy` must be used.
389+
The strategies outlined above depend on the creation of temporary tables, which Hibernate creates on startup if they don't already exist. At present this process is not integrated in the schema management tooling, and this requires that the user have the required permissions to alter the database schema.
391390

392-
To use this strategy, you need to configure the following configuration property:
391+
If the Hibernate session user lacks these permissions, you will need to either:
392+
393+
* alter your schema through a different user with more permissions, to add a global temporary table named HTE_<root entity table name>, which contains all columns of all tables involved in the entity hierarchy. +
394+
This will allow insert, update and delete in HQL for multi-table entities.
395+
396+
* OR configure Hibernate ORM to use the (badly-performing) inline strategy (for _mutations_ only!):
393397

394398
[source,xml]
395399
----
@@ -398,7 +402,22 @@ To use this strategy, you need to configure the following configuration property
398402
/>
399403
----
400404

401-
Now, when running the previous test case, Hibernate generates the following SQL statements:
405+
[IMPORTANT]
406+
====
407+
We strongly recommend the use of the first option, i.e. manually adding the temporary tables, because the inline strategy is set to be removed in a future release. Also, there is no equivalent strategy for inserts.
408+
409+
Additionally, automatic creation of temporary tables should be deactivated. This is done by setting the
410+
411+
`hibernate.query.mutation_strategy.global_temporary.create_tables` and `hibernate.query.mutation_strategy.global_temporary.drop_tables`
412+
413+
*or*
414+
415+
`hibernate.query.mutation_strategy.persistent.create_tables` and `hibernate.query.mutation_strategy.persistent.drop_tables`
416+
417+
properties (depending on the default strategy for the dialect) to `false`
418+
====
419+
420+
With the inline strategy, when running the previous test case, Hibernate generates the following SQL statements:
402421

403422
[[batch-bulk-hql-InlineIdsInClauseBulkIdStrategy-delete-query-example]]
404423
.`InlineIdsInClauseBulkIdStrategy` delete entity query example

0 commit comments

Comments
 (0)