Skip to content

Commit a4101f8

Browse files
committed
fix up the Javadoc for SessionFactoryImplementor
1 parent 97b11eb commit a4101f8

File tree

3 files changed

+108
-19
lines changed

3 files changed

+108
-19
lines changed

hibernate-core/src/main/java/org/hibernate/SessionFactory.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ public interface SessionFactory extends EntityManagerFactory, Referenceable, Ser
145145
String getJndiName();
146146

147147
/**
148-
* Obtain a {@linkplain SessionBuilder session builder} for creating
149-
* new {@link Session}s with certain customized options.
148+
* Obtain a {@linkplain org.hibernate.SessionBuilder session builder}
149+
* for creating new instances of {@link org.hibernate.Session} with
150+
* certain customized options.
150151
*
151152
* @return The session builder
152153
*/
@@ -456,6 +457,26 @@ default boolean containsFetchProfileDefinition(String name) {
456457
return getDefinedFilterNames().contains( name );
457458
}
458459

460+
/**
461+
* The name assigned to this {@code SessionFactory}, if any.
462+
* <ul>
463+
* <li>When bootstrapping via JPA, this is the persistence unit name.
464+
* <li>Otherwise, the name may be specified by the configuration property
465+
* {@value org.hibernate.cfg.PersistenceSettings#SESSION_FACTORY_NAME}.
466+
* </ul>
467+
* <p>
468+
* If {@value org.hibernate.cfg.PersistenceSettings#SESSION_FACTORY_NAME_IS_JNDI}
469+
* is enabled, then this name is used to bind this object to JNDI, unless
470+
* {@value org.hibernate.cfg.PersistenceSettings#SESSION_FACTORY_JNDI_NAME}
471+
* is also specified.
472+
*
473+
* @see org.hibernate.cfg.PersistenceSettings#SESSION_FACTORY_NAME
474+
* @see org.hibernate.cfg.PersistenceSettings#SESSION_FACTORY_NAME_IS_JNDI
475+
* @see jakarta.persistence.spi.PersistenceUnitInfo#getPersistenceUnitName
476+
*/
477+
@Override
478+
String getName();
479+
459480
/**
460481
* Get the {@linkplain SessionFactoryOptions options} used to build this factory.
461482
*

hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java

Lines changed: 83 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,14 @@
5252
*/
5353
public interface SessionFactoryImplementor extends MappingContext, SessionFactory {
5454
/**
55-
* Get the UUID for this {@code SessionFactory}.
55+
* The UUID assigned to this {@code SessionFactory}.
5656
* <p>
57-
* The value is generated as a {@link java.util.UUID}, but kept as a String.
58-
*
59-
* @return The UUID for this {@code SessionFactory}.
57+
* The value is generated as a {@link java.util.UUID}, but kept as a string.
6058
*
6159
* @see org.hibernate.internal.SessionFactoryRegistry#getSessionFactory
6260
*/
6361
String getUuid();
6462

65-
/**
66-
* Access to the name (if one) assigned to the {@code SessionFactory}
67-
*
68-
* @return The name for the {@code SessionFactory}
69-
*/
70-
@Override
71-
String getName();
72-
7363
/**
7464
* Overrides {@link SessionFactory#openSession()} to widen the return type:
7565
* this is useful for internal code depending on {@link SessionFactoryImplementor}
@@ -80,34 +70,65 @@ public interface SessionFactoryImplementor extends MappingContext, SessionFactor
8070
@Override
8171
SessionImplementor openSession();
8272

73+
/**
74+
* Obtain a {@linkplain org.hibernate.SessionBuilder session builder}
75+
* for creating new instances of {@link org.hibernate.Session} with
76+
* certain customized options.
77+
*/
8378
@Override
8479
SessionBuilderImplementor withOptions();
8580

8681
/**
87-
* Get a non-transactional "current" session (used by hibernate-envers)
82+
* Get a non-transactional "current" session.
83+
*
84+
* @apiNote This is used by {@code hibernate-envers}.
8885
*/
8986
SessionImplementor openTemporarySession();
9087

88+
/**
89+
* Obtain the {@link CacheImplementor}.
90+
*/
9191
@Override
9292
CacheImplementor getCache();
9393

94+
/**
95+
* Obtain the {@link StatisticsImplementor}.
96+
*/
9497
@Override
9598
StatisticsImplementor getStatistics();
9699

100+
/**
101+
* Obtain the {@link TypeConfiguration}
102+
*/
97103
TypeConfiguration getTypeConfiguration();
98104

105+
/**
106+
* Obtain the {@link RuntimeMetamodelsImplementor}
107+
*/
99108
RuntimeMetamodelsImplementor getRuntimeMetamodels();
100109

110+
/**
111+
* Obtain the {@link MappingMetamodelImplementor}
112+
*/
101113
default MappingMetamodelImplementor getMappingMetamodel() {
102114
return getRuntimeMetamodels().getMappingMetamodel();
103115
}
104116

117+
/**
118+
* Obtain the {@link JpaMetamodel}
119+
*/
105120
default JpaMetamodel getJpaMetamodel() {
106121
return getRuntimeMetamodels().getJpaMetamodel();
107122
}
108123

124+
/**
125+
* Obtain the {@link QueryEngine}
126+
*/
109127
QueryEngine getQueryEngine();
110128

129+
/**
130+
* Obtain the {@link SqlTranslationEngine}
131+
*/
111132
SqlTranslationEngine getSqlTranslationEngine();
112133

113134
/**
@@ -123,11 +144,14 @@ default JpaMetamodel getJpaMetamodel() {
123144
EventEngine getEventEngine();
124145

125146
/**
126-
* Retrieve fetch profile by name.
147+
* Retrieve a {@linkplain FetchProfile fetch profile} by name.
127148
*
128149
* @param name The name of the profile to retrieve.
129150
* @return The profile definition
151+
*
152+
* @deprecated Use {@link SqlTranslationEngine#getFetchProfile(String)}
130153
*/
154+
@Deprecated(since = "7.0", forRemoval = true)
131155
FetchProfile getFetchProfile(String name);
132156

133157
/**
@@ -138,62 +162,86 @@ default JpaMetamodel getJpaMetamodel() {
138162
@Deprecated(since = "7", forRemoval = true)
139163
Generator getGenerator(String rootEntityName);
140164

165+
/**
166+
* Obtain the {@link EntityNotFoundDelegate}
167+
*/
141168
EntityNotFoundDelegate getEntityNotFoundDelegate();
142169

170+
/**
171+
* Register a {@link SessionFactoryObserver} of this factory.
172+
*/
143173
void addObserver(SessionFactoryObserver observer);
144174

175+
/**
176+
* Obtain the {@link CustomEntityDirtinessStrategy}
177+
*/
145178
//todo make a Service ?
146179
CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy();
147180

181+
/**
182+
* Obtain the {@link CurrentTenantIdentifierResolver}
183+
*/
148184
//todo make a Service ?
149185
CurrentTenantIdentifierResolver<Object> getCurrentTenantIdentifierResolver();
150186

151187
/**
152-
* The java type to use for a tenant identifier.
188+
* The {@link JavaType} to use for a tenant identifier.
153189
*
154190
* @since 6.4
155191
*/
156192
JavaType<Object> getTenantIdentifierJavaType();
157193

158194
/**
159-
* Access to the event listener groups.
195+
* Access to the {@linkplain EventListenerGroups event listener groups}.
160196
*
161197
* @since 7.0
162198
*/
163199
@Internal @Incubating
164200
EventListenerGroups getEventListenerGroups();
165201

166202
/**
203+
* Obtain the {@link ParameterMarkerStrategy} service.
204+
*
167205
* @since 7.0
168206
*/
169207
@Incubating
170208
ParameterMarkerStrategy getParameterMarkerStrategy();
171209

172210
/**
211+
* Obtain the {@link JdbcServices} service.
212+
*
173213
* @since 7.0
174214
*/
175215
@Incubating
176216
JdbcValuesMappingProducerProvider getJdbcValuesMappingProducerProvider();
177217

178218
/**
219+
* Obtain the {@link EntityCopyObserverFactory} service.
220+
*
179221
* @since 7.0
180222
*/
181223
@Incubating
182224
EntityCopyObserverFactory getEntityCopyObserver();
183225

184226
/**
227+
* Obtain the {@link ClassLoaderService}.
228+
*
185229
* @since 7.0
186230
*/
187231
@Incubating
188232
ClassLoaderService getClassLoaderService();
189233

190234
/**
235+
* Obtain the {@link ManagedBeanRegistry} service.
236+
*
191237
* @since 7.0
192238
*/
193239
@Incubating
194240
ManagedBeanRegistry getManagedBeanRegistry();
195241

196242
/**
243+
* Obtain the {@link EventListenerRegistry} service.
244+
*
197245
* @since 7.0
198246
*/
199247
@Incubating
@@ -207,16 +255,35 @@ default JpaMetamodel getJpaMetamodel() {
207255
*/
208256
WrapperOptions getWrapperOptions();
209257

258+
/**
259+
* Get the {@linkplain SessionFactoryOptions options} used to build this factory.
260+
*/
210261
@Override
211262
SessionFactoryOptions getSessionFactoryOptions();
212263

264+
/**
265+
* Obtain the {@linkplain FilterDefinition definition of a filter} by name.
266+
*
267+
* @param filterName The name of a declared filter
268+
*/
213269
@Override
214270
FilterDefinition getFilterDefinition(String filterName);
215271

272+
/**
273+
* Obtain a collection of {@link FilterDefinition}s representing all the
274+
* {@linkplain org.hibernate.annotations.FilterDef#autoEnabled auto-enabled}
275+
* filters.
276+
*/
216277
Collection<FilterDefinition> getAutoEnabledFilters();
217278

279+
/**
280+
* Obtain the {@link JdbcServices} service.
281+
*/
218282
JdbcServices getJdbcServices();
219283

284+
/**
285+
* Obtain the {@link SqlStringGenerationContext}.
286+
*/
220287
SqlStringGenerationContext getSqlStringGenerationContext();
221288

222289
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

hibernate-core/src/main/java/org/hibernate/internal/FetchProfileHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ public static Map<String, FetchProfile> getFetchProfiles(
4242
return fetchProfiles;
4343
}
4444

45-
static void addFetchProfiles(MetadataImplementor bootMetamodel, RuntimeMetamodels runtimeMetamodels, Map<String, FetchProfile> fetchProfiles) {
45+
static void addFetchProfiles(
46+
MetadataImplementor bootMetamodel, RuntimeMetamodels runtimeMetamodels, Map<String, FetchProfile> fetchProfiles) {
4647
for ( org.hibernate.mapping.FetchProfile mappingProfile : bootMetamodel.getFetchProfiles() ) {
4748
final FetchProfile fetchProfile = createFetchProfile( runtimeMetamodels.getMappingMetamodel(), mappingProfile );
4849
fetchProfiles.put( fetchProfile.getName(), fetchProfile );

0 commit comments

Comments
 (0)