diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTableKind.java b/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTableKind.java index aeffd9529e..c77a58c206 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTableKind.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTableKind.java @@ -6,11 +6,40 @@ */ package org.hibernate.dialect.temptable; +import org.hibernate.dialect.Dialect; + /** - * @author Christian Beikov + * Classifies the kinds of temporary table implementations. + * + * @since 6.0 */ public enum TemporaryTableKind { + /** + * Modeled as a regular table with a special {@link TemporaryTableSessionUidColumn}, + * which is explicitly deleted from at the end of a transaction. + *
+ * The table is created once on application startup, unless {@link org.hibernate.query.sqm.mutation.internal.temptable.PersistentTableStrategy#CREATE_ID_TABLES} + * is disabled and dropped on application startup if {@link org.hibernate.query.sqm.mutation.internal.temptable.PersistentTableStrategy#CREATE_ID_TABLES} + * and {@link org.hibernate.query.sqm.mutation.internal.temptable.PersistentTableStrategy#DROP_ID_TABLES} aren't + * disabled. + */ PERSISTENT, + /** + * Modeled as what the SQL standard calls a local temporary table, which is a table that is defined per connection. + * Usually, the table is created when needed in a transaction and databases usually drop it on transaction commit, + * though it is possible to control if Hibernate should drop it explicitly through {@link Dialect#getTemporaryTableAfterUseAction()} + * and {@link org.hibernate.query.sqm.mutation.internal.temptable.LocalTemporaryTableStrategy#DROP_ID_TABLES}. + */ LOCAL, + /** + * Modeled as what the SQL standard calls a global temporary table, which is a table that is defined once per schema, + * but its data is scoped to a transaction where data is usually deleted automatically on transaction commit, + * though it is possible to control whether Hibernate should delete data or not through {@link Dialect#getTemporaryTableAfterUseAction()}. + *
+ * The table is created once on application startup, unless {@link org.hibernate.query.sqm.mutation.internal.temptable.GlobalTemporaryTableStrategy#CREATE_ID_TABLES} + * is disabled and dropped on application startup if {@link org.hibernate.query.sqm.mutation.internal.temptable.GlobalTemporaryTableStrategy#CREATE_ID_TABLES} + * and {@link org.hibernate.query.sqm.mutation.internal.temptable.GlobalTemporaryTableStrategy#DROP_ID_TABLES} aren't + * disabled. + */ GLOBAL; }