Skip to content

Commit bc3e83f

Browse files
committed
optimize some imports
1 parent d79b3aa commit bc3e83f

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

hibernate-core/src/main/java/org/hibernate/relational/internal/SchemaManagerImpl.java

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package org.hibernate.relational.internal;
66

77
import org.hibernate.boot.spi.MetadataImplementor;
8-
import org.hibernate.cfg.AvailableSettings;
98
import org.hibernate.engine.spi.SessionFactoryImplementor;
109
import org.hibernate.relational.SchemaManager;
1110
import org.hibernate.tool.schema.Action;
@@ -17,6 +16,12 @@
1716

1817
import 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,

hibernate-core/src/main/java/org/hibernate/result/internal/OutputsImpl.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
import org.hibernate.JDBCException;
1616
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
17-
import org.hibernate.event.monitor.spi.EventMonitor;
18-
import org.hibernate.event.monitor.spi.DiagnosticEvent;
1917
import org.hibernate.internal.CoreLogging;
2018
import org.hibernate.procedure.internal.ProcedureCallImpl;
2119
import org.hibernate.result.Output;
@@ -67,8 +65,8 @@ protected void executeStatement() {
6765
executeStartNanos = System.nanoTime();
6866
}
6967
final var session = context.getSession();
70-
final EventMonitor eventMonitor = session.getEventMonitor();
71-
final DiagnosticEvent jdbcPreparedStatementExecutionEvent =
68+
final var eventMonitor = session.getEventMonitor();
69+
final var jdbcPreparedStatementExecutionEvent =
7270
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
7371
try {
7472
final boolean isResultSet = jdbcStatement.execute();

0 commit comments

Comments
 (0)