Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ additionally, drop the schema on `SessionFactory` shutdown

| `jakarta.persistence.sql-load-script-source`
| (Optional) The name of a SQL DML script to be executed

| `hibernate.hbm2ddl.import_files_sql_extractor`
| (Optional) If `multi-line`, SQL statements may be split across multiple lines in scripts, and must be ``;``-terminated.
|===

This feature is extremely useful for testing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,15 @@ public interface SchemaToolingSettings {
* <p>
* The correct extractor to use depends on the format of the SQL script:
* <ul>
* <li>if the script has one complete SQL statement per line, use
* <li>if the script has one complete SQL statement per line, use {@code single-line} or
* {@link org.hibernate.tool.schema.internal.script.SingleLineSqlScriptExtractor}, or
* <li>if a script contains statements spread over multiple lines, use
* <li>if a script contains statements spread over multiple lines, use {@code multi-line} or
* {@link org.hibernate.tool.schema.internal.script.MultiLineSqlScriptExtractor}.
* </ul>
*
* @settingDefault {@code org.hibernate.tool.schema.internal.script.SingleLineSqlScriptExtractor}.
*
* @see org.hibernate.tool.schema.spi.SqlScriptCommandExtractor
* @see org.hibernate.tool.schema.internal.script.SingleLineSqlScriptExtractor
* @see org.hibernate.tool.schema.internal.script.MultiLineSqlScriptExtractor
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@
import org.antlr.v4.runtime.misc.ParseCancellationException;

/**
* Class responsible for extracting SQL statements from import script. Supports instructions/comments and quoted
* strings spread over multiple lines. Each statement must end with semicolon.
* Class responsible for extracting SQL statements from an import script.
* Supports instructions/comments and quoted strings spread over multiple lines.
* Each statement must end with a semicolon.
*
* @author Lukasz Antoniak
* @author Steve Ebersole
*
* @see org.hibernate.cfg.SchemaToolingSettings#HBM2DDL_IMPORT_FILES_SQL_EXTRACTOR
*/
public class MultiLineSqlScriptExtractor implements SqlScriptCommandExtractor {
public static final String SHORT_NAME = "multi-line";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
import org.hibernate.tool.schema.spi.SqlScriptException;

/**
* Class responsible for extracting SQL statements from import script. Treats each line as a complete SQL statement.
* Comment lines shall start with {@code --}, {@code //} or {@code /*} character sequence.
* Class responsible for extracting SQL statements from an import script.
* Treats each line as a complete SQL statement.
* Comment lines must start with {@code --}, {@code //}, or {@code /*}.
*
* @author Lukasz Antoniak
* @author Steve Ebersole
*
* @see org.hibernate.cfg.SchemaToolingSettings#HBM2DDL_IMPORT_FILES_SQL_EXTRACTOR
*/
public class SingleLineSqlScriptExtractor implements SqlScriptCommandExtractor {
public static final String SHORT_NAME = "single-line";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@

/**
* Contract for extracting statements from source/import/init scripts.
* <p>
* A concrete implementation may be selected via
* {@value org.hibernate.cfg.SchemaToolingSettings#HBM2DDL_IMPORT_FILES_SQL_EXTRACTOR}.
*
* @author Lukasz Antoniak
*
* @see org.hibernate.cfg.AvailableSettings#HBM2DDL_IMPORT_FILES
* @see org.hibernate.cfg.AvailableSettings#JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE
* @see org.hibernate.cfg.AvailableSettings#JAKARTA_HBM2DDL_CREATE_SCRIPT_SOURCE
* @see org.hibernate.cfg.AvailableSettings#JAKARTA_HBM2DDL_DROP_SCRIPT_SOURCE
* @see org.hibernate.cfg.SchemaToolingSettings#HBM2DDL_IMPORT_FILES_SQL_EXTRACTOR
* @see org.hibernate.tool.schema.internal.script.SingleLineSqlScriptExtractor
* @see org.hibernate.tool.schema.internal.script.MultiLineSqlScriptExtractor
*
* @see org.hibernate.cfg.SchemaToolingSettings#HBM2DDL_IMPORT_FILES
* @see org.hibernate.cfg.SchemaToolingSettings#JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE
* @see org.hibernate.cfg.SchemaToolingSettings#JAKARTA_HBM2DDL_CREATE_SCRIPT_SOURCE
* @see org.hibernate.cfg.SchemaToolingSettings#JAKARTA_HBM2DDL_DROP_SCRIPT_SOURCE
*/
public interface SqlScriptCommandExtractor extends Service {
/**
Expand Down