Skip to content

Commit ce33b6a

Browse files
committed
HHH-19580 simplify forSchemaAndCatalog() to forCatalog()
1 parent 6cdf7d6 commit ce33b6a

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
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 such as {@link #populate()}.
22+
* functionality such as {@link #populate} and {@link #forSchema}.
2323
*
2424
* @since 6.2
2525
* @author Gavin King
@@ -97,6 +97,11 @@ public interface SchemaManager extends jakarta.persistence.SchemaManager {
9797

9898
/**
9999
* Obtain an instance which targets the given schema.
100+
* <p>
101+
* This is especially useful when using multiple schemas, for example in,
102+
* {@linkplain org.hibernate.cfg.MultiTenancySettings#MULTI_TENANT_SCHEMA_MAPPER
103+
* schema-based multitenancy}.
104+
*
100105
* @param schemaName The name of the schema to target
101106
*
102107
* @since 7.1
@@ -105,12 +110,12 @@ public interface SchemaManager extends jakarta.persistence.SchemaManager {
105110
SchemaManager forSchema(String schemaName);
106111

107112
/**
108-
* Obtain an instance which targets the given schema of the given catalog.
109-
* @param schemaName The name of the schema to target
113+
* Obtain an instance which targets the given catalog.
114+
*
110115
* @param catalogName The name of the catalog to target
111116
*
112117
* @since 7.1
113118
*/
114119
@Incubating
115-
SchemaManager forSchemaAndCatalog(String schemaName, String catalogName);
120+
SchemaManager forCatalog(String catalogName);
116121
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ public SchemaManagerImpl(
4747

4848
@Override
4949
public SchemaManager forSchema(String schemaName) {
50-
return new SchemaManagerImpl( sessionFactory, metadata, schemaName, null );
50+
return new SchemaManagerImpl( sessionFactory, metadata, schemaName, catalogName );
5151
}
5252

5353
@Override
54-
public SchemaManager forSchemaAndCatalog(String schemaName, String catalogName) {
54+
public SchemaManager forCatalog(String catalogName) {
5555
return new SchemaManagerImpl( sessionFactory, metadata, schemaName, catalogName );
5656
}
5757

0 commit comments

Comments
 (0)