55package org .hibernate .relational .internal ;
66
77import org .hibernate .boot .spi .MetadataImplementor ;
8- import org .hibernate .cfg .AvailableSettings ;
98import org .hibernate .engine .spi .SessionFactoryImplementor ;
109import org .hibernate .relational .SchemaManager ;
1110import org .hibernate .tool .schema .Action ;
1716
1817import jakarta .persistence .SchemaValidationException ;
1918
19+ import static org .hibernate .cfg .MappingSettings .DEFAULT_CATALOG ;
20+ import static org .hibernate .cfg .MappingSettings .DEFAULT_SCHEMA ;
21+ import static org .hibernate .cfg .SchemaToolingSettings .JAKARTA_HBM2DDL_CREATE_SCHEMAS ;
22+ import static org .hibernate .cfg .SchemaToolingSettings .JAKARTA_HBM2DDL_DATABASE_ACTION ;
23+ import static org .hibernate .cfg .SchemaToolingSettings .JAKARTA_HBM2DDL_SCRIPTS_ACTION ;
24+
2025/**
2126 * Implementation of {@link SchemaManager}, backed by a {@link SessionFactoryImplementor}
2227 * and {@link SchemaManagementToolCoordinator}.
@@ -57,19 +62,19 @@ public SchemaManager forCatalog(String catalogName) {
5762
5863 private void addSchemaAndCatalog (Map <String , Object > properties ) {
5964 if ( schemaName != null ) {
60- properties .put ( AvailableSettings . DEFAULT_SCHEMA , schemaName );
65+ properties .put ( DEFAULT_SCHEMA , schemaName );
6166 }
6267 if ( catalogName != null ) {
63- properties .put ( AvailableSettings . DEFAULT_CATALOG , catalogName );
68+ properties .put ( DEFAULT_CATALOG , catalogName );
6469 }
6570 }
6671
6772 @ Override
6873 public void exportMappedObjects (boolean createSchemas ) {
6974 Map <String , Object > properties = new HashMap <>( sessionFactory .getProperties () );
70- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_DATABASE_ACTION , Action .CREATE_ONLY );
71- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_SCRIPTS_ACTION , Action .NONE );
72- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_CREATE_SCHEMAS , createSchemas );
75+ properties .put ( JAKARTA_HBM2DDL_DATABASE_ACTION , Action .CREATE_ONLY );
76+ properties .put ( JAKARTA_HBM2DDL_SCRIPTS_ACTION , Action .NONE );
77+ properties .put ( JAKARTA_HBM2DDL_CREATE_SCHEMAS , createSchemas );
7378 addSchemaAndCatalog ( properties );
7479 SchemaManagementToolCoordinator .process (
7580 metadata ,
@@ -82,9 +87,9 @@ public void exportMappedObjects(boolean createSchemas) {
8287 @ Override
8388 public void dropMappedObjects (boolean dropSchemas ) {
8489 Map <String , Object > properties = new HashMap <>( sessionFactory .getProperties () );
85- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_DATABASE_ACTION , Action .DROP );
86- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_SCRIPTS_ACTION , Action .NONE );
87- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_CREATE_SCHEMAS , dropSchemas );
90+ properties .put ( JAKARTA_HBM2DDL_DATABASE_ACTION , Action .DROP );
91+ properties .put ( JAKARTA_HBM2DDL_SCRIPTS_ACTION , Action .NONE );
92+ properties .put ( JAKARTA_HBM2DDL_CREATE_SCHEMAS , dropSchemas );
8893 addSchemaAndCatalog ( properties );
8994 SchemaManagementToolCoordinator .process (
9095 metadata ,
@@ -97,9 +102,9 @@ public void dropMappedObjects(boolean dropSchemas) {
97102 @ Override
98103 public void validateMappedObjects () {
99104 Map <String , Object > properties = new HashMap <>( sessionFactory .getProperties () );
100- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_DATABASE_ACTION , Action .VALIDATE );
101- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_SCRIPTS_ACTION , Action .NONE );
102- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_CREATE_SCHEMAS , false );
105+ properties .put ( JAKARTA_HBM2DDL_DATABASE_ACTION , Action .VALIDATE );
106+ properties .put ( JAKARTA_HBM2DDL_SCRIPTS_ACTION , Action .NONE );
107+ properties .put ( JAKARTA_HBM2DDL_CREATE_SCHEMAS , false );
103108 addSchemaAndCatalog ( properties );
104109 SchemaManagementToolCoordinator .process (
105110 metadata ,
@@ -112,8 +117,8 @@ public void validateMappedObjects() {
112117 @ Override
113118 public void truncateMappedObjects () {
114119 Map <String , Object > properties = new HashMap <>( sessionFactory .getProperties () );
115- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_DATABASE_ACTION , Action .TRUNCATE );
116- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_SCRIPTS_ACTION , Action .NONE );
120+ properties .put ( JAKARTA_HBM2DDL_DATABASE_ACTION , Action .TRUNCATE );
121+ properties .put ( JAKARTA_HBM2DDL_SCRIPTS_ACTION , Action .NONE );
117122 addSchemaAndCatalog ( properties );
118123 SchemaManagementToolCoordinator .process (
119124 metadata ,
@@ -126,8 +131,8 @@ public void truncateMappedObjects() {
126131 @ Override
127132 public void populate () {
128133 Map <String , Object > properties = new HashMap <>( sessionFactory .getProperties () );
129- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_DATABASE_ACTION , Action .POPULATE );
130- properties .put ( AvailableSettings . JAKARTA_HBM2DDL_SCRIPTS_ACTION , Action .NONE );
134+ properties .put ( JAKARTA_HBM2DDL_DATABASE_ACTION , Action .POPULATE );
135+ properties .put ( JAKARTA_HBM2DDL_SCRIPTS_ACTION , Action .NONE );
131136 addSchemaAndCatalog ( properties );
132137 SchemaManagementToolCoordinator .process (
133138 metadata ,
0 commit comments