Skip to content

Commit c4f5982

Browse files
committed
javadoc improvements around data population
1 parent 3c336f9 commit c4f5982

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

hibernate-core/src/main/java/org/hibernate/cfg/SchemaToolingSettings.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,19 @@ public interface SchemaToolingSettings {
9191
* Specifies the CREATE script file as either a {@link java.io.Reader} configured for reading
9292
* the DDL script file or a string designating a file {@link java.net.URL} for the DDL script.
9393
* <p>
94-
* Hibernate historically also accepted {@link #HBM2DDL_IMPORT_FILES} for a similar purpose.
95-
* This setting is now preferred.
94+
* The script should contain mostly DDL {@code CREATE} statements. For importing data using DML,
95+
* use {@link #JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE}.
9696
*
9797
* @see #JAKARTA_HBM2DDL_CREATE_SOURCE
98-
* @see #HBM2DDL_IMPORT_FILES
98+
* @see #JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE
9999
*/
100100
String JAKARTA_HBM2DDL_CREATE_SCRIPT_SOURCE = "jakarta.persistence.schema-generation.create-script-source";
101101

102102
/**
103103
* Specifies the DROP script file as either a {@link java.io.Reader} configured for reading
104104
* the DDL script file or a string designating a file {@link java.net.URL} for the DDL script.
105+
* <p>
106+
* The script should contain mostly DDL {@code DROP} statements.
105107
*
106108
* @see #JAKARTA_HBM2DDL_DROP_SOURCE
107109
*/
@@ -129,10 +131,23 @@ public interface SchemaToolingSettings {
129131

130132
/**
131133
* JPA-standard variant of {@link #HBM2DDL_IMPORT_FILES} for specifying a database
132-
* initialization script to be run as part of schema-export
134+
* initialization script to be run after {@linkplain org.hibernate.relational.SchemaManager
135+
* exporting or truncating the database schema}.
133136
* <p>
134137
* Specifies a {@link java.io.Reader} configured for reading of the SQL load script
135138
* or a string designating the {@link java.net.URL} for the SQL load script.
139+
* <p>
140+
* The script should contain mostly DML {@code INSERT} statements. For DDL schema creation,
141+
* use {@link #JAKARTA_HBM2DDL_CREATE_SCRIPT_SOURCE}
142+
* <p>
143+
* Hibernate historically also accepted {@link #HBM2DDL_IMPORT_FILES} for a similar purpose.
144+
* This setting is now preferred.
145+
*
146+
* @see #JAKARTA_HBM2DDL_DATABASE_ACTION
147+
* @see #JAKARTA_HBM2DDL_CREATE_SCRIPT_SOURCE
148+
* @see org.hibernate.relational.SchemaManager#populate
149+
* @see org.hibernate.relational.SchemaManager#exportMappedObjects
150+
* @see org.hibernate.relational.SchemaManager#truncateMappedObjects
136151
*/
137152
String JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE = "jakarta.persistence.sql-load-script-source";
138153

hibernate-core/src/main/java/org/hibernate/relational/SchemaManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@
1919
* {@link jakarta.persistence.SchemaManager}, which it now inherits,
2020
* with a minor change to the naming of its operations. It is retained
2121
* for backward compatibility and as a place to define additional
22-
* functionality in the future.
22+
* functionality such as {@link #populate()}.
2323
*
2424
* @since 6.2
2525
* @author Gavin King
2626
*/
2727
@Incubating
2828
public interface SchemaManager extends jakarta.persistence.SchemaManager {
2929
/**
30-
* Export database objects mapped by Hibernate entities.
30+
* Export database objects mapped by Hibernate entities, and then
31+
* import initial data from {@code /import.sql} and any other configured
32+
* {@linkplain org.hibernate.cfg.AvailableSettings#JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE
33+
* load script}.
3134
* <p>
3235
* Programmatic way to run {@link org.hibernate.tool.schema.spi.SchemaCreator}.
3336
*
@@ -81,6 +84,8 @@ public interface SchemaManager extends jakarta.persistence.SchemaManager {
8184
* Programmatic way to run {@link org.hibernate.tool.schema.spi.SchemaPopulator}.
8285
*
8386
* @since 7.0
87+
*
88+
* @see org.hibernate.cfg.AvailableSettings#JAKARTA_HBM2DDL_LOAD_SCRIPT_SOURCE
8489
*/
8590
@Incubating
8691
void populate();

0 commit comments

Comments
 (0)