diff --git a/gradle/published-java-module.gradle b/gradle/published-java-module.gradle index 175725e8a1..0c3bc64b42 100644 --- a/gradle/published-java-module.gradle +++ b/gradle/published-java-module.gradle @@ -100,6 +100,7 @@ javadoc { 'http://docs.jboss.org/cdi/api/2.0/', 'https://javaee.github.io/javaee-spec/javadocs/' ] + tags = [ "apiNote", 'implSpec', 'implNote', 'todo' ] if ( JavaVersion.current().isJava11Compatible() ) { //The need to set `--source 1.8` applies to all JVMs after 11, and also to 11 diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index 003521caf2..a85142fe82 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -454,4 +454,3 @@ task testJavassist(type: Test) { check.dependsOn testJavassist testJavassist.mustRunAfter test - diff --git a/hibernate-core/src/main/java/org/hibernate/BasicQueryContract.java b/hibernate-core/src/main/java/org/hibernate/BasicQueryContract.java index 9042ec5af1..a8fa7dc031 100644 --- a/hibernate-core/src/main/java/org/hibernate/BasicQueryContract.java +++ b/hibernate-core/src/main/java/org/hibernate/BasicQueryContract.java @@ -83,7 +83,7 @@ public interface BasicQueryContract { T setCacheMode(CacheMode cacheMode); /** - * Are the results of this query eligible for second level query caching? This is different that second level + * Are the results of this query eligible for second level query caching? This is different than second level * caching of any returned entities and collections. * * NOTE: the query being "eligible" for caching does not necessarily mean its results will be cached. Second level @@ -156,7 +156,7 @@ public interface BasicQueryContract { /** * Obtain the JDBC fetch size hint in effect for this query. This value is eventually passed along to the JDBC - * query via {@link java.sql.Statement#setFetchSize(int)}. As defined b y JDBC, this value is a hint to the + * query via {@link java.sql.Statement#setFetchSize(int)}. As defined by JDBC, this value is a hint to the * driver to indicate how many rows to fetch from the database when more rows are needed. * * NOTE : JDBC expressly defines this value as a hint. It may or may not have any effect on the actual diff --git a/hibernate-core/src/main/java/org/hibernate/CustomEntityDirtinessStrategy.java b/hibernate-core/src/main/java/org/hibernate/CustomEntityDirtinessStrategy.java index a9ddcf9b79..3ee645c21d 100644 --- a/hibernate-core/src/main/java/org/hibernate/CustomEntityDirtinessStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/CustomEntityDirtinessStrategy.java @@ -41,7 +41,7 @@ public interface CustomEntityDirtinessStrategy { * @param persister The persister corresponding to the given entity * @param session The session from which this check originates. * - * @return {@code true} indicates the entity is dirty; {@link false} indicates the entity is not dirty. + * @return {@code true} indicates the entity is dirty; {@code false} indicates the entity is not dirty. */ public boolean isDirty(Object entity, EntityPersister persister, Session session); diff --git a/hibernate-core/src/main/java/org/hibernate/Hibernate.java b/hibernate-core/src/main/java/org/hibernate/Hibernate.java index a08cee7acc..ff12828e3e 100644 --- a/hibernate-core/src/main/java/org/hibernate/Hibernate.java +++ b/hibernate-core/src/main/java/org/hibernate/Hibernate.java @@ -47,7 +47,7 @@ public final class Hibernate { /** * Force initialization of a proxy or persistent collection. *

- * Note: This only ensures intialization of a proxy object or collection; + * Note: This only ensures initialization of a proxy object or collection; * it is not guaranteed that the elements INSIDE the collection will be initialized/materialized. * * @param proxy a persistable object, proxy, persistent collection or null diff --git a/hibernate-core/src/main/java/org/hibernate/MappingException.java b/hibernate-core/src/main/java/org/hibernate/MappingException.java index e45b8fbc50..ceb7ed9a5d 100644 --- a/hibernate-core/src/main/java/org/hibernate/MappingException.java +++ b/hibernate-core/src/main/java/org/hibernate/MappingException.java @@ -7,7 +7,7 @@ package org.hibernate; /** - * An exception that occurs while reading mapping sources (xml/annotations),usually as a result of something + * An exception that occurs while reading mapping sources (xml/annotations), usually as a result of something * screwy in the O-R mappings. * * @author Gavin King diff --git a/hibernate-core/src/main/java/org/hibernate/SessionFactory.java b/hibernate-core/src/main/java/org/hibernate/SessionFactory.java index aac54ae031..074935eeb1 100644 --- a/hibernate-core/src/main/java/org/hibernate/SessionFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/SessionFactory.java @@ -208,7 +208,7 @@ public interface SessionFactory extends EntityManagerFactory, HibernateEntityMan } /** - * Retrieve the statistics fopr this factory. + * Retrieve the statistics for this factory. * * @return The statistics. */ diff --git a/hibernate-core/src/main/java/org/hibernate/SessionFactoryObserver.java b/hibernate-core/src/main/java/org/hibernate/SessionFactoryObserver.java index d4aaf98831..776f41b96b 100644 --- a/hibernate-core/src/main/java/org/hibernate/SessionFactoryObserver.java +++ b/hibernate-core/src/main/java/org/hibernate/SessionFactoryObserver.java @@ -24,7 +24,7 @@ public interface SessionFactoryObserver extends Serializable { } /** - * Callback to indicate that the given factory is about close. The passed factory reference should be usable + * Callback to indicate that the given factory is about to close. The passed factory reference should be usable * since it is only about to close. *

* NOTE : defined as default to allow for existing SessionFactoryObserver impls to work diff --git a/hibernate-core/src/main/java/org/hibernate/StaleStateException.java b/hibernate-core/src/main/java/org/hibernate/StaleStateException.java index 8a44fab2d2..85d8c91bfd 100755 --- a/hibernate-core/src/main/java/org/hibernate/StaleStateException.java +++ b/hibernate-core/src/main/java/org/hibernate/StaleStateException.java @@ -8,7 +8,7 @@ package org.hibernate; /** * Thrown when a version number or timestamp check failed, indicating that the Session contained - * stale data (when using long transactions with versioning). Also occurs if we try delete or update + * stale data (when using long transactions with versioning). Also occurs if we try to delete or update * a row that does not exist. * * Note that this exception often indicates that the user failed to specify the correct diff --git a/hibernate-core/src/main/java/org/hibernate/UnknownEntityTypeException.java b/hibernate-core/src/main/java/org/hibernate/UnknownEntityTypeException.java index 7249e3de5c..0de3f12cd5 100644 --- a/hibernate-core/src/main/java/org/hibernate/UnknownEntityTypeException.java +++ b/hibernate-core/src/main/java/org/hibernate/UnknownEntityTypeException.java @@ -10,7 +10,7 @@ package org.hibernate; * Indicates an attempt was made to refer to an unknown entity name/class. *

* NOTE : extends MappingException because that's what core used to do and that's how - * HEM expectes it. Longer term I think it makes more sense to have a different + * HEM expects it. Longer term I think it makes more sense to have a different * hierarchy for runtime-"mapping" exceptions. * * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java index aa83df78a4..0c978fc9dd 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java @@ -59,7 +59,7 @@ public final class EntityUpdateAction extends EntityAction { * @param previousVersion The previous (stored) version * @param nextVersion The incremented version * @param instance The entity instance - * @param rowId The entity's rowid + * @param rowId The entity's row id * @param persister The entity's persister * @param session The session */ @@ -127,12 +127,12 @@ public final class EntityUpdateAction extends EntityAction { // multiple actions queued during the same flush previousVersion = persister.getVersion( instance ); } - + final Object ck; if ( persister.canWriteToCache() ) { final EntityDataAccess cache = persister.getCacheAccessStrategy(); ck = cache.generateCacheKey( - id, + id, persister, factory, session.getTenantIdentifier() @@ -144,16 +144,16 @@ public final class EntityUpdateAction extends EntityAction { } if ( !veto ) { - persister.update( - id, - state, - dirtyFields, - hasDirtyCollection, - previousState, - previousVersion, - instance, - rowId, - session + persister.update( + id, + state, + dirtyFields, + hasDirtyCollection, + previousState, + previousVersion, + instance, + rowId, + session ); } @@ -161,7 +161,7 @@ public final class EntityUpdateAction extends EntityAction { if ( entry == null ) { throw new AssertionFailure( "possible nonthreadsafe access to session" ); } - + if ( entry.getStatus()==Status.MANAGED || persister.isVersionPropertyGenerated() ) { // get the updated snapshot of the entity state by cloning current state; // it is safe to copy in place, since by this time no-one else (should have) @@ -324,7 +324,7 @@ public final class EntityUpdateAction extends EntityAction { persister, factory, session.getTenantIdentifier() - + ); if ( success && diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/UnresolvedEntityInsertActions.java b/hibernate-core/src/main/java/org/hibernate/action/internal/UnresolvedEntityInsertActions.java index 6020cfa986..cdb0eb2276 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/UnresolvedEntityInsertActions.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/UnresolvedEntityInsertActions.java @@ -280,7 +280,7 @@ public class UnresolvedEntityInsertActions { } /** - * Deerialize a {@link UnresolvedEntityInsertActions} object. + * Deserialize an {@link UnresolvedEntityInsertActions} object. * * @param ois - the input stream. * @param session - the session. diff --git a/hibernate-core/src/main/java/org/hibernate/action/spi/package-info.java b/hibernate-core/src/main/java/org/hibernate/action/spi/package-info.java index b5cdf1fb62..7af5a2aab4 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/spi/package-info.java +++ b/hibernate-core/src/main/java/org/hibernate/action/spi/package-info.java @@ -7,6 +7,6 @@ /** * Defines SPI hooks into the {@link org.hibernate.engine.spi.ActionQueue}. Mainly for registering custom - * {@link AfterTransactionCompletionProcess} and {@link BeforeTransactionCompletionProcess} hooks. + * {@link org.hibernate.action.spi.AfterTransactionCompletionProcess} and {@link org.hibernate.action.spi.BeforeTransactionCompletionProcess} hooks. */ package org.hibernate.action.spi; diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/CacheConcurrencyStrategy.java b/hibernate-core/src/main/java/org/hibernate/annotations/CacheConcurrencyStrategy.java index a626208bb9..1252e785d9 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/CacheConcurrencyStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/CacheConcurrencyStrategy.java @@ -71,7 +71,7 @@ public enum CacheConcurrencyStrategy { if ( null == accessType ) { return NONE; } - + switch ( accessType ) { case READ_ONLY: { return READ_ONLY; diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/DiscriminatorOptions.java b/hibernate-core/src/main/java/org/hibernate/annotations/DiscriminatorOptions.java index 14433bc6d6..341e52e563 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/DiscriminatorOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/DiscriminatorOptions.java @@ -13,7 +13,7 @@ import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** - * Optional annotation to express Hibernate specific discrimintor properties. + * Optional annotation to express Hibernate specific discriminator properties. * * @author Hardy Ferentschik */ diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/Filter.java b/hibernate-core/src/main/java/org/hibernate/annotations/Filter.java index 1e20bf8f5a..811d53db19 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/Filter.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/Filter.java @@ -40,7 +40,7 @@ public @interface Filter { /** * If true, automatically determine all points within the condition fragment that an alias should be injected. * Otherwise, injection will only replace instances of explicit "{alias}" instances or - * @SqlFragmentAlias descriptors. + * {@link SqlFragmentAlias} descriptors. */ boolean deduceAliasInjectionPoints() default true; diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/FlushModeType.java b/hibernate-core/src/main/java/org/hibernate/annotations/FlushModeType.java index 0f092abdde..ae39fb2f7f 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/FlushModeType.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/FlushModeType.java @@ -25,8 +25,6 @@ public enum FlushModeType { */ COMMIT, /** - * Corresponds to {@link org.hibernate.FlushMode#NEVER}. - * * @deprecated use MANUAL, will be removed in a subsequent release */ @Deprecated diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/ManyToAny.java b/hibernate-core/src/main/java/org/hibernate/annotations/ManyToAny.java index 5e24f340a7..aac5ede2d8 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/ManyToAny.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/ManyToAny.java @@ -34,7 +34,7 @@ public @interface ManyToAny { String metaDef() default ""; /** - * Metadata dicriminator column description, This column will hold the meta value corresponding to the + * Metadata discriminator column description, This column will hold the meta value corresponding to the * targeted entity. */ Column metaColumn(); diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/OptimisticLock.java b/hibernate-core/src/main/java/org/hibernate/annotations/OptimisticLock.java index 97c5286594..ed66782f51 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/OptimisticLock.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/OptimisticLock.java @@ -12,7 +12,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Whether or not a change of the annotated property will trigger a entity version increment. + * Whether or not a change of the annotated property will trigger an entity version increment. * * If the annotation is not present, the property is involved in the optimistic lock strategy (default). * diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/QueryHints.java b/hibernate-core/src/main/java/org/hibernate/annotations/QueryHints.java index b30efee16d..f48fe30592 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/QueryHints.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/QueryHints.java @@ -103,11 +103,11 @@ public class QueryHints { * Accepts a {@link javax.persistence.LockModeType} or a {@link org.hibernate.LockMode} */ public static final String NATIVE_LOCKMODE = "org.hibernate.lockMode"; - + /** * Hint providing a "fetchgraph" EntityGraph. Attributes explicitly specified as AttributeNodes are treated as * FetchType.EAGER (via join fetch or subsequent select). - * + * * Note: Currently, attributes that are not specified are treated as FetchType.LAZY or FetchType.EAGER depending * on the attribute's definition in metadata, rather than forcing FetchType.LAZY. * @@ -115,7 +115,7 @@ public class QueryHints { */ @Deprecated public static final String FETCHGRAPH = GraphSemantic.FETCH.getJpaHintName(); - + /** * Hint providing a "loadgraph" EntityGraph. Attributes explicitly specified as AttributeNodes are treated as * FetchType.EAGER (via join fetch or subsequent select). Attributes that are not specified are treated as @@ -129,7 +129,7 @@ public class QueryHints { /** * Hint to enable/disable the follow-on-locking mechanism provided by {@link org.hibernate.dialect.Dialect#useFollowOnLocking(QueryParameters)}. * A value of {@code true} enables follow-on-locking, whereas a value of {@code false} disables it. - * If the value is {@code null}, the the {@code Dialect} strategy is going to be used instead. + * If the value is {@code null}, the {@code Dialect} strategy is going to be used instead. * * @since 5.2 */ diff --git a/hibernate-core/src/main/java/org/hibernate/boot/Metadata.java b/hibernate-core/src/main/java/org/hibernate/boot/Metadata.java index fb2a3019e4..4c1358a9b1 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/Metadata.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/Metadata.java @@ -39,7 +39,7 @@ import org.hibernate.query.sqm.function.SqmFunctionDescriptor; */ public interface Metadata extends Mapping { /** - * Get the builder for {@link org.hibernate.SessionFactory} instances based on this metamodel, + * Get the builder for {@link org.hibernate.SessionFactory} instances based on this metamodel. * * @return The builder for {@link org.hibernate.SessionFactory} instances. */ @@ -68,7 +68,7 @@ public interface Metadata extends Mapping { Database getDatabase(); /** - * Retrieves the PersistentClass entity metadata representation for known all entities. + * Retrieves the PersistentClass entity metadata representation for all known entities. * * Returned collection is immutable * @@ -87,7 +87,7 @@ public interface Metadata extends Mapping { PersistentClass getEntityBinding(String entityName); /** - * Retrieves the Collection metadata representation for known all collections. + * Retrieves the Collection metadata representation for all known collections. * * Returned collection is immutable * diff --git a/hibernate-core/src/main/java/org/hibernate/boot/MetadataBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/MetadataBuilder.java index 9a8b6f0172..70621d65fa 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/MetadataBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/MetadataBuilder.java @@ -96,7 +96,7 @@ public interface MetadataBuilder { * Specify the second-level cache mode to be used. This is the cache mode in terms of whether or * not to cache. *

- * Its default is defined by the {@coce javax.persistence.sharedCache.mode} setting if using + * Its default is defined by the {@code javax.persistence.sharedCache.mode} setting if using * property-based configuration. * * @param cacheMode The cache mode. @@ -199,7 +199,7 @@ public interface MetadataBuilder { * setting if using property-based configuration. * * - * @param enable {@code true} to enable; {@code false} to disable;don't call for + * @param enable {@code true} to enable; {@code false} to disable; don't call for * default. * * @return {@code this}, for method chaining @@ -370,7 +370,7 @@ public interface MetadataBuilder { MetadataBuilder applyAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject); /** - * Adds an AttributeConverter by a AttributeConverterDefinition + * Adds an AttributeConverter by an AttributeConverterDefinition * * @param definition The definition * diff --git a/hibernate-core/src/main/java/org/hibernate/boot/MetadataSources.java b/hibernate-core/src/main/java/org/hibernate/boot/MetadataSources.java index b8fc9447b5..574b710d19 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/MetadataSources.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/MetadataSources.java @@ -325,7 +325,7 @@ public class MetadataSources implements Serializable { } /** - * Read mappings as a application resourceName (i.e. classpath lookup). + * Read mappings as an application resourceName (i.e. classpath lookup). * * @param name The resource name * diff --git a/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java index 94cb14c8a4..476fc30051 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java @@ -644,7 +644,7 @@ public interface SessionFactoryBuilder { /** * Apply a fetch size to the JDBC driver for fetching results. * - * @param size The fetch saize to be passed to the driver. + * @param size The fetch size to be passed to the driver. * * @return {@code this}, for method chaining * diff --git a/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/ArchiveHelper.java b/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/ArchiveHelper.java index c3dbfdf80c..80376d4a15 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/ArchiveHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/ArchiveHelper.java @@ -104,7 +104,7 @@ public class ArchiveHelper { * * @return The resolved URL reference * - * @throws IllegalArgumentException is something goes wrong + * @throws IllegalArgumentException if something goes wrong */ public static URL getURLFromPath(String jarPath) { URL jarUrl; @@ -126,7 +126,7 @@ public class ArchiveHelper { /** * Extracts the bytes out of an InputStream. This form is the same as {@link #getBytesFromInputStream} - * except that any {@link IOException} are wrapped as (runtime) {@link ArchiveException} + * except that any {@link IOException} is wrapped as (runtime) {@link ArchiveException} * * @param inputStream The stream from which to extract bytes. * diff --git a/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/spi/AbstractScannerImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/spi/AbstractScannerImpl.java index eab823a51e..8d7423c180 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/spi/AbstractScannerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/archive/scan/spi/AbstractScannerImpl.java @@ -79,7 +79,7 @@ public abstract class AbstractScannerImpl implements Scanner { * * JPA allows for to be specific * @param url - * @return + * @return The resolved non-root URL */ protected URL resolveNonRootUrl(URL url) { return null; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java index 3d325c2fd1..28e2da16b8 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java @@ -234,6 +234,14 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector return new HashSet<>( mappedSuperClasses.values() ); } + @Override + public void initSessionFactory(SessionFactoryImplementor sessionFactory) { + throw new UnsupportedOperationException( + "You should not be building a SessionFactory from an in-flight metadata collector; and of course " + + "we should better segment this in the API :)" + ); + } + @Override public IdentifierGeneratorFactory getIdentifierGeneratorFactory() { return identifierGeneratorFactory; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java index 60460d8a8e..c126f58e78 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/MetadataImpl.java @@ -16,6 +16,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.function.Consumer; +import java.util.regex.Pattern; import org.hibernate.HibernateException; import org.hibernate.MappingException; @@ -35,8 +36,12 @@ import org.hibernate.boot.spi.NamedProcedureCallDefinition; import org.hibernate.boot.spi.NamedResultSetMappingDefinition; import org.hibernate.boot.spi.SessionFactoryBuilderFactory; import org.hibernate.cfg.annotations.NamedEntityGraphDefinition; +import org.hibernate.engine.config.spi.ConfigurationService; import org.hibernate.engine.spi.FilterDefinition; import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.event.service.spi.EventListenerGroup; +import org.hibernate.event.service.spi.EventListenerRegistry; +import org.hibernate.event.spi.EventType; import org.hibernate.id.factory.spi.MutableIdentifierGeneratorFactory; import org.hibernate.mapping.Collection; import org.hibernate.mapping.FetchProfile; @@ -51,6 +56,7 @@ import org.hibernate.query.named.NamedQueryRepository; import org.hibernate.query.named.NamedResultSetMappingMemento; import org.hibernate.query.sql.spi.NamedNativeQueryMemento; import org.hibernate.query.sqm.function.SqmFunctionDescriptor; +import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.type.spi.TypeConfiguration; /** @@ -61,6 +67,8 @@ import org.hibernate.type.spi.TypeConfiguration; * @author Gail Badner */ public class MetadataImpl implements MetadataImplementor, Serializable { + private static final Pattern LISTENER_SEPARATION_PATTERN = Pattern.compile( " ," ); + private final UUID uuid; private final MetadataBuildingOptions metadataBuildingOptions; private final BootstrapContext bootstrapContext; @@ -364,6 +372,46 @@ public class MetadataImpl implements MetadataImplementor, Serializable { : new HashSet<>( mappedSuperclassMap.values() ); } + @Override + public void initSessionFactory(SessionFactoryImplementor sessionFactory) { + final ServiceRegistryImplementor sessionFactoryServiceRegistry = sessionFactory.getServiceRegistry(); + + assert sessionFactoryServiceRegistry != null; + + final EventListenerRegistry eventListenerRegistry = sessionFactoryServiceRegistry.getService( EventListenerRegistry.class ); + final ConfigurationService cfgService = sessionFactoryServiceRegistry.getService( ConfigurationService.class ); + final ClassLoaderService classLoaderService = sessionFactoryServiceRegistry.getService( ClassLoaderService.class ); + + eventListenerRegistry.prepare( this ); + + for ( Map.Entry entry : ( (Map) cfgService.getSettings() ).entrySet() ) { + if ( !String.class.isInstance( entry.getKey() ) ) { + continue; + } + final String propertyName = (String) entry.getKey(); + if ( !propertyName.startsWith( org.hibernate.jpa.AvailableSettings.EVENT_LISTENER_PREFIX ) ) { + continue; + } + final String eventTypeName = propertyName.substring( + org.hibernate.jpa.AvailableSettings.EVENT_LISTENER_PREFIX.length() + 1 + ); + final EventType eventType = EventType.resolveEventTypeByName( eventTypeName ); + final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType ); + for ( String listenerImpl : LISTENER_SEPARATION_PATTERN.split( ( (String) entry.getValue() ) ) ) { + eventListenerGroup.appendListener( instantiate( listenerImpl, classLoaderService ) ); + } + } + } + + private Object instantiate(String listenerImpl, ClassLoaderService classLoaderService) { + try { + return classLoaderService.classForName( listenerImpl ).newInstance(); + } + catch (Exception e) { + throw new HibernateException( "Could not instantiate requested listener [" + listenerImpl + "]", e ); + } + } + @Override public org.hibernate.type.Type getIdentifierType(String entityName) throws MappingException { final PersistentClass pc = entityBindingMap.get( entityName ); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/DatabaseIdentifier.java b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/DatabaseIdentifier.java index 6d5eae1a96..5d2f19b60c 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/DatabaseIdentifier.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/DatabaseIdentifier.java @@ -16,7 +16,7 @@ import org.hibernate.internal.util.StringHelper; public class DatabaseIdentifier extends Identifier { /** - * Constructs a datatabase identifier instance. + * Constructs a database identifier instance. * It is assumed that text is unquoted. * * @param text The identifier text. diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/Identifier.java b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/Identifier.java index fafcd35635..be697f9be4 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/Identifier.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/Identifier.java @@ -88,7 +88,7 @@ public class Identifier implements Comparable { * * @param name * - * @return + * @return {@code true} if the given identifier text is considered quoted; {@code false} otherwise. */ public static boolean isQuoted(String name) { return ( name.startsWith( "`" ) && name.endsWith( "`" ) ) @@ -133,7 +133,7 @@ public class Identifier implements Comparable { } /** - * Is this a quoted identifier> + * Is this a quoted identifier? * * @return True if this is a quote identifier; false otherwise. */ diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/ObjectNameNormalizer.java b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/ObjectNameNormalizer.java index ee688be680..824b009ad3 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/ObjectNameNormalizer.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/ObjectNameNormalizer.java @@ -24,7 +24,7 @@ public abstract class ObjectNameNormalizer { * This implements the rules set forth in JPA 2 (section "2.13 Naming of Database Objects") which * states that the double-quote (") is the character which should be used to denote a quoted * identifier. Here, we handle recognizing that and converting it to the more elegant - * bactick (`) approach used in Hibernate.. Additionally we account for applying what JPA2 terms + * backtick (`) approach used in Hibernate.. Additionally we account for applying what JPA2 terms * "globally quoted identifiers". * * @param identifierText The identifier to be quoting-normalized. diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/process/spi/ManagedResources.java b/hibernate-core/src/main/java/org/hibernate/boot/model/process/spi/ManagedResources.java index e2a7b7aeb5..4f96636d91 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/process/spi/ManagedResources.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/process/spi/ManagedResources.java @@ -19,7 +19,7 @@ import org.hibernate.cfg.AttributeConverterDefinition; * Represents the result of the first step of the process of building {@link org.hibernate.boot.MetadataSources} * reference into a {@link org.hibernate.boot.Metadata} reference. *

- * Essentially it represents thecombination of:

    + * Essentially it represents the combination of:
      *
    1. domain classes, packages and mapping files defined via MetadataSources
    2. *
    3. attribute converters defined via MetadataBuildingOptions
    4. *
    5. classes, converters, packages and mapping files auto-discovered as part of scanning
    6. diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/relational/QualifiedName.java b/hibernate-core/src/main/java/org/hibernate/boot/model/relational/QualifiedName.java index accffef431..92139e89c2 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/relational/QualifiedName.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/relational/QualifiedName.java @@ -15,7 +15,7 @@ import org.hibernate.boot.model.naming.Identifier; *
    7. {@link java.sql.DatabaseMetaData#getCatalogSeparator()}
    8. *
    *

    - * Also, be careful about the usage of {@link #render}. If the intention is get get the name + * Also, be careful about the usage of {@link #render}. If the intention is to get the name * as used in the database, the {@link org.hibernate.engine.jdbc.env.spi.JdbcEnvironment} -> * {@link org.hibernate.engine.jdbc.env.spi.QualifiedObjectNameFormatter#format} should be * used instead. diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/FilterSource.java b/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/FilterSource.java index 77d2316477..062676ccb2 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/FilterSource.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/FilterSource.java @@ -9,7 +9,7 @@ package org.hibernate.boot.model.source.spi; import java.util.Map; /** - * Defines the source of filter information. May have an associated {@link FilterDefinitionSource}. + * Defines the source of filter information. May have an associated {@link org.hibernate.engine.spi.FilterDefinition}. * Relates to both {@code } and {@link org.hibernate.annotations.Filter @Filter} * * @author Steve Ebersole @@ -28,12 +28,12 @@ public interface FilterSource { * * @return The condition defined on the filter. * - * @see {@link FilterDefinitionSource#getCondition()} + * @see org.hibernate.boot.model.source.internal.hbm.FilterSourceImpl#getCondition() */ public String getCondition(); /** - * Should Hibernate perform automatic alias injection into the supplied condition string? The default it to + * Should Hibernate perform automatic alias injection into the supplied condition string? The default is to * perform auto injection *unless* explicit alias(es) are supplied. * * @return {@code true} indicates auto injection should occur; {@code false} that it should not diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/MetadataSourceProcessor.java b/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/MetadataSourceProcessor.java index 6fd2c3f17f..4a857b8a78 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/MetadataSourceProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/MetadataSourceProcessor.java @@ -38,7 +38,7 @@ public interface MetadataSourceProcessor { /** * Process all "root" named queries. These are named queries not defined on * a specific entity (which will be handled later during - * {@link #processEntityHierarchies}. + * {@link #processEntityHierarchies}). *

    * This step has no prerequisites. The returns associated with named native * queries can depend on entity binding being complete, but those are handled diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/Orderable.java b/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/Orderable.java index a5c96851e0..67c1333a07 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/Orderable.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/source/spi/Orderable.java @@ -26,7 +26,7 @@ public interface Orderable { * If the ordering element is not specified, ordering by * the primary key of the associated entity is assumed * - * {@see javax.persistence.OrderBy#value()} + * @see javax.persistence.OrderBy#value() * * @return The {@code ORDER BY} fragment used during loading this plural attribute from DB. */ diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/package-info.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/package-info.java index aca854db51..75c16fbce2 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/package-info.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/package-info.java @@ -13,14 +13,14 @@ * "override" services from parent registries. It also allows granular building of registries as services * become available. * - * {@link BootstrapServiceRegistry} is the base service registry, intended to be built via - * {@link BootstrapServiceRegistryBuilder} if you need customization. For non-customized - * {@link BootstrapServiceRegistry} usage, the {@link BootstrapServiceRegistryBuilder} and - * {@link BootstrapServiceRegistry} can be bypassed altogether. + * {@link org.hibernate.boot.registry.BootstrapServiceRegistry} is the base service registry, intended to be built via + * {@link org.hibernate.boot.registry.BootstrapServiceRegistryBuilder} if you need customization. For non-customized + * {@link org.hibernate.boot.registry.BootstrapServiceRegistry} usage, the {@link org.hibernate.boot.registry.BootstrapServiceRegistryBuilder} and + * {@link org.hibernate.boot.registry.BootstrapServiceRegistry} can be bypassed altogether. * - * Usually the next level in a standard registry set up is the {@link StandardServiceRegistry}, intended to be built - * by the {@link StandardServiceRegistryBuilder} if you need customization. The builder optionally takes the - * {@link BootstrapServiceRegistry} to use as a base; if none is provided a default one is generated assuming sensible + * Usually the next level in a standard registry set up is the {@link org.hibernate.boot.registry.StandardServiceRegistry}, intended to be built + * by the {@link org.hibernate.boot.registry.StandardServiceRegistryBuilder} if you need customization. The builder optionally takes the + * {@link org.hibernate.boot.registry.BootstrapServiceRegistry} to use as a base; if none is provided a default one is generated assuming sensible * defaults in Java SE and EE environments, particularly in respect to Class loading. */ package org.hibernate.boot.registry; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/selector/spi/package-info.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/selector/spi/package-info.java index 1c464c32f1..587349b009 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/selector/spi/package-info.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/selector/spi/package-info.java @@ -6,6 +6,6 @@ */ /** - * Defines actual contract used for strategy selection : {@link StrategySelector}. + * Defines actual contract used for strategy selection : {@link org.hibernate.boot.registry.selector.spi.StrategySelector}. */ package org.hibernate.boot.registry.selector.spi; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadata.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadata.java index 4959d36d76..bd52abf2c8 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadata.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingMetadata.java @@ -219,6 +219,12 @@ public abstract class AbstractDelegatingMetadata implements MetadataImplementor return delegate.getMappedSuperclassMappingsCopy(); } + @Override + public void initSessionFactory(SessionFactoryImplementor sessionFactory) { + delegate.initSessionFactory( sessionFactory ); + } + + @Override public NamedQueryRepository buildNamedQueryRepository(SessionFactoryImplementor sessionFactory) { return delegate.buildNamedQueryRepository( sessionFactory ); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java index e591a16fe0..08b7c33cc2 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingContext.java @@ -58,7 +58,7 @@ public interface MetadataBuildingContext { /** * Not sure how I feel about this exposed here * - * @return + * @return The ObjectNameNormalizer */ ObjectNameNormalizer getObjectNameNormalizer(); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataImplementor.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataImplementor.java index 517d47767e..e9714b2c84 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataImplementor.java @@ -14,7 +14,6 @@ import org.hibernate.engine.spi.Mapping; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.mapping.MappedSuperclass; import org.hibernate.query.named.NamedQueryRepository; -import org.hibernate.type.Type; import org.hibernate.type.spi.TypeConfiguration; /** @@ -27,6 +26,8 @@ import org.hibernate.type.spi.TypeConfiguration; public interface MetadataImplementor extends Metadata, Mapping { /** * Access to the options used to build this Metadata + * + * @return Access to the MetadataBuildingOptions */ MetadataBuildingOptions getMetadataBuildingOptions(); @@ -42,4 +43,6 @@ public interface MetadataImplementor extends Metadata, Mapping { void validate() throws MappingException; Set getMappedSuperclassMappingsCopy(); + + void initSessionFactory(SessionFactoryImplementor sessionFactoryImplementor); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/NaturalIdUniqueKeyBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/NaturalIdUniqueKeyBinder.java index 3f574f9506..626cabf317 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/NaturalIdUniqueKeyBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/NaturalIdUniqueKeyBinder.java @@ -13,7 +13,7 @@ import org.hibernate.mapping.Property; */ public interface NaturalIdUniqueKeyBinder { /** - * Adds a attribute binding. The attribute is a (top-level) part of the natural-id + * Adds an attribute binding. The attribute is a (top-level) part of the natural-id * * @param attributeBinding The attribute binding that is part of the natural-id */ diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java index 88325910b8..0d017286db 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/SessionFactoryOptions.java @@ -89,7 +89,7 @@ public interface SessionFactoryOptions { } /** - * The name to be used for the SessionFactory. This is use both in:

      + * The name to be used for the SessionFactory. This is used both in:
        *
      • in-VM serialization
      • *
      • JNDI binding, depending on {@link #isSessionFactoryNameAlsoJndiName}
      • *
      diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/EnhancementContext.java b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/EnhancementContext.java index 1dc3bb46c3..d9b242728a 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/EnhancementContext.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/EnhancementContext.java @@ -31,7 +31,7 @@ public interface EnhancementContext { public ClassLoader getLoadingClassLoader(); /** - * Does the given class descriptor represent a entity class? + * Does the given class descriptor represent an entity class? * * @param classDescriptor The descriptor of the class to check. * diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/EnhancerConstants.java b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/EnhancerConstants.java index 41a09beef7..94958b6f69 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/EnhancerConstants.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/EnhancerConstants.java @@ -24,7 +24,7 @@ public final class EnhancerConstants { public static final String PERSISTENT_FIELD_WRITER_PREFIX = "$$_hibernate_write_"; /** - * Name of the method used to get reference the the entity instance (this in the case of enhanced classes). + * Name of the method used to get reference of the entity instance (this in the case of enhanced classes). */ public static final String ENTITY_INSTANCE_GETTER_NAME = "$$_hibernate_getEntityInstance"; @@ -118,7 +118,7 @@ public final class EnhancerConstants { public static final String TRACKER_FIELD_NAME = "$$_hibernate_tracker"; /** - * Name of method that add changed fields + * Name of method to add changed fields */ public static final String TRACKER_CHANGER_NAME = "$$_hibernate_trackChange"; diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/LazyAttributeDescriptor.java b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/LazyAttributeDescriptor.java index 53dd06d9e6..0a2b54aff4 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/LazyAttributeDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/LazyAttributeDescriptor.java @@ -65,7 +65,7 @@ public class LazyAttributeDescriptor { } /** - * Access to the index of the attribute in terms of its position withing the lazy attributes of the persister + * Access to the index of the attribute in terms of its position within the lazy attributes of the persister * * @return The persister lazy attribute index */ diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/spi/ClassTransformer.java b/hibernate-core/src/main/java/org/hibernate/bytecode/spi/ClassTransformer.java index ecbb8a6c89..9cd3bbebff 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/spi/ClassTransformer.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/spi/ClassTransformer.java @@ -23,7 +23,7 @@ public interface ClassTransformer extends javax.persistence.spi.ClassTransformer /** * Invoked when a class is being loaded or redefined to add hooks for persistence bytecode manipulation. * - * @param loader the defining class loaderof the class being transformed. It may be null if using bootstrap loader + * @param loader the defining class loader of the class being transformed. It may be null if using bootstrap loader * @param className The name of the class being transformed * @param classBeingRedefined If an already loaded class is being redefined, then pass this as a parameter * @param protectionDomain ProtectionDomain of the class being (re)-defined diff --git a/hibernate-core/src/main/java/org/hibernate/cache/NoCacheRegionFactoryAvailableException.java b/hibernate-core/src/main/java/org/hibernate/cache/NoCacheRegionFactoryAvailableException.java index 719bca5858..a400d8e351 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/NoCacheRegionFactoryAvailableException.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/NoCacheRegionFactoryAvailableException.java @@ -9,7 +9,7 @@ package org.hibernate.cache; import org.hibernate.cfg.Environment; /** - * Indicates a condition where a second-level cache implementation was expected to be to available, but + * Indicates a condition where a second-level cache implementation was expected to be available, but * none was found on the classpath. * * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/cache/cfg/spi/DomainDataRegionConfig.java b/hibernate-core/src/main/java/org/hibernate/cache/cfg/spi/DomainDataRegionConfig.java index e278912442..d6e7be9746 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/cfg/spi/DomainDataRegionConfig.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/cfg/spi/DomainDataRegionConfig.java @@ -25,7 +25,7 @@ public interface DomainDataRegionConfig { String getRegionName(); /** - * Retrieve the list of all entity to be stored in this region + * Retrieve the list of all entity data to be stored in this region */ List getEntityCaching(); diff --git a/hibernate-core/src/main/java/org/hibernate/cache/internal/CacheKeyImplementation.java b/hibernate-core/src/main/java/org/hibernate/cache/internal/CacheKeyImplementation.java index ba70417a55..dfe090bfc6 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/internal/CacheKeyImplementation.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/internal/CacheKeyImplementation.java @@ -37,7 +37,7 @@ final class CacheKeyImplementation implements Serializable { * @param id The identifier associated with the cached data * @param type The Hibernate type mapping * @param entityOrRoleName The entity or collection-role name. - * @param tenantId The tenant identifier associated this data. + * @param tenantId The tenant identifier associated with this data. * @param factory The session factory for which we are caching */ CacheKeyImplementation( diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/access/CachedDomainDataAccess.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/access/CachedDomainDataAccess.java index 01c1e0c615..5aaf7a66d1 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/access/CachedDomainDataAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/access/CachedDomainDataAccess.java @@ -157,7 +157,7 @@ public interface CachedDomainDataAccess { *

      * The semantic here is whether the cache contains data visible for the * current call context. This should be viewed as a "best effort", meaning - * blocking should be avoid if possible. + * blocking should be avoided if possible. * * @param key The cache key * diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/access/EntityDataAccess.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/access/EntityDataAccess.java index fac7eff553..c2eccf08b0 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/access/EntityDataAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/access/EntityDataAccess.java @@ -62,7 +62,7 @@ public interface EntityDataAccess extends CachedDomainDataAccess { * @param key The item key * @param value The item * @param version The item's version value - * @return Were the contents of the cache actual changed by this operation? + * @return Were the contents of the cache actually changed by this operation? * @throws CacheException Propagated from underlying cache provider */ boolean insert(SharedSessionContractImplementor session, Object key, Object value, Object version); @@ -92,7 +92,7 @@ public interface EntityDataAccess extends CachedDomainDataAccess { * @param value The item * @param currentVersion The item's current version value * @param previousVersion The item's previous version value - * @return Were the contents of the cache actual changed by this operation? + * @return Were the contents of the cache actually changed by this operation? * @throws CacheException Propagated from underlying cache provider */ boolean update( @@ -113,7 +113,7 @@ public interface EntityDataAccess extends CachedDomainDataAccess { * @param currentVersion The item's current version value * @param previousVersion The item's previous version value * @param lock The lock previously obtained from {@link #lockItem} - * @return Were the contents of the cache actual changed by this operation? + * @return Were the contents of the cache actually changed by this operation? * @throws CacheException Propagated from underlying cache provider */ boolean afterUpdate( diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/access/NaturalIdDataAccess.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/access/NaturalIdDataAccess.java index bec175ad1c..5c6b7fd18d 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/access/NaturalIdDataAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/access/NaturalIdDataAccess.java @@ -16,10 +16,10 @@ import org.hibernate.persister.entity.EntityPersister; *

    • INSERTS : {@link #insert} -> {@link #afterInsert}
    • *
    • UPDATES : {@link #lockItem} -> {@link #remove} -> {@link #update} -> {@link #afterUpdate}
    • *
    • DELETES : {@link #lockItem} -> {@link #remove} -> {@link #unlockItem}
    • - *
    • LOADS : {@link @putFromLoad}
    • + *
    • LOADS : {@link #putFromLoad}
    • *
    * Note the special case of UPDATES above. Because the cache key itself has changed here we need to remove the - * old entry as well as + * old entry as well *

    * There is another usage pattern that is used to invalidate entries * afterQuery performing "bulk" HQL/SQL operations: @@ -44,7 +44,7 @@ public interface NaturalIdDataAccess extends CachedDomainDataAccess { * @param naturalIdValues the sequence of values which unequivocally identifies a cached element on this region * @param rootEntityDescriptor the persister of the element being cached * - * @return a key which can be used to identify this an element unequivocally on this same region + * @return a key which can be used to identify an element unequivocally on this same region */ Object generateCacheKey( Object[] naturalIdValues, @@ -69,7 +69,7 @@ public interface NaturalIdDataAccess extends CachedDomainDataAccess { * @param key The item key * @param value The item * - * @return Were the contents of the cache actual changed by this operation? + * @return Were the contents of the cache actually changed by this operation? * * @throws CacheException Propagated from underlying cache provider */ @@ -84,7 +84,7 @@ public interface NaturalIdDataAccess extends CachedDomainDataAccess { * @param key The item key * @param value The item * - * @return Were the contents of the cache actual changed by this operation? + * @return Were the contents of the cache actually changed by this operation? * * @throws CacheException Propagated from underlying cache provider */ @@ -99,7 +99,7 @@ public interface NaturalIdDataAccess extends CachedDomainDataAccess { * @param key The item key * @param value The item * - * @return Were the contents of the cache actual changed by this operation? + * @return Were the contents of the cache actually changed by this operation? * * @throws CacheException Propagated from underlying cache provider */ @@ -115,7 +115,7 @@ public interface NaturalIdDataAccess extends CachedDomainDataAccess { * @param value The item * @param lock The lock previously obtained from {@link #lockItem} * - * @return Were the contents of the cache actual changed by this operation? + * @return Were the contents of the cache actually changed by this operation? * * @throws CacheException Propagated from underlying cache provider */ diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/entry/CacheEntry.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/entry/CacheEntry.java index dc2ac5de93..18e2bbb10f 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/entry/CacheEntry.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/entry/CacheEntry.java @@ -41,7 +41,7 @@ public interface CacheEntry extends Serializable { * Get the underlying disassembled state * * todo : this was added to support initializing an entity's EntityEntry snapshot during reattach; - * this should be refactored to instead expose a method to assemble a EntityEntry based on this + * this should be refactored to instead expose a method to assemble an EntityEntry based on this * state for return. * * @return The disassembled state diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/support/AbstractReadWriteAccess.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/support/AbstractReadWriteAccess.java index 07820086a5..874a254182 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/support/AbstractReadWriteAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/support/AbstractReadWriteAccess.java @@ -232,7 +232,7 @@ public abstract class AbstractReadWriteAccess extends AbstractCachedDomainDataAc boolean isUnlockable(SoftLock lock); /** - * Locks this entry, stamping it with the UUID and lockId given, with the lock timeout occuring at the specified + * Locks this entry, stamping it with the UUID and lockId given, with the lock timeout occurring at the specified * time. The returned Lock object can be used to unlock the entry in the future. */ SoftLockImpl lock(long timeout, UUID uuid, long lockId); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AbstractPropertyHolder.java b/hibernate-core/src/main/java/org/hibernate/cfg/AbstractPropertyHolder.java index f5459296a8..029d8a2deb 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AbstractPropertyHolder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AbstractPropertyHolder.java @@ -157,7 +157,7 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { } /** - * Set the property be processed. property can be null + * Set the property to be processed. property can be null * * @param property The property */ @@ -207,7 +207,7 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { // - the property uses some restricted values // - the user has overridden the column // also change getOverriddenJoinColumn and getOverriddenJoinTable as well - + // if ( propertyName.contains( ".key." ) ) { // //support for legacy @AttributeOverride declarations // //TODO cache the underlying regexp diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedClassType.java b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedClassType.java index 1f20465fa2..b872573fc4 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedClassType.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotatedClassType.java @@ -14,7 +14,7 @@ package org.hibernate.cfg; */ public enum AnnotatedClassType { /** - * has no revelent top level annotation + * has no relevant top level annotation */ NONE, /** @@ -22,7 +22,7 @@ public enum AnnotatedClassType { */ ENTITY, /** - * has a @Embeddable annotation + * has an @Embeddable annotation */ EMBEDDABLE, /** diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java index f3038d1d02..b39dfde50b 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java @@ -1021,7 +1021,7 @@ public final class AnnotationBinder { * and we create an identifier mapper containing the id properties of the main entity * * In JPA 2, there is a shortcut if the id class is the Pk of the associated class pointed to by the id - * it ought to be treated as an embedded and not a real IdClass (at least in the Hibernate's internal way + * it ought to be treated as an embedded and not a real IdClass (at least in the Hibernate's internal way) */ XClass classWithIdClass = inheritanceState.getClassWithIdClass( false ); if ( classWithIdClass != null ) { @@ -3196,7 +3196,7 @@ public final class AnnotationBinder { //try to find a hidden true one to one (FK == PK columns) KeyValue identifier = propertyHolder.getIdentifier(); if ( identifier == null ) { - //this is a @OneToOne in a @EmbeddedId (the persistentClass.identifier is not set yet, it's being built) + //this is a @OneToOne in an @EmbeddedId (the persistentClass.identifier is not set yet, it's being built) //by definition the PK cannot refers to itself so it cannot map to itself mapToPK = false; } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index 53d9343323..81b1ae0ce2 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -203,7 +203,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { * * delayed access to the BeanManager reference. Here, Hibernate * will not access the reference passed as the BeanManager during * bootstrap until it is first needed. Note however that this has - * the effect of delaying any deployement problems until after + * the effect of delaying any deployment problems until after * bootstrapping. * * This setting is used to configure Hibernate ORM's access to @@ -259,7 +259,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { String HIBERNATE_CLASSLOADER = "hibernate.classLoader.hibernate"; /** - * Names the {@link ClassLoader} used when Hibernate is unable to locates classes on the + * Names the {@link ClassLoader} used when Hibernate is unable to locate classes on the * {@link #APP_CLASSLOADER} or {@link #HIBERNATE_CLASSLOADER}. * @since 4.0 * @deprecated Use {@link #CLASSLOADERS} instead @@ -280,7 +280,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { * enabled - Do the build * *

  1. - * disabled - Do not so the build + * disabled - Do not do the build *
  2. *
  3. * ignoreUnsupported - Do the build, but ignore any non-JPA features that would otherwise @@ -340,7 +340,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { /** * Names the connection user. This might mean one of 2 things in out-of-the-box Hibernate * {@link org.hibernate.engine.jdbc.connections.spi.ConnectionProvider}:
      - *
    • The username used to pass along to creating the JDBC connection
    • + *
    • The username used to pass along to create the JDBC connection
    • *
    • The username used to obtain a JDBC connection from a data source
    • *
    */ @@ -1386,7 +1386,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { String HBM2DDL_DB_MINOR_VERSION = "javax.persistence.database-minor-version"; /** - * Specifies whether schema generation commands for schema creation are to be determine based on object/relational + * Specifies whether schema generation commands for schema creation are to be determined based on object/relational * mapping metadata, DDL scripts, or a combination of the two. See {@link SourceType} for valid set of values. * If no value is specified, a default is assumed as follows:
      *
    • @@ -1402,7 +1402,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { String HBM2DDL_CREATE_SOURCE = "javax.persistence.schema-generation.create-source"; /** - * Specifies whether schema generation commands for schema dropping are to be determine based on object/relational + * Specifies whether schema generation commands for schema dropping are to be determined based on object/relational * mapping metadata, DDL scripts, or a combination of the two. See {@link SourceType} for valid set of values. * If no value is specified, a default is assumed as follows:
        *
      • @@ -1793,7 +1793,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { * handling. Implicitly Hibernate will not pass the NULL, the intention being to allow * any default argument values to be applied. *

        - * This defines a global setting, which can them be controlled per parameter via + * This defines a global setting, which can then be controlled per parameter via * {@link org.hibernate.procedure.ParameterRegistration#enablePassingNulls(boolean)} *

        * Values are {@code true} (pass the NULLs) or {@code false} (do not pass the NULLs). @@ -1855,7 +1855,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { * a JPA {@link javax.persistence.EntityManager}). *

        *

        - * Values are {@code true} permits the refresh, {@code false} does not permit the detached instance refresh and an {@link IllegalArgumentException} is thrown. + * Values are: {@code true} permits the refresh, {@code false} does not permit the detached instance refresh and an {@link IllegalArgumentException} is thrown. *

        * The default value is {@code false} when the Session is bootstrapped via JPA {@link javax.persistence.EntityManagerFactory}, otherwise is {@code true} * @@ -2022,7 +2022,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { * Determine if the scope of {@link javax.persistence.TableGenerator#name()} and {@link javax.persistence.SequenceGenerator#name()} should be * considered globally or locally defined. * - * If enabled, the names will considered globally scoped so defining two different generators with the same name + * If enabled, the names will be considered globally scoped so defining two different generators with the same name * will cause a name collision and an exception will be thrown during the bootstrap phase. * * @see JpaCompliance#isGlobalGeneratorScopeEnabled() diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/ClassPropertyHolder.java b/hibernate-core/src/main/java/org/hibernate/cfg/ClassPropertyHolder.java index a3958341fc..b2bc07ecda 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/ClassPropertyHolder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/ClassPropertyHolder.java @@ -259,7 +259,7 @@ public class ClassPropertyHolder extends AbstractPropertyHolder { /** * Needed for proper compliance with naming strategy, the property table - * can be overriden if the properties are part of secondary tables + * can be overridden if the properties are part of secondary tables */ private Map getJoinsPerRealTableName() { if ( joinsPerRealTableName == null ) { diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java b/hibernate-core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java index 4413a5c34c..5fe60fd0d8 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java @@ -49,7 +49,7 @@ import org.hibernate.mapping.Value; @SuppressWarnings("unchecked") public class Ejb3JoinColumn extends Ejb3Column { /** - * property name repated to this column + * property name related to this column */ private String referencedColumn; private String mappedBy; @@ -769,7 +769,7 @@ public class Ejb3JoinColumn extends Ejb3Column { // was the column explicitly quoted in the mapping/annotation // TODO: in metamodel, we need to better split global quoting and explicit quoting w/ respect to logical names boolean isLogicalColumnQuoted = StringHelper.isQuoted( getLogicalColumnName() ); - + final ObjectNameNormalizer nameNormalizer = getBuildingContext().getObjectNameNormalizer(); final String logicalColumnName = nameNormalizer.normalizeIdentifierQuotingAsString( getLogicalColumnName() ); final String referencedColumn = nameNormalizer.normalizeIdentifierQuotingAsString( getReferencedColumn() ); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java index f0f2c1376d..30d97d5bcb 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java @@ -29,7 +29,7 @@ import org.jboss.logging.Logger; * Hibernate has two property scopes: *

          *
        • Factory-level properties may be passed to the SessionFactory when it - * instantiated. Each instance might have different property values. If no + * is instantiated. Each instance might have different property values. If no * properties are specified, the factory calls Environment.getProperties(). *
        • System-level properties are shared by all factory instances and are always * determined by the Environment properties. @@ -58,7 +58,7 @@ import org.jboss.logging.Logger; * * hibernate.connection.provider_class * classname of ConnectionProvider - * subclass (if not specified hueristics are used) + * subclass (if not specified heuristics are used) * * hibernate.connection.usernamedatabase username * hibernate.connection.passworddatabase password @@ -83,7 +83,7 @@ import org.jboss.logging.Logger; * * * hibernate.connection.datasource - * databasource JNDI name (when using javax.sql.Datasource) + * datasource JNDI name (when using javax.sql.Datasource) * * * hibernate.jndi.urlJNDI InitialContext URL @@ -105,7 +105,7 @@ import org.jboss.logging.Logger; * * * hibernate.jdbc.use_scrollable_resultset - * enable use of JDBC2 scrollable resultsets (you only need this specify + * enable use of JDBC2 scrollable resultsets (you only need to specify * this property when using user supplied connections) * * @@ -231,9 +231,9 @@ public final class Environment implements AvailableSettings { } /** - * This will be removed soon; currently just returns false as no known JVM exibits this bug + * This will be removed soon; currently just returns false as no known JVM exhibits this bug * and is also able to run this version of Hibernate ORM. - * @deprecated removed as unneccessary + * @deprecated removed as unnecessary * @return false */ @Deprecated diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/FkSecondPass.java b/hibernate-core/src/main/java/org/hibernate/cfg/FkSecondPass.java index 0e07b04725..0a689b3778 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/FkSecondPass.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/FkSecondPass.java @@ -20,7 +20,7 @@ public abstract class FkSecondPass implements SecondPass { * unique counter is needed to differentiate 2 instances of FKSecondPass * as they are compared. * Fairly hacky but IBM VM sometimes returns the same hashCode for 2 different objects - * TODO is it doable to rely on the Ejb3JoinColumn names? Not sure at they could be inferred + * TODO is it doable to rely on the Ejb3JoinColumn names? Not sure as they could be inferred */ private int uniqueCounter; private static AtomicInteger globalCounter = new AtomicInteger(); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/ImprovedNamingStrategy.java b/hibernate-core/src/main/java/org/hibernate/cfg/ImprovedNamingStrategy.java index f23df302b3..6487416f94 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/ImprovedNamingStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/ImprovedNamingStrategy.java @@ -33,7 +33,7 @@ public class ImprovedNamingStrategy implements NamingStrategy, Serializable { return addUnderscores( StringHelper.unqualify(className) ); } /** - * Return the full property path with underscore seperators, mixed + * Return the full property path with underscore separators, mixed * case converted to underscores */ public String propertyToColumnName(String propertyName) { diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/NamingStrategy.java b/hibernate-core/src/main/java/org/hibernate/cfg/NamingStrategy.java index 2c17069bd2..80768c9216 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/NamingStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/NamingStrategy.java @@ -21,7 +21,7 @@ package org.hibernate.cfg; * @author Gavin King * @author Emmanuel Bernard * - * @deprecated A {@link org.hibernate.cfg.naming.NamingStrategyDelegator} should be used instead. + * @deprecated {@link org.hibernate.boot.model.naming.ImplicitNamingStrategy} and {@link org.hibernate.boot.model.naming.PhysicalNamingStrategy} should be used instead. */ @Deprecated public interface NamingStrategy { @@ -83,7 +83,7 @@ public interface NamingStrategy { * Return the logical column name used to refer to a column in the metadata * (like index, unique constraints etc) * A full bijection is required between logicalNames and physical ones - * logicalName have to be case insersitively unique for a given table + * logicalName have to be case insensitively unique for a given table * * @param columnName given column name if any * @param propertyName property name of this column diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java b/hibernate-core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java index c0e8eddc4a..37e0a5e40d 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java @@ -86,7 +86,7 @@ public class OneToOneSecondPass implements SecondPass { final String propertyName = inferredData.getPropertyName(); value.setPropertyName( propertyName ); String referencedEntityName = ToOneBinder.getReferenceEntityName( inferredData, targetEntity, buildingContext ); - value.setReferencedEntityName( referencedEntityName ); + value.setReferencedEntityName( referencedEntityName ); AnnotationBinder.defineFetchingStrategy( value, inferredData.getProperty() ); //value.setFetchMode( fetchMode ); value.setCascadeDeleteEnabled( cascadeOnDelete ); @@ -218,7 +218,7 @@ public class OneToOneSecondPass implements SecondPass { else { propertyHolder.addProperty( prop, inferredData.getDeclaringClass() ); } - + value.setReferencedPropertyName( mappedBy ); // HHH-6813 @@ -234,7 +234,7 @@ public class OneToOneSecondPass implements SecondPass { } boolean referenceToPrimaryKey = referencesDerivedId || mappedBy == null; value.setReferenceToPrimaryKey( referenceToPrimaryKey ); - + // If the other side is a derived ID, prevent an infinite // loop of attempts to resolve identifiers. if ( referencesDerivedId ) { @@ -263,8 +263,8 @@ public class OneToOneSecondPass implements SecondPass { } /** - * Builds the Join instance for the mapped by side of a OneToOne association using - * a join tables. + * Builds the Join instance for the mapped by side of a OneToOne association using + * a join table. *

          * Note:
          *

            diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/PropertyHolder.java b/hibernate-core/src/main/java/org/hibernate/cfg/PropertyHolder.java index e01aba7b7d..a07dcb6350 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/PropertyHolder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/PropertyHolder.java @@ -44,7 +44,7 @@ public interface PropertyHolder { boolean isOrWithinEmbeddedId(); /** - * Return true if this component is withing an @ElementCollection. + * Return true if this component is within an @ElementCollection. */ boolean isWithinElementCollection(); @@ -104,7 +104,7 @@ public interface PropertyHolder { * Determine the AttributeConverter to use for the given property. * * @param property - * @return + * @return The ConverterDescriptor */ ConverterDescriptor resolveAttributeConverterDescriptor(XProperty property); } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/PropertyHolderBuilder.java b/hibernate-core/src/main/java/org/hibernate/cfg/PropertyHolderBuilder.java index a38dde94e1..f8ec1d0022 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/PropertyHolderBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/PropertyHolderBuilder.java @@ -17,7 +17,7 @@ import org.hibernate.mapping.Join; import org.hibernate.mapping.PersistentClass; /** - * This factory is here ot build a PropertyHolder and prevent .mapping interface adding + * This factory is here to build a PropertyHolder and prevent .mapping interface adding * * @author Emmanuel Bernard */ @@ -58,7 +58,7 @@ public final class PropertyHolderBuilder { } /** - * buid a property holder on top of a collection + * build a property holder on top of a collection */ public static CollectionPropertyHolder buildPropertyHolder( Collection collection, diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/PropertyInferredData.java b/hibernate-core/src/main/java/org/hibernate/cfg/PropertyInferredData.java index cabc9750a4..76233cb2d0 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/PropertyInferredData.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/PropertyInferredData.java @@ -14,7 +14,7 @@ import org.hibernate.annotations.common.reflection.XClass; import org.hibernate.annotations.common.reflection.XProperty; /** - * Retrieve all inferred data from an annnoted element + * Retrieve all inferred data from an annotated element * * @author Emmanuel Bernard * @author Paolo Perrotta @@ -37,7 +37,7 @@ public class PropertyInferredData implements PropertyData { } /** - * Take the annoted element for lazy process + * Take the annotated element for lazy process */ public PropertyInferredData(XClass declaringClass, XProperty property, String propertyAccessor, ReflectionManager reflectionManager) { this.declaringClass = declaringClass; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java index ad96518092..90a55a048d 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java @@ -424,7 +424,7 @@ public class EntityBinder { ); } } - persistentClass.addFilter(filterName, cond, filter.deduceAliasInjectionPoints(), + persistentClass.addFilter(filterName, cond, filter.deduceAliasInjectionPoints(), toAliasTableMap(filter.aliases()), toAliasEntityMap(filter.aliases())); } LOG.debugf( "Import with entity name %s", name ); @@ -460,7 +460,7 @@ public class EntityBinder { new NamedEntityGraphDefinition( annotation, name, persistentClass.getEntityName() ) ); } - + public void bindDiscriminatorValue() { if ( StringHelper.isEmpty( discriminatorValue ) ) { Value discriminator = persistentClass.getDiscriminator(); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java index 95bf2c6b9b..10f178f92f 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java @@ -487,7 +487,7 @@ public class SimpleValueBinder { public void fillSimpleValue() { LOG.debugf( "Starting fillSimpleValue for %s", propertyName ); - + if ( attributeConverterDescriptor != null ) { if ( ! BinderHelper.isEmptyAnnotationValue( explicitType ) ) { throw new AnnotationException( @@ -565,7 +565,7 @@ public class SimpleValueBinder { if ( timeStampVersionType != null ) { simpleValue.setTypeName( timeStampVersionType ); } - + if ( simpleValue.getTypeName() != null && simpleValue.getTypeName().length() > 0 && simpleValue.getMetadata().getTypeConfiguration().getBasicTypeRegistry().getRegisteredType( simpleValue.getTypeName() ) == null ) { try { diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/JPAOverriddenAnnotationReader.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/JPAOverriddenAnnotationReader.java index fe429ccfcf..78ba00db08 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/JPAOverriddenAnnotationReader.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/JPAOverriddenAnnotationReader.java @@ -250,7 +250,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader { private AccessibleObject mirroredAttribute; /** - * @deprecated Use {@link JPAMetadataProvider(AnnotatedElement, XMLContext, BootstrapContext)} instead. + * @deprecated Use {@link #JPAOverriddenAnnotationReader(AnnotatedElement, XMLContext, BootstrapContext)} instead. */ public JPAOverriddenAnnotationReader( AnnotatedElement el, @@ -2998,7 +2998,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader { /** * Copy a string attribute from an XML element to an annotation descriptor. The name of the annotation attribute is - * explicitely given. + * explicitly given. * * @param annotation annotation where to copy to the attribute. * @param element XML element from where to copy the attribute. diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/XMLContext.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/XMLContext.java index f46279b485..8aef32bc9b 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/XMLContext.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/reflection/XMLContext.java @@ -59,7 +59,7 @@ public class XMLContext implements Serializable { /** * @param doc The xml document to add - * @return Add a xml document to this context and return the list of added class names. + * @return Add an xml document to this context and return the list of added class names. */ @SuppressWarnings( "unchecked" ) public List addDocument(Document doc) { @@ -108,7 +108,7 @@ public class XMLContext implements Serializable { unitElement = root.element( "access" ); setAccess( unitElement, entityMappingDefault ); defaultElements.add( root ); - + setLocalAttributeConverterDefinitions( root.elements( "converter" ) ); List entities = root.elements( "entity" ); @@ -190,7 +190,7 @@ public class XMLContext implements Serializable { addedClasses.addAll( localAddedClasses ); return localAddedClasses; } - + @SuppressWarnings("unchecked") private void setLocalAttributeConverterDefinitions(List converterElements) { for ( Element converterElement : converterElements ) { diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationEventListener.java b/hibernate-core/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationEventListener.java index 80685b8d9f..c147e7486e 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationEventListener.java @@ -57,7 +57,7 @@ public class BeanValidationEventListener * Constructor used in an environment where validator factory is injected (JPA2). * * @param factory The {@code ValidatorFactory} to use to create {@code Validator} instance(s) - * @param settings Configued properties + * @param settings Configured properties */ public BeanValidationEventListener(ValidatorFactory factory, Map settings, ClassLoaderService classLoaderService) { init( factory, settings, classLoaderService ); diff --git a/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentBag.java b/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentBag.java index 8a31cdfbdd..2cecaf1fff 100644 --- a/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentBag.java +++ b/hibernate-core/src/main/java/org/hibernate/collection/internal/PersistentBag.java @@ -522,7 +522,7 @@ public class PersistentBag extends AbstractPersistentCollection implements List * * @param o The object to check * - * @return The number of occurences. + * @return The number of occurrences. */ @SuppressWarnings("UnusedDeclaration") public int occurrences(Object o) { diff --git a/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java b/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java index c49cfc0e2e..40b6832e5c 100644 --- a/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java +++ b/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java @@ -160,7 +160,7 @@ public class ThreadLocalSessionContext extends AbstractCurrentSessionContext { /** * Mainly for subclass usage. This impl always returns true. * - * @return Whether or not the the session should be flushed prior transaction completion. + * @return Whether or not the the session should be flushed prior to transaction completion. */ protected boolean isAutoFlushEnabled() { return true; diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Cache71Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Cache71Dialect.java index f174e40f64..a5722d1cd9 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Cache71Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Cache71Dialect.java @@ -46,7 +46,7 @@ import static org.hibernate.query.TemporalUnit.NANOSECOND; /** * Caché 2007.1 dialect. * - * This class is required in order to use Hibernate with Intersystems Caché SQL. Compatible with + * This class is required in order to use Hibernate with InterSystems Caché SQL. Compatible with * Caché 2007.1. * *

            PREREQUISITES

            diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java index e46aa9bace..27fcf481db 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java @@ -633,7 +633,7 @@ public class DB2Dialect extends Dialect { * if expression has not been explicitly specified. * @param nullPrecedence Nulls precedence. Default value: {@link NullPrecedence#NONE}. * - * @return + * @return SQL string. */ @Override public String renderOrderByElement(String expression, String collation, String order, NullPrecedence nullPrecedence) { diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java index 11ee89c18c..856ffbc9c8 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java @@ -1272,11 +1272,11 @@ public abstract class Dialect implements ConversionContext { } /** - * Apply s limit clause to the query. + * Apply a limit clause to the query. *

            * Typically dialects utilize {@link #supportsVariableLimit() variable} * limit clauses when they support limits. Thus, when building the - * select command we do not actually need to know the limit or the offest + * select command we do not actually need to know the limit or the offset * since we will just be using placeholders. *

            * Here we do still pass along whether or not an offset was specified @@ -1421,7 +1421,7 @@ public abstract class Dialect implements ConversionContext { /** * Get the string to append to SELECT statements to acquire WRITE locks - * for this dialect. Location of the of the returned string is treated + * for this dialect. Location of the returned string is treated * the same as getForUpdateString. * * @param timeout in milliseconds, -1 for indefinite wait and 0 for no wait. @@ -1449,7 +1449,7 @@ public abstract class Dialect implements ConversionContext { /** * Get the string to append to SELECT statements to acquire READ locks - * for this dialect. Location of the of the returned string is treated + * for this dialect. Location of the returned string is treated * the same as getForUpdateString. * * @param timeout in milliseconds, -1 for indefinite wait and 0 for no wait. @@ -1462,7 +1462,7 @@ public abstract class Dialect implements ConversionContext { /** * Get the string to append to SELECT statements to acquire READ locks * for this dialect given the aliases of the columns to be read locked. - * Location of the of the returned string is treated + * Location of the returned string is treated * the same as getForUpdateString. * * @param aliases The columns to be read locked. @@ -1577,7 +1577,7 @@ public abstract class Dialect implements ConversionContext { /** * Some dialects support an alternative means to SELECT FOR UPDATE, - * whereby a "lock hint" is appends to the table name in the from clause. + * whereby a "lock hint" is appended to the table name in the from clause. *

            * contributed by Helge Schulz * @@ -1592,7 +1592,7 @@ public abstract class Dialect implements ConversionContext { } /** * Some dialects support an alternative means to SELECT FOR UPDATE, - * whereby a "lock hint" is appends to the table name in the from clause. + * whereby a "lock hint" is appended to the table name in the from clause. *

            * contributed by Helge Schulz * @@ -1835,7 +1835,7 @@ public abstract class Dialect implements ConversionContext { * @return The Dialect's preferred SQLExceptionConverter, or null to * indicate that the default {@link SQLExceptionConverter} should be used. * - * @see {@link #buildSQLExceptionConversionDelegate()} + * @see #buildSQLExceptionConversionDelegate() * @deprecated {@link #buildSQLExceptionConversionDelegate()} should be * overridden instead. */ @@ -1848,11 +1848,11 @@ public abstract class Dialect implements ConversionContext { * Build an instance of a {@link SQLExceptionConversionDelegate} for * interpreting dialect-specific error or SQLState codes. *

            - * When {@link #buildSQLExceptionConverter} returns null, the default + * When {@link #buildSQLExceptionConverter} returns null, the default * {@link SQLExceptionConverter} is used to interpret SQLState and * error codes. If this method is overridden to return a non-null value, * the default {@link SQLExceptionConverter} will use the returned - * {@link SQLExceptionConversionDelegate} in addition to the following + * {@link SQLExceptionConversionDelegate} in addition to the following * standard delegates: *

              *
            1. a "static" delegate based on the JDBC 4 defined SQLException hierarchy;
            2. @@ -1862,7 +1862,7 @@ public abstract class Dialect implements ConversionContext { *

              * It is strongly recommended that specific Dialect implementations override this * method, since interpretation of a SQL error is much more accurate when based on - * the a vendor-specific ErrorCode rather than the SQLState. + * the vendor-specific ErrorCode rather than the SQLState. *

              * Specific Dialects may override to return whatever is most appropriate for that vendor. * @@ -2626,7 +2626,7 @@ public abstract class Dialect implements ConversionContext { /** * Does this dialect require that references to result variables - * (i.e, select expresssion aliases) in an ORDER BY clause be + * (i.e, select expression aliases) in an ORDER BY clause be * replaced by column positions (1-origin) as defined * by the select clause? @@ -3063,7 +3063,7 @@ public abstract class Dialect implements ConversionContext { /** * By default interpret this based on DatabaseMetaData. * - * @return + * @return The NameQualifierSupport. */ public NameQualifierSupport getNameQualifierSupport() { return null; diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java index 0f31ecc099..282a8f011f 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Ingres9Dialect.java @@ -28,7 +28,7 @@ import org.hibernate.query.spi.QueryEngine; *

            3. Added support for pooled sequences
            4. *
            5. Added support for SELECT queries with limit and offset
            6. *
            7. Added getIdentitySelectString
            8. - *
            9. Modified concatination operator
            10. + *
            11. Modified concatenation operator
            12. *
          * * @author Enrico Schenk diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/IngresDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/IngresDialect.java index 4ea23ebb2f..2ff0dea6e4 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/IngresDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/IngresDialect.java @@ -41,7 +41,7 @@ import org.hibernate.type.StandardBasicTypes; * Perform string casts to varchar; removes space padding. *
        • *
        - * + * * @author Ian Booth * @author Bruce Lunsford * @author Max Rydahl Andersen diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MimerSQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/MimerSQLDialect.java index 28e1bbdfe4..58d8e94ab0 100755 --- a/hibernate-core/src/main/java/org/hibernate/dialect/MimerSQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/MimerSQLDialect.java @@ -29,8 +29,8 @@ public class MimerSQLDialect extends Dialect { private static final int BINARY_MAX_LENGTH = 2000; /** - * Even thoug Mimer SQL supports character and binary columns up to 15 000 in lenght, - * this is also the maximum width of the table (exluding LOBs). To avoid breaking the limit all the + * Even though Mimer SQL supports character and binary columns up to 15 000 in length, + * this is also the maximum width of the table (excluding LOBs). To avoid breaking the limit all the * time we limit the length of the character columns to CHAR_MAX_LENTH, NATIONAL_CHAR_LENGTH for national * characters, and BINARY_MAX_LENGTH for binary types. */ diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Oracle10gDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Oracle10gDialect.java index dc384cb4f2..db487581d4 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Oracle10gDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Oracle10gDialect.java @@ -24,7 +24,7 @@ import org.hibernate.sql.JoinFragment; */ public class Oracle10gDialect extends Oracle9iDialect { /** - * Constructs a Oracle10gDialect + * Constructs an Oracle10gDialect */ public Oracle10gDialect() { super(); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java index 1f765c8473..65ed35762d 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java @@ -135,7 +135,7 @@ public class Oracle8iDialect extends Dialect { private static final int PARAM_LIST_SIZE_LIMIT = 1000; /** - * Constructs a Oracle8iDialect + * Constructs an Oracle8iDialect */ public Oracle8iDialect() { super(); @@ -480,7 +480,7 @@ public class Oracle8iDialect extends Dialect { * implementation... * * @param sqlType The {@link java.sql.Types} mapping type code - * @return The appropriate select cluse fragment + * @return The appropriate select clause fragment */ public String getBasicSelectClauseNullString(int sqlType) { return super.getSelectClauseNullString( sqlType ); @@ -818,8 +818,9 @@ public class Oracle8iDialect extends Dialect { * For Oracle, the FOR UPDATE clause cannot be applied when using ORDER BY, DISTINCT or views. * * @param parameters - * @return - * @see Oracle FOR UPDATE restrictions + * @return {@code true} indicates that the dialect requests that locking be applied by subsequent select; + * {@code false} (the default) indicates that locking should be applied to the main SQL statement.. + @see Oracle FOR UPDATE restrictions */ @Override public boolean useFollowOnLocking(QueryParameters parameters) { diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL81Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL81Dialect.java index cc5b254ab9..203e0f6288 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL81Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQL81Dialect.java @@ -632,7 +632,7 @@ public class PostgreSQL81Dialect extends Dialect { /** * Constraint-name extractor for Postgres constraint violation exceptions. - * Orginally contributed by Denny Bartelt. + * Originally contributed by Denny Bartelt. */ private static final ViolatedConstraintNameExtracter EXTRACTER = new TemplatedViolatedConstraintNameExtracter() { @Override diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/RDMSOS2200Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/RDMSOS2200Dialect.java index f69bcf9ea8..0364094381 100755 --- a/hibernate-core/src/main/java/org/hibernate/dialect/RDMSOS2200Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/RDMSOS2200Dialect.java @@ -135,7 +135,7 @@ public class RDMSOS2200Dialect extends Dialect { * The TIMESTAMP literal format is: YYYY-MM-DD HH:MM:SS[.[FFFFFF]] * * Note that $l (dollar-L) will use the length value if provided. - * Also new for Hibernate3 is the $p percision and $s (scale) parameters + * Also new for Hibernate3 is the $p precision and $s (scale) parameters */ registerColumnType( Types.BIT, "SMALLINT" ); registerColumnType( Types.TINYINT, "SMALLINT" ); @@ -266,7 +266,7 @@ public class RDMSOS2200Dialect extends Dialect { // Dialect method overrides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** - * RDMS does not support qualifing index names with the schema name. + * RDMS does not support qualifying index names with the schema name. *

        * {@inheritDoc} */ diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/ResultColumnReferenceStrategy.java b/hibernate-core/src/main/java/org/hibernate/dialect/ResultColumnReferenceStrategy.java index 6f664df0ac..519a1d8a9c 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/ResultColumnReferenceStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/ResultColumnReferenceStrategy.java @@ -1,59 +1,59 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.dialect; - -/** - * Defines how we need to reference columns in the group-by, having, and order-by - * clauses. - * - * @author Steve Ebersole - */ -public enum ResultColumnReferenceStrategy { - /** - * This strategy says to reference the result columns by the qualified column name - * found in the result source. This strategy is not strictly allowed by ANSI SQL - * but is Hibernate's legacy behavior and is also the fastest of the strategies; thus - * it should be used if supported by the underlying database. - */ - SOURCE, - /** - * For databases which do not support {@link #SOURCE}, ANSI SQL defines two allowable - * approaches. One is to reference the result column by the alias it is given in the - * result source (if it is given an alias). This strategy says to use this approach. - *

        - * The other QNSI SQL compliant approach is {@link #ORDINAL}. - */ - ALIAS, - /** - * For databases which do not support {@link #SOURCE}, ANSI SQL defines two allowable - * approaches. One is to reference the result column by the ordinal position at which - * it appears in the result source. This strategy says to use this approach. - *

        - * The other QNSI SQL compliant approach is {@link #ALIAS}. - */ - ORDINAL; - - /** - * Resolves the strategy by name, in a case insensitive manner. If the name cannot be resolved, {@link #SOURCE} - * is returned as the default. - * - * @param name The strategy name to resolve - * - * @return The resolved strategy - */ - public static ResultColumnReferenceStrategy resolveByName(String name) { - if ( ALIAS.name().equalsIgnoreCase( name ) ) { - return ALIAS; - } - else if ( ORDINAL.name().equalsIgnoreCase( name ) ) { - return ORDINAL; - } - else { - return SOURCE; - } - } -} +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.dialect; + +/** + * Defines how we need to reference columns in the group-by, having, and order-by + * clauses. + * + * @author Steve Ebersole + */ +public enum ResultColumnReferenceStrategy { + /** + * This strategy says to reference the result columns by the qualified column name + * found in the result source. This strategy is not strictly allowed by ANSI SQL + * but is Hibernate's legacy behavior and is also the fastest of the strategies; thus + * it should be used if supported by the underlying database. + */ + SOURCE, + /** + * For databases which do not support {@link #SOURCE}, ANSI SQL defines two allowable + * approaches. One is to reference the result column by the alias it is given in the + * result source (if it is given an alias). This strategy says to use this approach. + *

        + * The other ANSI SQL compliant approach is {@link #ORDINAL}. + */ + ALIAS, + /** + * For databases which do not support {@link #SOURCE}, ANSI SQL defines two allowable + * approaches. One is to reference the result column by the ordinal position at which + * it appears in the result source. This strategy says to use this approach. + *

        + * The other ANSI SQL compliant approach is {@link #ALIAS}. + */ + ORDINAL; + + /** + * Resolves the strategy by name, in a case insensitive manner. If the name cannot be resolved, {@link #SOURCE} + * is returned as the default. + * + * @param name The strategy name to resolve + * + * @return The resolved strategy + */ + public static ResultColumnReferenceStrategy resolveByName(String name) { + if ( ALIAS.name().equalsIgnoreCase( name ) ) { + return ALIAS; + } + else if ( ORDINAL.name().equalsIgnoreCase( name ) ) { + return ORDINAL; + } + else { + return SOURCE; + } + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/lock/SelectLockingStrategy.java b/hibernate-core/src/main/java/org/hibernate/dialect/lock/SelectLockingStrategy.java index 8157f567d2..4fe8e90b53 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/lock/SelectLockingStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/lock/SelectLockingStrategy.java @@ -39,7 +39,7 @@ public class SelectLockingStrategy extends AbstractSelectLockingStrategy { * Construct a locking strategy based on SQL SELECT statements. * * @param lockable The metadata for the entity to be locked. - * @param lockMode Indictates the type of lock to be acquired. + * @param lockMode Indicates the type of lock to be acquired. */ public SelectLockingStrategy(Lockable lockable, LockMode lockMode) { super( lockable, lockMode ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java b/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java index f26b897318..9914a1f162 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java @@ -48,7 +48,7 @@ public class UpdateLockingStrategy implements LockingStrategy { * Construct a locking strategy based on SQL UPDATE statements. * * @param lockable The metadata for the entity to be locked. - * @param lockMode Indictates the type of lock to be acquired. Note that + * @param lockMode Indicates the type of lock to be acquired. Note that * read-locks are not valid for this strategy. */ public UpdateLockingStrategy(Lockable lockable, LockMode lockMode) { diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/SQLServer2005LimitHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/SQLServer2005LimitHandler.java index 34b8b4724b..daed5489f0 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/SQLServer2005LimitHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/SQLServer2005LimitHandler.java @@ -395,7 +395,7 @@ public class SQLServer2005LimitHandler extends AbstractLimitHandler { } /** - * Geneartes a list of {@code IgnoreRange} objects that represent nested sections of the + * Generates a list of {@code IgnoreRange} objects that represent nested sections of the * provided SQL buffer that should be ignored when performing regular expression matches. * * @param sql The SQL buffer. diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/ImmutableEntityEntry.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/ImmutableEntityEntry.java index 0b8135313c..4c8c317fce 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/ImmutableEntityEntry.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/ImmutableEntityEntry.java @@ -22,7 +22,7 @@ import org.hibernate.persister.entity.EntityPersister; /** * An EntityEntry implementation for immutable entities. Note that this implementation is not completely - * immutable in terms of its internal state; the term immutable here refers to the entity is describes. + * immutable in terms of its internal state; the term immutable here refers to the entity it describes. * * @author Gavin King * @author Emmanuel Bernard diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/SerializableBlobProxy.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/SerializableBlobProxy.java index 465a9ffa78..748b2e753b 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/SerializableBlobProxy.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/SerializableBlobProxy.java @@ -31,7 +31,7 @@ public class SerializableBlobProxy implements InvocationHandler, Serializable { * Builds a serializable {@link Blob} wrapper around the given {@link Blob}. * * @param blob The {@link Blob} to be wrapped. - * @see + * @see #generateProxy(java.sql.Blob) */ private SerializableBlobProxy(Blob blob) { this.blob = blob; diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DatasourceConnectionProviderImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DatasourceConnectionProviderImpl.java index 651e339108..36a3afb747 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DatasourceConnectionProviderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DatasourceConnectionProviderImpl.java @@ -25,8 +25,8 @@ import org.hibernate.service.spi.Stoppable; *

        * The {@link DataSource} to use may be specified by either:

          *
        • injection via {@link #setDataSource}
        • - *
        • decaring the {@link DataSource} instance using the {@link Environment#DATASOURCE} config property
        • - *
        • decaring the JNDI name under which the {@link DataSource} can be found via {@link Environment#DATASOURCE} config property
        • + *
        • declaring the {@link DataSource} instance using the {@link Environment#DATASOURCE} config property
        • + *
        • declaring the JNDI name under which the {@link DataSource} can be found via {@link Environment#DATASOURCE} config property
        • *
        * * @author Gavin King diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/spi/JdbcEnvironment.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/spi/JdbcEnvironment.java index 9fc570799d..167c8dae5e 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/spi/JdbcEnvironment.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/spi/JdbcEnvironment.java @@ -74,7 +74,7 @@ public interface JdbcEnvironment extends Service { /** * Obtain the level of support for qualified names. * - * @return + * @return The NameQualifierSupport. */ NameQualifierSupport getNameQualifierSupport(); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/profile/Association.java b/hibernate-core/src/main/java/org/hibernate/engine/profile/Association.java index 5daea67541..00133c385b 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/profile/Association.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/profile/Association.java @@ -18,7 +18,7 @@ public class Association { private final String role; /** - * Constructs a association defining what is to be fetched. + * Constructs an association defining what is to be fetched. * * @param owner The entity owning the association * @param associationPath The path of the association, from the entity diff --git a/hibernate-core/src/main/java/org/hibernate/engine/profile/Fetch.java b/hibernate-core/src/main/java/org/hibernate/engine/profile/Fetch.java index e766393cff..b32a214371 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/profile/Fetch.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/profile/Fetch.java @@ -37,7 +37,7 @@ public class Fetch { /** * The type or style of fetch. For the moment we limit this to * join and select, though technically subselect would be valid - * here as as well; however, to support subselect here would + * here as well; however, to support subselect here would * require major changes to the subselect loading code (which is * needed for other things as well anyway). */ diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java index 6272656aff..287afe8ce5 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/ActionQueue.java @@ -502,7 +502,7 @@ public class ActionQueue { } /** - * Performs cleanup of any held cache softlocks. + * Performs cleanup of any held cache soft locks. * * @param success Was the transaction successful. */ @@ -1102,11 +1102,11 @@ public class ActionQueue { /** * Check if the this {@link BatchIdentifier} has a parent or grand parent - * matching the given {@link BatchIdentifier reference. + * matching the given {@link BatchIdentifier} reference. * * @param batchIdentifier {@link BatchIdentifier} reference * - * @return This {@link BatchIdentifier} has a parent matching the given {@link BatchIdentifier reference + * @return This {@link BatchIdentifier} has a parent matching the given {@link BatchIdentifier} reference */ boolean hasParent(BatchIdentifier batchIdentifier) { return ( diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/BatchFetchQueue.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/BatchFetchQueue.java index c6c1fe8014..08a0d27ad2 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/BatchFetchQueue.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/BatchFetchQueue.java @@ -40,7 +40,7 @@ public class BatchFetchQueue { /** * A map of {@link SubselectFetch subselect-fetch descriptors} keyed by the - * {@link EntityKey) against which the descriptor is registered. + * {@link EntityKey} against which the descriptor is registered. */ private Map subselectsByEntityKey; @@ -52,7 +52,7 @@ public class BatchFetchQueue { * type at a time. */ private Map > batchLoadableEntityKeys; - + /** * Used to hold information about the collections that are currently eligible for batch-fetching. Ultimately * used by {@link #getCollectionBatch} to build collection load batches. @@ -97,7 +97,7 @@ public class BatchFetchQueue { } /** - * Adds a subselect fetch decriptor for the given entity key. + * Adds a subselect fetch descriptor for the given entity key. * * @param key The entity for which to register the subselect fetch. * @param subquery The fetch descriptor. @@ -146,7 +146,7 @@ public class BatchFetchQueue { keysForEntity.add( key ); } } - + /** * After evicting or deleting or loading an entity, we don't @@ -243,7 +243,7 @@ public class BatchFetchQueue { } return false; } - + // collection batch support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -310,7 +310,7 @@ public class BatchFetchQueue { for ( Entry me : map.entrySet() ) { final CollectionEntry ce = me.getKey(); final PersistentCollection collection = me.getValue(); - + if ( ce.getLoadedKey() == null ) { // the loadedKey of the collectionEntry might be null as it might have been reset to null // (see for example Collections.processDereferencedCollection() diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingAction.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingAction.java index 6cfc94efb1..b78fcbfde2 100755 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingAction.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingAction.java @@ -25,7 +25,7 @@ public interface CascadingAction { /** * Cascade the action to the child object. * - * @param session The session within which the cascade is occuring. + * @param session The session within which the cascade is occurring. * @param child The child to which cascading should be performed. * @param entityName The child's entity name * @param anything Anything ;) Typically some form of cascade-local cache @@ -44,7 +44,7 @@ public interface CascadingAction { * Given a collection, get an iterator of the children upon which the * current cascading action should be visited. * - * @param session The session within which the cascade is occuring. + * @param session The session within which the cascade is occurring. * @param collectionType The mapping type of the collection. * @param collection The collection instance. * @return The children iterator. @@ -73,7 +73,7 @@ public interface CascadingAction { * Called (in the case of {@link #requiresNoCascadeChecking} returning true) to validate * that no cascade on the given property is considered a valid semantic. * - * @param session The session witin which the cascade is occurring. + * @param session The session within which the cascade is occurring. * @param parent The property value owner * @param persister The entity persister for the owner * @param propertyType The property type diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingActions.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingActions.java index eef7e7b8cc..586bf1699a 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingActions.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingActions.java @@ -464,7 +464,7 @@ public class CascadingActions { * Given a collection, get an iterator of all its children, loading them * from the database if necessary. * - * @param session The session within which the cascade is occuring. + * @param session The session within which the cascade is occurring. * @param collectionType The mapping type of the collection. * @param collection The collection instance. * diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/ExceptionConverter.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/ExceptionConverter.java index d84fb442ab..586693bc82 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/ExceptionConverter.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/ExceptionConverter.java @@ -26,11 +26,11 @@ public interface ExceptionConverter { RuntimeException convertCommitException(RuntimeException e); /** - * Converts a Hibernate-specific exception into a JPA-specified exception; note that the JPA sepcification makes use + * Converts a Hibernate-specific exception into a JPA-specified exception; note that the JPA specification makes use * of exceptions outside its exception hierarchy, though they are all runtime exceptions. *

        * - * @param e The Hibernate excepton. + * @param e The Hibernate exception. * @param lockOptions The lock options in effect at the time of exception (can be null) * * @return The JPA-specified exception @@ -38,11 +38,11 @@ public interface ExceptionConverter { RuntimeException convert(HibernateException e, LockOptions lockOptions); /** - * Converts a Hibernate-specific exception into a JPA-specified exception; note that the JPA sepcification makes use + * Converts a Hibernate-specific exception into a JPA-specified exception; note that the JPA specification makes use * of exceptions outside its exception hierarchy, though they are all runtime exceptions. *

        * - * @param e The Hibernate excepton. + * @param e The Hibernate exception. * * @return The JPA-specified exception */ diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/LoadQueryInfluencers.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/LoadQueryInfluencers.java index c21a918207..23f51ee282 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/LoadQueryInfluencers.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/LoadQueryInfluencers.java @@ -54,12 +54,19 @@ public class LoadQueryInfluencers implements Serializable { private final EffectiveEntityGraph effectiveEntityGraph = new EffectiveEntityGraph(); + private Boolean readOnly; + public LoadQueryInfluencers() { - this( null ); + this( null, null ); } public LoadQueryInfluencers(SessionFactoryImplementor sessionFactory) { + this(sessionFactory, null); + } + + public LoadQueryInfluencers(SessionFactoryImplementor sessionFactory, Boolean readOnly) { this.sessionFactory = sessionFactory; + this.readOnly = readOnly; } public SessionFactoryImplementor getSessionFactory() { @@ -324,4 +331,11 @@ public class LoadQueryInfluencers implements Serializable { effectiveEntityGraph.applyGraph( (RootGraphImplementor) loadGraph, GraphSemantic.LOAD ); } + public Boolean getReadOnly() { + return readOnly; + } + + public void setReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/PersistenceContext.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/PersistenceContext.java index f8f5e53e8f..1c443905f6 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/PersistenceContext.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/PersistenceContext.java @@ -33,7 +33,7 @@ import org.hibernate.sql.results.spi.LoadContexts; *

      *

      * Often referred to as the "first level cache". - * + * * @author Gavin King * @author Steve Ebersole */ @@ -71,7 +71,7 @@ public interface PersistenceContext { /** * Take ownership of a previously unowned collection, if one. This method returns {@code null} if no such - * collection was previous added () or was previously removed. + * collection was previously added () or was previously removed. *

      * This should indicate the owner is being loaded and we are ready to "link" them. * @@ -87,7 +87,7 @@ public interface PersistenceContext { * @return The batch fetch queue in effect for this persistence context */ BatchFetchQueue getBatchFetchQueue(); - + /** * Clear the state of the persistence context */ @@ -128,9 +128,9 @@ public interface PersistenceContext { /** * Retrieve the cached database snapshot for the requested entity key. *

      - * This differs from {@link #getDatabaseSnapshot} is two important respects:

        + * This differs from {@link #getDatabaseSnapshot} in two important respects:
          *
        1. no snapshot is obtained from the database if not already cached
        2. - *
        3. an entry of {@link #NO_ROW} here is interpretet as an exception
        4. + *
        5. an entry of {@link #NO_ROW} here is interpreted as an exception
        6. *
        * @param key The entity key for which to retrieve the cached snapshot * @return The cached snapshot @@ -250,7 +250,7 @@ public interface PersistenceContext { final boolean disableVersionIncrement); /** - * Generates an appropriate EntityEntry instance and adds it + * Generates an appropriate EntityEntry instance and adds it * to the event source's internal caches. */ EntityEntry addEntry( @@ -269,7 +269,7 @@ public interface PersistenceContext { * Is the given collection associated with this persistence context? */ boolean containsCollection(PersistentCollection collection); - + /** * Is the given proxy associated with this persistence context? */ @@ -286,7 +286,7 @@ public interface PersistenceContext { /** * If a deleted entity instance is re-saved, and it has a proxy, we need to - * reset the identifier of the proxy + * reset the identifier of the proxy */ void reassociateProxy(Object value, Object id); @@ -435,7 +435,7 @@ public interface PersistenceContext { * array, since the array instance is not created until endLoad(). */ void addCollectionHolder(PersistentCollection holder); - + /** * Remove the mapping of collection to holder during eviction * of the owning entity @@ -479,7 +479,7 @@ public interface PersistenceContext { */ Object removeProxy(EntityKey key); - /** + /** * Retrieve the set of EntityKeys representing nullifiable references * @deprecated Use {@link #containsNullifiableEntityKey(Supplier)} or {@link #registerNullifiableEntityKey(EntityKey)} or {@link #isNullifiableEntityKeysEmpty()} */ @@ -497,8 +497,6 @@ public interface PersistenceContext { /** * Provides access to the entity/EntityEntry combos associated with the persistence context in a manner that * is safe from reentrant access. Specifically, it is safe from additions/removals while iterating. - * - * @return */ Map.Entry[] reentrantSafeEntityEntries(); @@ -542,7 +540,7 @@ public interface PersistenceContext { * How deep are we cascaded? */ int getCascadeLevel(); - + /** * Called before cascading */ @@ -558,14 +556,14 @@ public interface PersistenceContext { */ @SuppressWarnings( {"UnusedDeclaration"}) boolean isFlushing(); - + /** - * Called before and after the flushcycle + * Called before and after the flush cycle */ void setFlushing(boolean flushing); /** - * Call this before begining a two-phase load + * Call this before beginning a two-phase load */ void beforeLoad(); @@ -573,9 +571,9 @@ public interface PersistenceContext { * Call this after finishing a two-phase load */ void afterLoad(); - + /** - * Is in a two-phase load? + * Is in a two-phase load? */ boolean isLoadFinished(); /** @@ -632,12 +630,12 @@ public interface PersistenceContext { * To determine the read-only/modifiable setting for a particular entity * or proxy: * @see PersistenceContext#isReadOnly(Object) - * @see org.hibernate.Session#isReadOnly(Object) + * @see org.hibernate.Session#isReadOnly(Object) * * @return true, loaded entities/proxies will be made read-only by default; * false, loaded entities/proxies will be made modifiable by default. * - * @see org.hibernate.Session#isDefaultReadOnly() + * @see org.hibernate.Session#isDefaultReadOnly() */ boolean isDefaultReadOnly(); @@ -746,7 +744,7 @@ public interface PersistenceContext { * Checks if a certain {@link EntityKey} was registered as nullifiable on this {@link PersistenceContext}. * * @param sek a supplier for the EntityKey; this allows to not always needing to create the key; - * for example is the map is known to be empty there is no need to create one to check. + * for example if the map is known to be empty there is no need to create one to check. * @return true if the EntityKey had been registered before using {@link #registerNullifiableEntityKey(EntityKey)} * @see #registerNullifiableEntityKey(EntityKey) */ @@ -799,7 +797,6 @@ public interface PersistenceContext { /** * A read-only iterator on all entities managed by this persistence context - * @return */ Iterator managedEntitiesIterator(); @@ -811,10 +808,10 @@ public interface PersistenceContext { /** * Given an array of "full entity state", extract the portions that represent the natural id - * + * * @param state The attribute state array * @param persister The persister representing the entity type. - * + * * @return The extracted natural id values */ Object[] extractNaturalIdValues(Object[] state, EntityPersister persister); @@ -843,11 +840,12 @@ public interface PersistenceContext { /** * Creates necessary local cross-reference entries. - * @param persister The persister representing the entity type. + * + * @param persister The persister representing the entity type. * @param id The primary key value * @param state Generally the "full entity state array", though could also be the natural id values array * @param previousState Generally the "full entity state array", though could also be the natural id values array. -* Specifically represents the previous values on update, and so is only used with {@link CachedNaturalIdValueSource#UPDATE} + * Specifically represents the previous values on update, and so is only used with {@link CachedNaturalIdValueSource#UPDATE} * @param source Enumeration representing how these values are coming into cache. */ void manageLocalNaturalIdCrossReference( @@ -859,11 +857,24 @@ public interface PersistenceContext { /** * Cleans up local cross-reference entries. + * + * @param persister The persister representing the entity type. + * @param id The primary key value + * @param state Generally the "full entity state array", though could also be the natural id values array + * + * @return The local cached natural id values (could be different from given values). */ Object[] removeLocalNaturalIdCrossReference(EntityPersister persister, Object id, Object[] state); /** * Creates necessary shared (second level cache) cross-reference entries. + * + * @param persister The persister representing the entity type. + * @param id The primary key value + * @param state Generally the "full entity state array", though could also be the natural id values array + * @param previousState Generally the "full entity state array", though could also be the natural id values array. + * Specifically represents the previous values on update, and so is only used with {@link CachedNaturalIdValueSource#UPDATE} + * @param source Enumeration representing how these values are coming into cache. */ void manageSharedNaturalIdCrossReference( EntityPersister persister, @@ -874,11 +885,20 @@ public interface PersistenceContext { /** * Cleans up local cross-reference entries. + * + * @param persister The persister representing the entity type. + * @param id The primary key value + * @param naturalIdValues The natural id values array */ void removeSharedNaturalIdCrossReference(EntityPersister persister, Object id, Object[] naturalIdValues); /** * Given a persister and primary key, find the corresponding cross-referenced natural id values. + * + * @param persister The persister representing the entity type. + * @param pk The primary key value + * + * @return The cross-referenced natural-id values, or {@code null} */ Object[] findCachedNaturalId(EntityPersister persister, Object pk); @@ -886,18 +906,28 @@ public interface PersistenceContext { * Given a persister and natural-id values, find the corresponding cross-referenced primary key. Will return * {@link PersistenceContext.NaturalIdHelper#INVALID_NATURAL_ID_REFERENCE} if the given natural ids are known to * be invalid. + * + * @param persister The persister representing the entity type. + * @param naturalIdValues The natural id value(s) + * + * @return The corresponding cross-referenced primary key, + * {@link PersistenceContext.NaturalIdHelper#INVALID_NATURAL_ID_REFERENCE}, + * or {@code null}. */ Object findCachedNaturalIdResolution(EntityPersister persister, Object[] naturalIdValues); /** * Find all the locally cached primary key cross-reference entries for the given persister. - * @return + * + * @param persister The persister representing the entity type. + * + * @return The primary keys */ Collection getCachedPkResolutions(EntityPersister persister); /** * Part of the "load synchronization process". Responsible for maintaining cross-reference entries - * when natural-id values were found to have changed. Also responsible for tracking the old values + * when natural-id values were found to have changed. Also responsible for tracking the old values * as no longer valid until the next flush because otherwise going to the database would just re-pull * the old values as valid. In this last responsibility, {@link #cleanupFromSynchronizations} is * the inverse process called after flush to clean up those entries. @@ -928,7 +958,7 @@ public interface PersistenceContext { /** * Access to the natural-id helper for this persistence context - * + * * @return This persistence context's natural-id helper */ NaturalIdHelper getNaturalIdHelper(); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java index 212a4713e9..4414e8937a 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java @@ -82,7 +82,7 @@ public class SessionDelegatorBaseImpl implements SessionImplementor { } /** - * Returns the underlying delegate. Be careful that is has a different behavior from the {@link #getDelegate()} + * Returns the underlying delegate. Be careful that it has a different behavior from the {@link #getDelegate()} * method coming from the EntityManager interface which returns the current session. * * @see SessionDelegatorBaseImpl#getDelegate() diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java index 669fb1c515..39fceba78b 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java @@ -120,7 +120,7 @@ public interface SharedSessionContractImplementor /** * Checks whether the session is closed. Provided separately from * {@link #isOpen()} as this method does not attempt any JTA synchronization - * registration, where as {@link #isOpen()} does; which makes this one + * registration, whereas {@link #isOpen()} does; which makes this one * nicer to use for most internal purposes. * * @return {@code true} if the session is closed; {@code false} otherwise. @@ -198,7 +198,7 @@ public interface SharedSessionContractImplementor * Check if an active Transaction is necessary for the update operation to be executed. * If an active Transaction is necessary but it is not then a TransactionRequiredException is raised. * - * @param exceptionMessage, the message to use for the TransactionRequiredException + * @param exceptionMessage the message to use for the TransactionRequiredException */ default void checkTransactionNeededForUpdateOperation(String exceptionMessage) { if ( !isTransactionInProgress() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/UnsavedValueStrategy.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/UnsavedValueStrategy.java index cdb2ca6893..039d28dea3 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/UnsavedValueStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/UnsavedValueStrategy.java @@ -17,7 +17,7 @@ public interface UnsavedValueStrategy { * * @param test The value to be tested * - * @return {@code true} indicates the value corresponds to unsaved data (aka, transient state; {@code false} + * @return {@code true} indicates the value corresponds to unsaved data (aka, transient state); {@code false} * indicates the value does not corresponds to unsaved data (aka, detached state); {@code null} indicates that * this strategy was not able to determine conclusively. */ diff --git a/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionObserver.java b/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionObserver.java index 682ee9bcb2..f096a766be 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionObserver.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/transaction/spi/TransactionObserver.java @@ -15,7 +15,7 @@ public interface TransactionObserver { /** * Callback for processing the beginning of a transaction. *

        - * Do not rely on this being called as the transaction mat be started in a manner other than through the + * Do not rely on this being called as the transaction may be started in a manner other than through the * {@link org.hibernate.Transaction} API. */ public void afterBegin(); diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/AbstractSaveEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/AbstractSaveEventListener.java index 28fc486ffd..9f3b74c652 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/AbstractSaveEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/AbstractSaveEventListener.java @@ -426,7 +426,7 @@ public abstract class AbstractSaveEventListener /** * Handles the calls needed to perform pre-save cascades for the given entity. * - * @param source The session from whcih the save event originated. + * @param source The session from which the save event originated. * @param persister The entity's persister instance. * @param entity The entity to be saved. * @param anything Generally cascade-specific data @@ -460,7 +460,7 @@ public abstract class AbstractSaveEventListener * * @param source The session from which the event originated. * @param persister The entity's persister instance. - * @param entity The entity beng saved. + * @param entity The entity being saved. * @param anything Generally cascade-specific data */ protected void cascadeAfterSave( diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultInitializeCollectionEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultInitializeCollectionEventListener.java index b4fe3caf85..78e4a62050 100755 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultInitializeCollectionEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultInitializeCollectionEventListener.java @@ -89,7 +89,7 @@ public class DefaultInitializeCollectionEventListener implements InitializeColle /** * Try to initialize a collection from the cache * - * @param id The id of the collection of initialize + * @param id The id of the collection to initialize * @param persister The collection persister * @param collection The collection to initialize * @param source The originating session diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java index 726d1f6c80..7ad4bcac3c 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java @@ -568,7 +568,8 @@ public class DefaultLoadEventListener implements LoadEventListener { event.getEntityId(), event.getInstanceToLoad(), event.getLockOptions(), - event.getSession() + event.getSession(), + event.getReadOnly() ); final StatisticsImplementor statistics = event.getSession().getFactory().getStatistics(); diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/EntityCopyAllowedLoggedObserver.java b/hibernate-core/src/main/java/org/hibernate/event/internal/EntityCopyAllowedLoggedObserver.java index 4f83cb302a..86a1a62774 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/EntityCopyAllowedLoggedObserver.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/EntityCopyAllowedLoggedObserver.java @@ -22,7 +22,7 @@ import org.hibernate.pretty.MessageHelper; /** * An {@link org.hibernate.event.spi.EntityCopyObserver} implementation that allows multiple representations of * the same persistent entity to be merged and provides logging of the entity copies that - * that are detected. + * are detected. * * @author Gail Badner */ diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/MergeContext.java b/hibernate-core/src/main/java/org/hibernate/event/internal/MergeContext.java index 6472418984..3f334dcd52 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/MergeContext.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/MergeContext.java @@ -46,7 +46,7 @@ import org.jboss.logging.Logger; *

          *
        • Methods that return collections (e.g., {@link #keySet()}, * {@link #values()}, {@link #entrySet()}) return an - * unnmodifiable view of the collection;
        • + * unmodifiable view of the collection; *
        • If {@link #put(Object mergeEntity, Object) managedEntity} or * {@link #put(Object mergeEntity, Object managedEntity, boolean isOperatedOn)} * is executed and this MergeMap already contains a cross-reference for diff --git a/hibernate-core/src/main/java/org/hibernate/event/service/spi/EventListenerGroup.java b/hibernate-core/src/main/java/org/hibernate/event/service/spi/EventListenerGroup.java index 213f6acb64..2b0779299f 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/service/spi/EventListenerGroup.java +++ b/hibernate-core/src/main/java/org/hibernate/event/service/spi/EventListenerGroup.java @@ -40,7 +40,7 @@ public interface EventListenerGroup extends Serializable { /** * @deprecated this is not the most efficient way for iterating the event listeners. * See {@link #fireEventOnEachListener(Object, BiConsumer)} and its overloaded variants for better alternatives. - * @return + * @return The Iterable. */ @Deprecated public Iterable listeners(); diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/AbstractPreDatabaseOperationEvent.java b/hibernate-core/src/main/java/org/hibernate/event/spi/AbstractPreDatabaseOperationEvent.java index 426f385db4..40f8fad0e3 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/AbstractPreDatabaseOperationEvent.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/AbstractPreDatabaseOperationEvent.java @@ -24,9 +24,10 @@ public abstract class AbstractPreDatabaseOperationEvent /** * Constructs an event containing the pertinent information. - * @param source The session from which the event originated. - * @param entity The entity to be invloved in the database operation. - * @param id The entity id to be invloved in the database operation. + * + * @param source The session from which the event originated. + * @param entity The entity to be involved in the database operation. + * @param id The entity id to be involved in the database operation. * @param persister The entity's persister. */ public AbstractPreDatabaseOperationEvent( diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/DeleteEvent.java b/hibernate-core/src/main/java/org/hibernate/event/spi/DeleteEvent.java index f7448dcb0d..46e6ec1983 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/DeleteEvent.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/DeleteEvent.java @@ -55,7 +55,7 @@ public class DeleteEvent extends AbstractEvent { } /** - * Returns the encapsulated entity to be deleed. + * Returns the encapsulated entity to be deleted. * * @return The entity to be deleted. */ @@ -66,11 +66,11 @@ public class DeleteEvent extends AbstractEvent { public String getEntityName() { return entityName; } - + public boolean isCascadeDeleteEnabled() { return cascadeDeleteEnabled; } - + public boolean isOrphanRemovalBeforeUpdates() { return orphanRemovalBeforeUpdates; } diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/LoadEvent.java b/hibernate-core/src/main/java/org/hibernate/event/spi/LoadEvent.java index bfb2aaf68d..1b4dbbdbf7 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/LoadEvent.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/LoadEvent.java @@ -44,21 +44,22 @@ public class LoadEvent extends AbstractEvent { private boolean isAssociationFetch; private Object result; private PostLoadEvent postLoadEvent; + private Boolean readOnly; - public LoadEvent(Object entityId, Object instanceToLoad, EventSource source) { - this( entityId, null, instanceToLoad, DEFAULT_LOCK_OPTIONS, false, source ); + public LoadEvent(Object entityId, Object instanceToLoad, EventSource source, Boolean readOnly) { + this( entityId, null, instanceToLoad, DEFAULT_LOCK_OPTIONS, false, source, readOnly ); } - public LoadEvent(Object entityId, String entityClassName, LockMode lockMode, EventSource source) { - this( entityId, entityClassName, null, lockMode, false, source ); + public LoadEvent(Object entityId, String entityClassName, LockMode lockMode, EventSource source, Boolean readOnly) { + this( entityId, entityClassName, null, lockMode, false, source, readOnly ); } - public LoadEvent(Object entityId, String entityClassName, LockOptions lockOptions, EventSource source) { - this( entityId, entityClassName, null, lockOptions, false, source ); + public LoadEvent(Object entityId, String entityClassName, LockOptions lockOptions, EventSource source, Boolean readOnly) { + this( entityId, entityClassName, null, lockOptions, false, source, readOnly ); } - public LoadEvent(Object entityId, String entityClassName, boolean isAssociationFetch, EventSource source) { - this( entityId, entityClassName, null, DEFAULT_LOCK_OPTIONS, isAssociationFetch, source ); + public LoadEvent(Object entityId, String entityClassName, boolean isAssociationFetch, EventSource source, Boolean readOnly) { + this( entityId, entityClassName, null, DEFAULT_LOCK_OPTIONS, isAssociationFetch, source, readOnly ); } private LoadEvent( @@ -67,14 +68,16 @@ public class LoadEvent extends AbstractEvent { Object instanceToLoad, LockMode lockMode, boolean isAssociationFetch, - EventSource source) { + EventSource source, + Boolean readOnly) { this( entityId, entityClassName, instanceToLoad, lockMode == DEFAULT_LOCK_MODE ? DEFAULT_LOCK_OPTIONS : new LockOptions().setLockMode( lockMode ), isAssociationFetch, - source + source, + readOnly ); } @@ -84,7 +87,8 @@ public class LoadEvent extends AbstractEvent { Object instanceToLoad, LockOptions lockOptions, boolean isAssociationFetch, - EventSource source) { + EventSource source, + Boolean readOnly) { super( source ); @@ -105,6 +109,7 @@ public class LoadEvent extends AbstractEvent { this.lockOptions = lockOptions; this.isAssociationFetch = isAssociationFetch; this.postLoadEvent = new PostLoadEvent( source ); + this.readOnly = readOnly; } public Object getEntityId() { @@ -193,4 +198,12 @@ public class LoadEvent extends AbstractEvent { public void setPostLoadEvent(PostLoadEvent postLoadEvent) { this.postLoadEvent = postLoadEvent; } + + public Boolean getReadOnly() { + return readOnly; + } + + public void setReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/PostInsertEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/spi/PostInsertEventListener.java index 768bd0d0da..3809b15daa 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/PostInsertEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/PostInsertEventListener.java @@ -9,8 +9,8 @@ package org.hibernate.event.spi; import java.io.Serializable; /** - * Called after insterting an item in the datastore - * + * Called after inserting an item in the datastore + * * @author Gavin King * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/event/spi/PreDeleteEvent.java b/hibernate-core/src/main/java/org/hibernate/event/spi/PreDeleteEvent.java index 63270c9d85..ed220d8269 100755 --- a/hibernate-core/src/main/java/org/hibernate/event/spi/PreDeleteEvent.java +++ b/hibernate-core/src/main/java/org/hibernate/event/spi/PreDeleteEvent.java @@ -43,7 +43,7 @@ public class PreDeleteEvent /** * Getter for property 'deletedState'. This is the entity state at the - * time of deletion (useful for optomistic locking and such). + * time of deletion (useful for optimistic locking and such). * * @return Value for property 'deletedState'. */ diff --git a/hibernate-core/src/main/java/org/hibernate/graph/internal/AbstractGraphNode.java b/hibernate-core/src/main/java/org/hibernate/graph/internal/AbstractGraphNode.java index 8d32eb8662..7a1accefbe 100644 --- a/hibernate-core/src/main/java/org/hibernate/graph/internal/AbstractGraphNode.java +++ b/hibernate-core/src/main/java/org/hibernate/graph/internal/AbstractGraphNode.java @@ -32,7 +32,7 @@ public abstract class AbstractGraphNode implements GraphNodeImplementor { protected void verifyMutability() { if ( !isMutable() ) { - throw new IllegalStateException( "Cannot mutable immutable graph node" ); + throw new IllegalStateException( "Cannot mutate immutable graph node" ); } } } diff --git a/hibernate-core/src/main/java/org/hibernate/graph/package-info.java b/hibernate-core/src/main/java/org/hibernate/graph/package-info.java index fd9fd22b5a..dd92634cfe 100644 --- a/hibernate-core/src/main/java/org/hibernate/graph/package-info.java +++ b/hibernate-core/src/main/java/org/hibernate/graph/package-info.java @@ -8,7 +8,7 @@ /** * Hibernate's (extended) support for JPA's entity graphs * - * @apiNote This entire package (including sub-ppackages) is considered incubating + * @apiNote This entire package (including sub-packages) is considered incubating */ @Incubating package org.hibernate.graph; diff --git a/hibernate-core/src/main/java/org/hibernate/id/IdentifierGeneratorHelper.java b/hibernate-core/src/main/java/org/hibernate/id/IdentifierGeneratorHelper.java index 8f021d2417..228ac61f27 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/IdentifierGeneratorHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/id/IdentifierGeneratorHelper.java @@ -46,7 +46,7 @@ public final class IdentifierGeneratorHelper { /** * Marker object returned from {@link IdentifierGenerator#generate} to indicate that the entity's identifier will - * be generated as part of the datbase insertion. + * be generated as part of the database insertion. */ public static final Serializable POST_INSERT_INDICATOR = new Serializable() { @Override @@ -80,7 +80,7 @@ public final class IdentifierGeneratorHelper { } /** - * Extract the value from the result set (which is assumed to already have been positioned to the apopriate row) + * Extract the value from the result set (which is assumed to already have been positioned to the appropriate row) * and wrp it in the appropriate Java numeric type. * * @param rs The result set from which to extract the value. diff --git a/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java index b133dbdb04..594ab212d7 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java @@ -46,7 +46,7 @@ import org.hibernate.type.Type; /** * A hilo IdentifierGenerator that returns a Long, constructed using - * a hi/lo algorithm. The hi value MUST be fetched in a seperate transaction + * a hi/lo algorithm. The hi value MUST be fetched in a separate transaction * to the Session transaction so the generator must be able to obtain * a new connection and commit it. Hence this implementation may not * be used when the user is supplying connections. In this diff --git a/hibernate-core/src/main/java/org/hibernate/id/PersistentIdentifierGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/PersistentIdentifierGenerator.java index ba71e8ae17..6529124f98 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/PersistentIdentifierGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/PersistentIdentifierGenerator.java @@ -53,7 +53,7 @@ public interface PersistentIdentifierGenerator extends IdentifierGenerator, Expo String CATALOG = "catalog"; /** - * The key under whcih to find the {@link org.hibernate.boot.model.naming.ObjectNameNormalizer} in the config param map. + * The key under which to find the {@link org.hibernate.boot.model.naming.ObjectNameNormalizer} in the config param map. */ String IDENTIFIER_NORMALIZER = "identifier_normalizer"; diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/InitialValueAwareOptimizer.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/InitialValueAwareOptimizer.java index 13e042acf6..079553288d 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/InitialValueAwareOptimizer.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/InitialValueAwareOptimizer.java @@ -7,7 +7,7 @@ package org.hibernate.id.enhanced; /** - * Marker interface for optimizer which wish to know the user-specified initial value. + * Marker interface for optimizer which wishes to know the user-specified initial value. *

          * Used instead of constructor injection since that is already a public understanding and * because not all optimizers care. diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java index 817fee5846..7a69f1bf7b 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java @@ -283,7 +283,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab } /** - * The value in {@link #getSegmentColumnName segment column} which + * The value in {@link #getSegmentColumnName segment column} * corresponding to this generator instance. In other words this value * indicates the row in which this generator instance will store values. * diff --git a/hibernate-core/src/main/java/org/hibernate/id/factory/IdentifierGeneratorFactory.java b/hibernate-core/src/main/java/org/hibernate/id/factory/IdentifierGeneratorFactory.java index c00e6eb585..f3e4847930 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/factory/IdentifierGeneratorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/id/factory/IdentifierGeneratorFactory.java @@ -40,7 +40,7 @@ public interface IdentifierGeneratorFactory { * * @param strategy The generation strategy. * @param type The mapping type for the identifier values. - * @param config Any configuraion properties given in the generator mapping. + * @param config Any configuration properties given in the generator mapping. * * @return The appropriate generator instance. */ diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/IdentifierGeneratingInsert.java b/hibernate-core/src/main/java/org/hibernate/id/insert/IdentifierGeneratingInsert.java index f85432748b..064ccb3866 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/IdentifierGeneratingInsert.java +++ b/hibernate-core/src/main/java/org/hibernate/id/insert/IdentifierGeneratingInsert.java @@ -1,22 +1,22 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.id.insert; -import org.hibernate.dialect.Dialect; -import org.hibernate.sql.Insert; - -/** - * Nothing more than a distinguishing subclass of Insert used to indicate - * intent. Some subclasses of this also provided some additional - * functionality or semantic to the genernated SQL statement string. - * - * @author Steve Ebersole - */ -public class IdentifierGeneratingInsert extends Insert { - public IdentifierGeneratingInsert(Dialect dialect) { - super( dialect ); - } -} +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.id.insert; +import org.hibernate.dialect.Dialect; +import org.hibernate.sql.Insert; + +/** + * Nothing more than a distinguishing subclass of Insert used to indicate + * intent. Some subclasses of this also provided some additional + * functionality or semantic to the generated SQL statement string. + * + * @author Steve Ebersole + */ +public class IdentifierGeneratingInsert extends Insert { + public IdentifierGeneratingInsert(Dialect dialect) { + super( dialect ); + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java index 8c77f12411..2197be372e 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java @@ -179,7 +179,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont this.transactionCoordinator = sharedOptions.getTransactionCoordinator(); this.jdbcCoordinator = sharedOptions.getJdbcCoordinator(); - // todo : "wrap" the transaction to no-op cmmit/rollback attempts? + // todo : "wrap" the transaction to no-op comit/rollback attempts? this.currentHibernateTransaction = sharedOptions.getTransaction(); if ( sharedOptions.shouldAutoJoinTransactions() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java index 5069004354..471a8754f5 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java @@ -1114,8 +1114,8 @@ public interface CoreMessageLogger extends BasicLogger { void unableToJoinTransaction(String transactionStrategy); @LogMessage(level = INFO) - @Message(value = "Error performing load command : %s", id = 327) - void unableToLoadCommand(HibernateException e); + @Message(value = "Error performing load command", id = 327) + void unableToLoadCommand(@Cause HibernateException e); @LogMessage(level = WARN) @Message(value = "Unable to load/access derby driver class sysinfo to check versions : %s", id = 328) diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java index 3577db0cbe..ff4eb2937e 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java @@ -21,7 +21,6 @@ import java.util.Set; import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; -import java.util.regex.Pattern; import javax.naming.Reference; import javax.naming.StringRefAddr; import javax.persistence.EntityGraph; @@ -159,7 +158,6 @@ import org.jboss.logging.Logger; */ public final class SessionFactoryImpl implements SessionFactoryImplementor { private static final CoreMessageLogger LOG = CoreLogging.messageLogger( SessionFactoryImpl.class ); - private static final Pattern LISTENER_SEPARATION_PATTERN = Pattern.compile( " ," ); private final String name; private final String uuid; @@ -212,7 +210,7 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor { .getService( SessionFactoryServiceRegistryFactory.class ) .buildServiceRegistry( this, options ); - prepareEventListeners( bootMetamodel ); + bootMetamodel.initSessionFactory( this ); final CfgXmlAccessService cfgXmlAccessService = serviceRegistry.getService( CfgXmlAccessService.class ); @@ -447,33 +445,6 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor { getCache().prime( regionConfigs ); } - private void prepareEventListeners(MetadataImplementor metadata) { - final EventListenerRegistry eventListenerRegistry = serviceRegistry.getService( EventListenerRegistry.class ); - final ConfigurationService cfgService = serviceRegistry.getService( ConfigurationService.class ); - final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class ); - - eventListenerRegistry.prepare( metadata ); - - for ( Map.Entry entry : ( (Map) cfgService.getSettings() ).entrySet() ) { - if ( !(entry.getKey() instanceof String) ) { - continue; - } - final String propertyName = (String) entry.getKey(); - if ( !propertyName.startsWith( org.hibernate.jpa.AvailableSettings.EVENT_LISTENER_PREFIX ) ) { - continue; - } - final String eventTypeName = propertyName.substring( - org.hibernate.jpa.AvailableSettings.EVENT_LISTENER_PREFIX.length() + 1 - ); - final EventType eventType = EventType.resolveEventTypeByName( eventTypeName ); - final EventListenerGroup eventListenerGroup = eventListenerRegistry.getEventListenerGroup( eventType ); - for ( String listenerImpl : LISTENER_SEPARATION_PATTERN.split( ( (String) entry.getValue() ) ) ) { - //noinspection unchecked - eventListenerGroup.appendListener( instantiate( listenerImpl, classLoaderService ) ); - } - } - } - private Object instantiate(String listenerImpl, ClassLoaderService classLoaderService) { try { return classLoaderService.classForName( listenerImpl ).newInstance(); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java index 809dcd0196..e760dc4889 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java @@ -902,7 +902,7 @@ public final class SessionImpl LoadEvent event = loadEvent; loadEvent = null; if ( event == null ) { - event = new LoadEvent( id, object, this ); + event = new LoadEvent( id, object, this, getReadOnlyFromLoadQueryInfluencers() ); } else { event.setEntityClassName( null ); @@ -1033,7 +1033,7 @@ public final class SessionImpl */ private LoadEvent recycleEventInstance(final LoadEvent event, final Object id, final String entityName) { if ( event == null ) { - return new LoadEvent( id, entityName, true, this ); + return new LoadEvent( id, entityName, true, this, getReadOnlyFromLoadQueryInfluencers() ); } else { event.setEntityClassName( entityName ); @@ -2192,12 +2192,12 @@ public final class SessionImpl @SuppressWarnings("unchecked") protected T doGetReference(Object id) { if ( this.lockOptions != null ) { - LoadEvent event = new LoadEvent( id, entityPersister.getEntityName(), lockOptions, SessionImpl.this ); + LoadEvent event = new LoadEvent( id, entityPersister.getEntityName(), lockOptions, SessionImpl.this, getReadOnlyFromLoadQueryInfluencers() ); fireLoad( event, LoadEventListener.LOAD ); return (T) event.getResult(); } - LoadEvent event = new LoadEvent( id, entityPersister.getEntityName(), false, SessionImpl.this ); + LoadEvent event = new LoadEvent( id, entityPersister.getEntityName(), false, SessionImpl.this, getReadOnlyFromLoadQueryInfluencers() ); boolean success = false; try { fireLoad( event, LoadEventListener.LOAD ); @@ -2228,12 +2228,12 @@ public final class SessionImpl @SuppressWarnings("unchecked") protected final T doLoad(Object id) { if ( this.lockOptions != null ) { - LoadEvent event = new LoadEvent( id, entityPersister.getEntityName(), lockOptions, SessionImpl.this ); + LoadEvent event = new LoadEvent( id, entityPersister.getEntityName(), lockOptions, SessionImpl.this, getReadOnlyFromLoadQueryInfluencers() ); fireLoad( event, LoadEventListener.GET ); return (T) event.getResult(); } - LoadEvent event = new LoadEvent( id, entityPersister.getEntityName(), false, SessionImpl.this ); + LoadEvent event = new LoadEvent( id, entityPersister.getEntityName(), false, SessionImpl.this, getReadOnlyFromLoadQueryInfluencers() ); boolean success = false; try { fireLoad( event, LoadEventListener.GET ); @@ -2755,7 +2755,8 @@ public final class SessionImpl try { getLoadQueryInfluencers().getEffectiveEntityGraph().applyConfiguredGraph( properties ); - + Boolean readOnly = properties == null ? null : (Boolean) properties.get( QueryHints.HINT_READONLY ); + getLoadQueryInfluencers().setReadOnly( readOnly ); final IdentifierLoadAccess loadAccess = byId( entityClass ); loadAccess.with( determineAppropriateLocalCacheMode( properties ) ); @@ -2810,6 +2811,7 @@ public final class SessionImpl } finally { getLoadQueryInfluencers().getEffectiveEntityGraph().clear(); + getLoadQueryInfluencers().setReadOnly( null ); } } @@ -3221,4 +3223,12 @@ public final class SessionImpl ( (FilterImpl) loadQueryInfluencers.getEnabledFilter( filterName ) ).afterDeserialize( getFactory() ); } } + + private Boolean getReadOnlyFromLoadQueryInfluencers() { + Boolean readOnly = null; + if ( loadQueryInfluencers != null ) { + readOnly = loadQueryInfluencers.getReadOnly(); + } + return readOnly; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/BytesHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/BytesHelper.java index a822200afb..944d1b83ef 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/BytesHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/BytesHelper.java @@ -71,17 +71,16 @@ public final class BytesHelper { fromLong(longValue, bytes, 0); return bytes; } - + /** * Interpret a long as its binary form * * @param longValue The long to interpret to binary * @param dest the destination array. * @param destPos starting position in the destination array. - * @return The binary */ public static void fromLong(long longValue, byte[] dest, int destPos) { - + dest[destPos] = (byte) ( longValue >> 56 ); dest[destPos + 1] = (byte) ( ( longValue << 8 ) >> 56 ); dest[destPos + 2] = (byte) ( ( longValue << 16 ) >> 56 ); @@ -102,7 +101,7 @@ public final class BytesHelper { public static long asLong(byte[] bytes) { return asLong(bytes, 0); } - + /** * Interpret the binary representation of a long. * diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/Cloneable.java b/hibernate-core/src/main/java/org/hibernate/internal/util/Cloneable.java index ef7f431732..dc51d40714 100755 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/Cloneable.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/Cloneable.java @@ -16,7 +16,7 @@ import java.security.PrivilegedAction; import org.hibernate.HibernateException; /** - * An object that is shallow-coneable + * An object that is shallow-cloneable * * @author Steve Ebersole */ @@ -87,7 +87,7 @@ public class Cloneable { } finally { if ( beanInfo != null ) { - // release the jdk internal caches everytime to ensure this + // release the jdk internal caches every time to ensure this // plays nicely with destroyable class-loaders Introspector.flushFromCaches( getClass() ); } @@ -107,7 +107,7 @@ public class Cloneable { } finally { if ( beanInfo != null ) { - // release the jdk internal caches everytime to ensure this + // release the jdk internal caches every time to ensure this // plays nicely with destroyable class-loaders Introspector.flushFromCaches( getClass() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/ConfigHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/ConfigHelper.java index f87581521c..329e3a17e8 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/ConfigHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/ConfigHelper.java @@ -30,7 +30,7 @@ public final class ConfigHelper { /** * Try to locate a local URL representing the incoming path. The first attempt * assumes that the incoming path is an actual URL string (file://, etc). If this - * does not work, then the next attempts try to locate this UURL as a java system + * does not work, then the next attempts try to locate this URL as a java system * resource. * * @param path The path representing the config location. diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java index 4fbff725c4..423e38241e 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java @@ -191,7 +191,7 @@ public final class ReflectHelper { * Is this member publicly accessible. * * @param clazz The class which defines the member - * @param member The memeber. + * @param member The member. * @return True if the member is publicly accessible, false otherwise. */ public static boolean isPublic(Class clazz, Member member) { @@ -299,7 +299,7 @@ public final class ReflectHelper { * Determine is the given class is declared final. * * @param clazz The class to check. - * @return True if the class is final, flase otherwise. + * @return True if the class is final, false otherwise. */ public static boolean isFinalClass(Class clazz) { return Modifier.isFinal( clazz.getModifiers() ); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java index c3746ba1c8..50d4477b1b 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java @@ -592,7 +592,7 @@ public final class StringHelper { /** * Generates a root alias by truncating the "root name" defined by - * the incoming decription and removing/modifying any non-valid + * the incoming description and removing/modifying any non-valid * alias characters. * * @param description The root name from which to generate a root alias. diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/collections/Stack.java b/hibernate-core/src/main/java/org/hibernate/internal/util/collections/Stack.java index 8bc2c95851..086895cc8a 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/collections/Stack.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/collections/Stack.java @@ -48,7 +48,7 @@ public interface Stack { boolean isEmpty(); /** - * Remmove all elements from the stack + * Remove all elements from the stack */ void clear(); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/config/ConfigurationHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/config/ConfigurationHelper.java index ca87425780..bd890ccad0 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/config/ConfigurationHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/config/ConfigurationHelper.java @@ -268,7 +268,7 @@ public final class ConfigurationHelper { * replace a property by a starred version * * @param props properties to check - * @param key proeprty to mask + * @param key property to mask * * @return cloned and masked properties */ diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/xml/Origin.java b/hibernate-core/src/main/java/org/hibernate/internal/util/xml/Origin.java index 211f57b442..9c1a9955ca 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/xml/Origin.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/xml/Origin.java @@ -15,7 +15,7 @@ import java.io.Serializable; */ public interface Origin extends Serializable { /** - * Retrieve the type of origin. This is not a discrete set, but might be somethign like + * Retrieve the type of origin. This is not a discrete set, but might be something like * {@code file} for file protocol URLs, or {@code resource} for classpath resource lookups. * * @return The origin type. diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/xml/XMLHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/xml/XMLHelper.java index 4239bd0ded..b44997c02e 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/xml/XMLHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/xml/XMLHelper.java @@ -14,7 +14,7 @@ import org.dom4j.io.SAXReader; import org.xml.sax.EntityResolver; /** - * Small helper class that lazy loads DOM and SAX reader and keep them for fast use afterwards. + * Small helper class that lazily loads DOM and SAX reader and keep them for fast use afterwards. * * @deprecated Currently only used for integration with HCANN. The rest of Hibernate uses StAX now * for XML processing. See {@link org.hibernate.boot.jaxb.internal.stax} diff --git a/hibernate-core/src/main/java/org/hibernate/jdbc/BatchedTooManyRowsAffectedException.java b/hibernate-core/src/main/java/org/hibernate/jdbc/BatchedTooManyRowsAffectedException.java index 30c38714d1..f13c7a42c9 100644 --- a/hibernate-core/src/main/java/org/hibernate/jdbc/BatchedTooManyRowsAffectedException.java +++ b/hibernate-core/src/main/java/org/hibernate/jdbc/BatchedTooManyRowsAffectedException.java @@ -1,28 +1,28 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.jdbc; - - -/** - * Much like {@link TooManyRowsAffectedException}, indicates that more - * rows than what we were expcecting were affected. Additionally, this form - * occurs from a batch and carries along the batch positon that failed. - * - * @author Steve Ebersole - */ -public class BatchedTooManyRowsAffectedException extends TooManyRowsAffectedException { - private final int batchPosition; - - public BatchedTooManyRowsAffectedException(String message, int expectedRowCount, int actualRowCount, int batchPosition) { - super( message, expectedRowCount, actualRowCount ); - this.batchPosition = batchPosition; - } - - public int getBatchPosition() { - return batchPosition; - } -} +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.jdbc; + + +/** + * Much like {@link TooManyRowsAffectedException}, indicates that more + * rows than what we were expecting were affected. Additionally, this form + * occurs from a batch and carries along the batch position that failed. + * + * @author Steve Ebersole + */ +public class BatchedTooManyRowsAffectedException extends TooManyRowsAffectedException { + private final int batchPosition; + + public BatchedTooManyRowsAffectedException(String message, int expectedRowCount, int actualRowCount, int batchPosition) { + super( message, expectedRowCount, actualRowCount ); + this.batchPosition = batchPosition; + } + + public int getBatchPosition() { + return batchPosition; + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/jdbc/WorkExecutor.java b/hibernate-core/src/main/java/org/hibernate/jdbc/WorkExecutor.java index 718b459533..3f5db464b5 100644 --- a/hibernate-core/src/main/java/org/hibernate/jdbc/WorkExecutor.java +++ b/hibernate-core/src/main/java/org/hibernate/jdbc/WorkExecutor.java @@ -28,8 +28,8 @@ public class WorkExecutor { * @param work The @link ReturningWork} instance encapsulating the discrete work * @param connection The connection on which to perform the work. * - * @return null>. - * + * @return null. + * * @throws SQLException Thrown during execution of the underlying JDBC interaction. * @throws org.hibernate.HibernateException Generally indicates a wrapped SQLException. */ diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/jpa/AvailableSettings.java index 7d4641856c..a3282b11f3 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/AvailableSettings.java @@ -236,7 +236,7 @@ public interface AvailableSettings { * enabled - Do the build *

        • *
        • - * disabled - Do not so the build + * disabled - Do not do the build *
        • *
        • * ignoreUnsupported - Do the build, but ignore any non-JPA features that would otherwise diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/HibernateEntityManager.java b/hibernate-core/src/main/java/org/hibernate/jpa/HibernateEntityManager.java index 54a53a7e06..bf82f7a02d 100755 --- a/hibernate-core/src/main/java/org/hibernate/jpa/HibernateEntityManager.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/HibernateEntityManager.java @@ -17,7 +17,7 @@ import org.hibernate.query.QueryProducer; * * @author Gavin King * - * @deprecated (snce 5.2) Use Session (or SessionImplementor), as it now extends EntityManager directly + * @deprecated (since 5.2) Use Session (or SessionImplementor), as it now extends EntityManager directly */ @Deprecated public interface HibernateEntityManager extends EntityManager, QueryProducer { diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/internal/util/XmlHelper.java b/hibernate-core/src/main/java/org/hibernate/jpa/internal/util/XmlHelper.java index 652b398537..3269811cc1 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/internal/util/XmlHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/internal/util/XmlHelper.java @@ -29,7 +29,7 @@ public final class XmlHelper { * * @param element The parent element * @param tagName The name of the desired child - * @return An interator of children or null if element is null. + * @return An iterator of children or null if element is null. */ public static Iterator getChildrenByTagName( Element element, diff --git a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/MultiIdEntityLoaderStandardImpl.java b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/MultiIdEntityLoaderStandardImpl.java index 07c552268b..cd9d28badd 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/MultiIdEntityLoaderStandardImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/MultiIdEntityLoaderStandardImpl.java @@ -15,12 +15,14 @@ import java.util.List; import org.hibernate.LockMode; import org.hibernate.LockOptions; +import org.hibernate.Session; import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.spi.BatchFetchQueue; import org.hibernate.engine.spi.EntityEntry; import org.hibernate.engine.spi.EntityKey; +import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; @@ -136,7 +138,8 @@ public class MultiIdEntityLoaderStandardImpl implements MultiIdEntityLoader implements MultiIdEntityLoader implements MultiIdEntityLoader orderedMappings = new ArrayList<>(); /** - * Stack of PersistentClass being process. Last in the list is the highest in the stack. + * Stack of PersistentClass being processed. Last in the list is the highest in the stack. */ private List stackOfPersistentClassesBeingProcessed = new ArrayList<>(); private MappingMetamodel metamodel; @@ -190,7 +190,7 @@ public class MetadataContext { /** * Given a Hibernate {@link PersistentClass}, locate the corresponding JPA {@link org.hibernate.type.EntityType} - * implementation. May retur null if the given {@link PersistentClass} has not yet been processed. + * implementation. May return null if the given {@link PersistentClass} has not yet been processed. * * @param persistentClass The Hibernate (config time) metamodel instance representing an entity. * @@ -203,7 +203,7 @@ public class MetadataContext { /** * Given a Java {@link Class}, locate the corresponding JPA {@link org.hibernate.type.EntityType}. May - * return null which could means that no such mapping exists at least at this time. + * return null which could mean that no such mapping exists at least at this time. * * @param javaType The java class. * diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/EmbeddedDomainType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/EmbeddedDomainType.java index a78ec86e0c..4a88adebb8 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/EmbeddedDomainType.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/EmbeddedDomainType.java @@ -7,7 +7,7 @@ package org.hibernate.metamodel.model.domain; /** - * Hibernate extension to the JPA {@link } contract. + * Hibernate extension to the JPA {@link javax.persistence.metamodel.EntityType} contract. * * @deprecated (since 6.0) Use {@link EmbeddableDomainType} instead. Originally intended * to describe the actual usage of an embeddable (the embedded) because it was intended diff --git a/hibernate-core/src/main/java/org/hibernate/param/DynamicFilterParameterSpecification.java b/hibernate-core/src/main/java/org/hibernate/param/DynamicFilterParameterSpecification.java index def45bdf99..b4387dd7d3 100644 --- a/hibernate-core/src/main/java/org/hibernate/param/DynamicFilterParameterSpecification.java +++ b/hibernate-core/src/main/java/org/hibernate/param/DynamicFilterParameterSpecification.java @@ -17,7 +17,7 @@ import org.hibernate.type.Type; /** * A specialized ParameterSpecification impl for dealing with a dynamic filter parameters. - * + * * @see org.hibernate.Session#enableFilter(String) * * @author Steve Ebersole @@ -32,7 +32,7 @@ public class DynamicFilterParameterSpecification implements ParameterSpecificati * * @param filterName The name of the filter * @param parameterName The name of the parameter - * @param definedParameterType The paremeter type specified on the filter metadata + * @param definedParameterType The parameter type specified on the filter metadata */ public DynamicFilterParameterSpecification( String filterName, diff --git a/hibernate-core/src/main/java/org/hibernate/param/ParameterBinder.java b/hibernate-core/src/main/java/org/hibernate/param/ParameterBinder.java index 6a88b02fe8..33ee2a49cc 100644 --- a/hibernate-core/src/main/java/org/hibernate/param/ParameterBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/param/ParameterBinder.java @@ -25,7 +25,7 @@ public interface ParameterBinder { * @param position The position from which to start binding value(s). * * @return The number of sql bind positions "eaten" by this bind operation. - * @throws java.sql.SQLException Indicates problems performing the JDBC biind operation. + * @throws java.sql.SQLException Indicates problems performing the JDBC bind operation. */ int bind(PreparedStatement statement, QueryParameters qp, SharedSessionContractImplementor session, int position) throws SQLException; diff --git a/hibernate-core/src/main/java/org/hibernate/param/ParameterSpecification.java b/hibernate-core/src/main/java/org/hibernate/param/ParameterSpecification.java index 2c1d64a9d1..062235cd0a 100644 --- a/hibernate-core/src/main/java/org/hibernate/param/ParameterSpecification.java +++ b/hibernate-core/src/main/java/org/hibernate/param/ParameterSpecification.java @@ -18,7 +18,7 @@ import org.hibernate.type.Type; */ public interface ParameterSpecification extends ParameterBinder { /** - * Get the type which we are expeting for a bind into this parameter based + * Get the type which we are expecting for a bind into this parameter based * on translated contextual information. * * @return The expected type. diff --git a/hibernate-core/src/main/java/org/hibernate/param/PositionalParameterSpecification.java b/hibernate-core/src/main/java/org/hibernate/param/PositionalParameterSpecification.java index 178fb5c5f3..403dbd4e26 100644 --- a/hibernate-core/src/main/java/org/hibernate/param/PositionalParameterSpecification.java +++ b/hibernate-core/src/main/java/org/hibernate/param/PositionalParameterSpecification.java @@ -44,7 +44,7 @@ public class PositionalParameterSpecification extends AbstractExplicitParameterS * * @param statement The statement into which the value should be bound. * @param qp The defined values for the current query execution. - * @param session The session against which the current execution is occuring. + * @param session The session against which the current execution is occurring. * @param position The position from which to start binding value(s). * * @return The number of sql bind positions "eaten" by this bind operation. diff --git a/hibernate-core/src/main/java/org/hibernate/param/VersionTypeSeedParameterSpecification.java b/hibernate-core/src/main/java/org/hibernate/param/VersionTypeSeedParameterSpecification.java index 669b1eb1f5..9693c9d293 100644 --- a/hibernate-core/src/main/java/org/hibernate/param/VersionTypeSeedParameterSpecification.java +++ b/hibernate-core/src/main/java/org/hibernate/param/VersionTypeSeedParameterSpecification.java @@ -15,7 +15,7 @@ import org.hibernate.type.Type; import org.hibernate.type.VersionType; /** - * Parameter bind specification used for optimisitc lock version seeding (from insert statements). + * Parameter bind specification used for optimistic lock version seeding (from insert statements). * * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java index 15636c1211..7f2b331359 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java @@ -164,7 +164,7 @@ public interface CollectionPersister extends CollectionDefinition { /** * Is this a many-to-many association? Note that this is mainly * a convenience feature as the single persister does not - * conatin all the information needed to handle a many-to-many + * contain all the information needed to handle a many-to-many * itself, as internally it is looked at as two many-to-ones. */ boolean isManyToMany(); @@ -181,7 +181,7 @@ public interface CollectionPersister extends CollectionDefinition { boolean isLazy(); /** * Is this collection "inverse", so state changes are not - * propogated to the database. + * propagated to the database. */ boolean isInverse(); /** @@ -277,22 +277,22 @@ public interface CollectionPersister extends CollectionDefinition { * foreign key constraint definition? */ boolean isCascadeDeleteEnabled(); - + /** - * Does this collection cause version increment of the + * Does this collection cause version increment of the * owning entity? */ boolean isVersioned(); - + /** * Can the elements of this collection change? */ boolean isMutable(); - + //public boolean isSubselectLoadable(); - + void postInstantiate() throws MappingException; - + SessionFactoryImplementor getFactory(); boolean isAffectedByEnabledFilters(SharedSessionContractImplementor session); @@ -348,7 +348,7 @@ public interface CollectionPersister extends CollectionDefinition { * @return The key column aliases. */ String getIdentifierColumnAlias(String suffix); - + boolean isExtraLazy(); int getSize(Object key, SharedSessionContractImplementor session); boolean indexExists(Object key, Object index, SharedSessionContractImplementor session); diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index 5f351a7047..13ae4ec824 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -1779,7 +1779,7 @@ public abstract class AbstractEntityPersister public String getDiscriminatorAlias(String suffix) { // NOTE: this assumes something about how propertySelectFragment is implemented by the subclass! - // was toUnqotedAliasStrings( getdiscriminatorColumnName() ) before - now tried + // toUnqotedAliasStrings( getdiscriminatorColumnName() ) before - now tried // to remove that unqoting and missing aliases.. return entityMetamodel.hasSubclasses() ? new Alias( suffix ).toAliasString( getDiscriminatorAlias() ) : @@ -2916,7 +2916,7 @@ public abstract class AbstractEntityPersister } /** - * Used to generate an insery statement against the root table in the + * Used to generate an insert statement against the root table in the * case of identifier generation strategies where the insert statement * executions actually generates the identifier value. * @@ -3094,7 +3094,7 @@ public abstract class AbstractEntityPersister } /** - * Unmarshall the fields of a persistent instance from a result set, + * Unmarshal the fields of a persistent instance from a result set, * without resolving associations or collections. Question: should * this really be here, or should it be sent back to Loader? */ @@ -4428,7 +4428,16 @@ public abstract class AbstractEntityPersister */ public Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session) throws HibernateException { + return doLoad( id, optionalObject, lockOptions, session, null ); + } + public Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly) + throws HibernateException { + return doLoad( id, optionalObject, lockOptions, session, readOnly ); + } + + private Object doLoad(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly) + throws HibernateException { if ( LOG.isTraceEnabled() ) { LOG.tracev( "Fetching entity: {0}", MessageHelper.infoString( this, id, getFactory() ) ); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java index 38e1aa3507..da815b76b6 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java @@ -433,16 +433,26 @@ public interface EntityPersister extends EntityDefinition, EntityValuedModelPart */ Object load(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session); + default Object load(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session, Boolean readOnly) + throws HibernateException { + return load( id, optionalObject, lockMode, session ); + } + /** * Load an instance of the persistent class. */ Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session); + default Object load(Object id, Object optionalObject, LockOptions lockOptions, SharedSessionContractImplementor session, Boolean readOnly) + throws HibernateException { + return load( id, optionalObject, lockOptions, session ); + } + /** * Performs a load of multiple entities (of this type) by identifier simultaneously. * * @param ids The identifiers to load - * @param session The originating Sesison + * @param session The originating Session * @param loadOptions The options for loading * * @return The loaded, matching entities @@ -596,7 +606,7 @@ public interface EntityPersister extends EntityDefinition, EntityValuedModelPart * Does this class have a natural id cache */ boolean hasNaturalIdCache(); - + /** * Get the NaturalId cache (optional operation) */ diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java index af2dfdaad9..450924a525 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java @@ -380,7 +380,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { * For the Client entity: * naturalOrderTableNames -> PERSON, CLIENT; this reflects the sequence in which the tableNames are * added to the meta-data when the annotated entities are processed. - * However, in some instances, for example when generating joins, the CLIENT table needs to be + * However, in some instances, for example when generating joins, the CLIENT table needs to be * the first table as it will the driving table. * tableNames -> CLIENT, PERSON */ @@ -675,7 +675,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { * * @param persistentClass * @param factory - * @return + * @return subclassNamesBySubclassTable */ private String[][] buildSubclassNamesBySubclassTableMapping(PersistentClass persistentClass, SessionFactoryImplementor factory) { // this value represents the number of subclasses (and not the class itself) diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java index 13ea43ee31..d75311bd9c 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java @@ -62,8 +62,8 @@ import org.hibernate.type.Type; /** * The default implementation of the EntityPersister interface. * Implements the "table-per-class-hierarchy" or "roll-up" mapping strategy - * for an entity class and its inheritence hierarchy. This is implemented - * as a single table holding all classes in the hierarchy with a discrimator + * for an entity class and its inheritance hierarchy. This is implemented + * as a single table holding all classes in the hierarchy with a discriminator * column used to determine which concrete class is referenced. * * @author Gavin King diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java index a7a3102ee6..83663311c9 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java @@ -57,7 +57,7 @@ import org.hibernate.type.Type; /** * Implementation of the "table-per-concrete-class" or "roll-down" mapping - * strategy for an entity and its inheritence hierarchy. + * strategy for an entity and its inheritance hierarchy. * * @author Gavin King */ diff --git a/hibernate-core/src/main/java/org/hibernate/persister/spi/UnknownPersisterException.java b/hibernate-core/src/main/java/org/hibernate/persister/spi/UnknownPersisterException.java index 9e1044d1ef..a43d4fc237 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/spi/UnknownPersisterException.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/spi/UnknownPersisterException.java @@ -9,8 +9,8 @@ package org.hibernate.persister.spi; import org.hibernate.HibernateException; /** - * Indicates that the persister to use is not known and couyld not be determined. - * + * Indicates that the persister to use is not known and could not be determined. + * * @author Steve Ebersole */ public class UnknownPersisterException extends HibernateException { diff --git a/hibernate-core/src/main/java/org/hibernate/property/access/spi/EnhancedSetterImpl.java b/hibernate-core/src/main/java/org/hibernate/property/access/spi/EnhancedSetterImpl.java index 89e90c9d03..637e2a2879 100644 --- a/hibernate-core/src/main/java/org/hibernate/property/access/spi/EnhancedSetterImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/property/access/spi/EnhancedSetterImpl.java @@ -17,7 +17,7 @@ import java.lang.reflect.Field; /** * A specialized Setter implementation for handling setting values into - * a into a bytecode-enhanced Class. The reason we need specialized handling + * a bytecode-enhanced Class. The reason we need specialized handling * is to render the fact that we need to account for certain enhancement features * during the setting process. * diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java b/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java index b263cb50bb..f258b95e55 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java @@ -429,7 +429,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer { * This method should only be called during deserialization, before associating * the proxy with a session. * - * @param readOnlyBeforeAttachedToSession, the read-only/modifiable setting to use when + * @param readOnlyBeforeAttachedToSession the read-only/modifiable setting to use when * associated with a session; null indicates that the default should be used. * @param sessionFactoryUuid the session factory uuid, to be used if {@code allowLoadOutsideTransaction} is {@code true}. * @param allowLoadOutsideTransaction whether the proxy can load data even diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/LazyInitializer.java b/hibernate-core/src/main/java/org/hibernate/proxy/LazyInitializer.java index 8a7a838b97..f03cc384fa 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/LazyInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/LazyInitializer.java @@ -52,7 +52,7 @@ public interface LazyInitializer { Class getPersistentClass(); /** - * Is the proxy uninitialzed? + * Is the proxy uninitialized? * * @return True if uninitialized; false otherwise. */ @@ -92,7 +92,7 @@ public interface LazyInitializer { boolean isReadOnlySettingAvailable(); /** - * Is the proxy read-only?. + * Is the proxy read-only? * * The read-only/modifiable setting is not available when the proxy is * detached or its associated session is closed. @@ -101,7 +101,7 @@ public interface LazyInitializer { * * @return true, if this proxy is read-only; false, otherwise * @throws org.hibernate.TransientObjectException if the proxy is detached (getSession() == null) - * @throws org.hibernate.SessionException if the proxy is associated with a sesssion that is closed + * @throws org.hibernate.SessionException if the proxy is associated with a session that is closed * * @see org.hibernate.proxy.LazyInitializer#isReadOnlySettingAvailable() * @see org.hibernate.Session#isReadOnly(Object entityOrProxy) @@ -123,7 +123,7 @@ public interface LazyInitializer { * if false, the associated proxy is made modifiable. * @throws org.hibernate.TransientObjectException if the proxy is not association with a session * @throws org.hibernate.SessionException if the proxy is associated with a session that is closed - * + * * @see org.hibernate.Session#setReadOnly(Object entityOrProxy, boolean readOnly) */ void setReadOnly(boolean readOnly); @@ -139,9 +139,9 @@ public interface LazyInitializer { * Associate the proxy with the given session. *

          * Care should be given to make certain that the proxy is added to the session's persistence context as well - * to maintain the symetry of the association. That must be done seperately as this method simply sets an + * to maintain the symmetry of the association. That must be done separately as this method simply sets an * internal reference. We do also check that if there is already an associated session that the proxy - * reference was removed from that previous session's persistence contet. + * reference was removed from that previous session's persistence context. * * @param session The session * @throws HibernateException Indicates that the proxy was still contained in the persistence context of the @@ -157,7 +157,7 @@ public interface LazyInitializer { * {@link org.hibernate.Session#clear} processing; most other use-cases should call {@link #setSession} instead. */ void unsetSession(); - + void setUnwrap(boolean unwrap); boolean isUnwrap(); } diff --git a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/LogicalConnection.java b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/LogicalConnection.java index 2386575cda..9366f2834a 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/LogicalConnection.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/LogicalConnection.java @@ -19,7 +19,7 @@ public interface LogicalConnection { * Is this (logical) JDBC Connection still open/active. In other words, has {@link #close} not been called yet? * * @return {@code true} if still open ({@link #close} has not been called yet); {@code false} if not open - * (({@link #close} has been called). + * ({@link #close} has been called). */ boolean isOpen(); diff --git a/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/DdlTransactionIsolator.java b/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/DdlTransactionIsolator.java index c5b32acc88..e9b69dfad3 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/DdlTransactionIsolator.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/DdlTransactionIsolator.java @@ -38,7 +38,7 @@ public interface DdlTransactionIsolator { * Connection will be isolated (transactionally) from any * transaction in effect prior to the call to {@link #prepare}. * - * @return + * @return The Connection. */ Connection getIsolatedConnection(); diff --git a/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/TransactionCoordinatorOwner.java b/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/TransactionCoordinatorOwner.java index fbde477e74..2863165386 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/TransactionCoordinatorOwner.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/TransactionCoordinatorOwner.java @@ -52,7 +52,7 @@ public interface TransactionCoordinatorOwner { * An after-completion callback from the coordinator to its owner. * * @param successful Was the transaction successful? - * @param delayed Is this a delayed after transaction completion call (aka after a timeout)? + * @param delayed Is this delayed after transaction completion call (aka after a timeout)? */ void afterTransactionCompletion(boolean successful, boolean delayed); diff --git a/hibernate-core/src/main/java/org/hibernate/service/UnknownServiceException.java b/hibernate-core/src/main/java/org/hibernate/service/UnknownServiceException.java index 5efaf0e13c..8f3b04677c 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/UnknownServiceException.java +++ b/hibernate-core/src/main/java/org/hibernate/service/UnknownServiceException.java @@ -8,7 +8,7 @@ package org.hibernate.service; import org.hibernate.HibernateException; /** - * Indicates that an unkown service was requested from the registry. + * Indicates that an unknown service was requested from the registry. * * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceDependencyException.java b/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceDependencyException.java index 29e953c27e..49ce8281a4 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceDependencyException.java +++ b/hibernate-core/src/main/java/org/hibernate/service/internal/ServiceDependencyException.java @@ -8,7 +8,7 @@ package org.hibernate.service.internal; import org.hibernate.HibernateException; /** - * Indictes a problem processing service dependencies. + * Indicates a problem processing service dependencies. * * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/Manageable.java b/hibernate-core/src/main/java/org/hibernate/service/spi/Manageable.java index 4719a29375..afc47301bc 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/Manageable.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/Manageable.java @@ -35,7 +35,7 @@ public interface Manageable { } /** - * The the management bean (MBean) for this service. + * The management bean (MBean) for this service. * * @return The management bean. */ diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/OptionallyManageable.java b/hibernate-core/src/main/java/org/hibernate/service/spi/OptionallyManageable.java index 5e08a462cb..f3c486e97c 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/OptionallyManageable.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/OptionallyManageable.java @@ -11,7 +11,7 @@ import java.util.List; /** * Extension to Manageable for things that are optionally Manageable depending * on some internal state. E.g. services that wrap other services wanting to - * delegate manageablity if the wrapped service is Manageable. + * delegate manageability if the wrapped service is Manageable. * * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java b/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java index 93255868c5..2e088fb316 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java @@ -25,7 +25,6 @@ public interface SessionFactoryServiceRegistryFactory extends Service { * for grabbing a reference for later use. However, care should be taken when invoking on * the session factory until after it has been fully initialized. * @param sessionFactoryOptions The build options. - * @param sessionFactoryOptions The build options. * * @return The registry */ diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/Wrapped.java b/hibernate-core/src/main/java/org/hibernate/service/spi/Wrapped.java index 953fdc6f98..9dd667fcdb 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/Wrapped.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/Wrapped.java @@ -30,7 +30,7 @@ public interface Wrapped { * * @return The unwrapped reference * - * @throws UnknownUnwrapTypeException if the servicebe unwrapped as the indicated type + * @throws UnknownUnwrapTypeException if the service cannot be unwrapped as the indicated type */ public T unwrap(Class unwrapType); } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/OracleJoinFragment.java b/hibernate-core/src/main/java/org/hibernate/sql/OracleJoinFragment.java index ee21fb2231..7779fff995 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/OracleJoinFragment.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/OracleJoinFragment.java @@ -153,7 +153,7 @@ public class OracleJoinFragment extends JoinFragment { * This method is a bit of a hack, and assumes * that the column on the "right" side of the * join appears on the "left" side of the - * operator, which is extremely wierd if this + * operator, which is extremely weird if this * was a normal join condition, but is natural * for a filter. */ diff --git a/hibernate-core/src/main/java/org/hibernate/stat/Statistics.java b/hibernate-core/src/main/java/org/hibernate/stat/Statistics.java index 93aedd7d37..5c9cf24011 100755 --- a/hibernate-core/src/main/java/org/hibernate/stat/Statistics.java +++ b/hibernate-core/src/main/java/org/hibernate/stat/Statistics.java @@ -12,7 +12,7 @@ import javax.management.MXBean; * Exposes statistics for a particular {@link org.hibernate.SessionFactory}. Beware of milliseconds metrics, they * are dependent of the JVM precision: you may then encounter a 10 ms approximation depending on you OS platform. * Please refer to the JVM documentation for more information. - * + * * @author Emmanuel Bernard */ @MXBean @@ -42,7 +42,7 @@ public interface Statistics { /** * find entity statistics per name - * + * * @param entityName entity name * @return EntityStatistics object */ @@ -50,7 +50,7 @@ public interface Statistics { /** * Get collection statistics per role - * + * * @param role collection role * @return CollectionStatistics */ @@ -366,7 +366,7 @@ public interface Statistics { * @return NaturalIdCacheStatistics * * @deprecated (since 5.3) Use {@link #getNaturalIdStatistics} or - * {@link @getDomainDataRegionStatistics} instead depending on need + * {@link #getDomainDataRegionStatistics} instead depending on need */ @Deprecated NaturalIdCacheStatistics getNaturalIdCacheStatistics(String regionName); diff --git a/hibernate-core/src/main/java/org/hibernate/stat/internal/DeprecatedNaturalIdCacheStatisticsImpl.java b/hibernate-core/src/main/java/org/hibernate/stat/internal/DeprecatedNaturalIdCacheStatisticsImpl.java index 74eb0bb43f..3dc5add036 100644 --- a/hibernate-core/src/main/java/org/hibernate/stat/internal/DeprecatedNaturalIdCacheStatisticsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/stat/internal/DeprecatedNaturalIdCacheStatisticsImpl.java @@ -63,7 +63,7 @@ public class DeprecatedNaturalIdCacheStatisticsImpl implements NaturalIdCacheSta } /** - * average time in ms taken by the excution of this query onto the DB + * average time in ms taken by the execution of this query onto the DB */ @Override public long getExecutionAvgTime() { @@ -84,7 +84,7 @@ public class DeprecatedNaturalIdCacheStatisticsImpl implements NaturalIdCacheSta } /** - * max time in ms taken by the excution of this query onto the DB + * max time in ms taken by the execution of this query onto the DB */ @Override public long getExecutionMaxTime() { @@ -92,7 +92,7 @@ public class DeprecatedNaturalIdCacheStatisticsImpl implements NaturalIdCacheSta } /** - * min time in ms taken by the excution of this query onto the DB + * min time in ms taken by the execution of this query onto the DB */ @Override public long getExecutionMinTime() { diff --git a/hibernate-core/src/main/java/org/hibernate/stat/internal/NaturalIdStatisticsImpl.java b/hibernate-core/src/main/java/org/hibernate/stat/internal/NaturalIdStatisticsImpl.java index 17428ffc84..217bdb0a3a 100644 --- a/hibernate-core/src/main/java/org/hibernate/stat/internal/NaturalIdStatisticsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/stat/internal/NaturalIdStatisticsImpl.java @@ -18,7 +18,7 @@ import org.hibernate.stat.NaturalIdStatistics; /** * NaturalId cache statistics of a specific entity - * + * * @author Eric Dalquist */ public class NaturalIdStatisticsImpl extends AbstractCacheableDataStatistics implements NaturalIdStatistics, Serializable { @@ -53,7 +53,7 @@ public class NaturalIdStatisticsImpl extends AbstractCacheableDataStatistics imp } /** - * average time in ms taken by the excution of this query onto the DB + * average time in ms taken by the execution of this query onto the DB */ @Override public long getExecutionAvgTime() { @@ -74,7 +74,7 @@ public class NaturalIdStatisticsImpl extends AbstractCacheableDataStatistics imp } /** - * max time in ms taken by the excution of this query onto the DB + * max time in ms taken by the execution of this query onto the DB */ @Override public long getExecutionMaxTime() { diff --git a/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SingleLineSqlCommandExtractor.java b/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SingleLineSqlCommandExtractor.java index e794b39444..5885974ef9 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SingleLineSqlCommandExtractor.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SingleLineSqlCommandExtractor.java @@ -15,7 +15,7 @@ import java.util.List; import org.hibernate.internal.util.StringHelper; /** - * Class responsible for extracting SQL statements from import script. Treads each line as a complete SQL statement. + * Class responsible for extracting SQL statements from import script. Treats each line as a complete SQL statement. * Comment lines shall start with {@code --}, {@code //} or {@code /*} character sequence. * * @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com) diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/DatabaseInformation.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/DatabaseInformation.java index cd72909a60..fa7d0a4f3b 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/DatabaseInformation.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/DatabaseInformation.java @@ -54,16 +54,16 @@ public interface DatabaseInformation { /** * Obtain reference to the named TableInformation * - * @param tableName The qualfied table name + * @param tableName The qualified table name * * @return The table information. May return {@code null} if not found. */ TableInformation getTableInformation(QualifiedTableName tableName); /** - * Obtain reference to all the {@link TableInformation) for a given {@link Namespace} + * Obtain reference to all the {@link TableInformation} for a given {@link Namespace} * - * @param namespace The {@link Namespace} which contains the {@link TableInformation) + * @param namespace The {@link Namespace} which contains the {@link TableInformation} * * @return a {@link NameSpaceTablesInformation} */ diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/SequenceInformationExtractor.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/SequenceInformationExtractor.java index 094d1edbbc..59d0f6657e 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/SequenceInformationExtractor.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/spi/SequenceInformationExtractor.java @@ -9,7 +9,7 @@ package org.hibernate.tool.schema.extract.spi; import java.sql.SQLException; /** - * Because JDBC (at least up to an including Java 7, JDBC 4) still does not have support for obtaining information + * Because JDBC (at least up to and including Java 7, JDBC 4) still does not have support for obtaining information * about sequences from DatabaseMetaData. * * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/transform/AliasToBeanConstructorResultTransformer.java b/hibernate-core/src/main/java/org/hibernate/transform/AliasToBeanConstructorResultTransformer.java index e785fbcf9a..381ef85373 100644 --- a/hibernate-core/src/main/java/org/hibernate/transform/AliasToBeanConstructorResultTransformer.java +++ b/hibernate-core/src/main/java/org/hibernate/transform/AliasToBeanConstructorResultTransformer.java @@ -1,74 +1,74 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.transform; -import java.lang.reflect.Constructor; -import java.util.List; - -import org.hibernate.QueryException; - -/** - * Wraps the tuples in a constructor call. - * - * todo : why Alias* in the name??? - */ -public class AliasToBeanConstructorResultTransformer implements ResultTransformer { - - private final Constructor constructor; - - /** - * Instantiates a AliasToBeanConstructorResultTransformer. - * - * @param constructor The contructor in which to wrap the tuples. - */ - public AliasToBeanConstructorResultTransformer(Constructor constructor) { - this.constructor = constructor; - } - - /** - * Wrap the incoming tuples in a call to our configured constructor. - */ - @Override - public Object transformTuple(Object[] tuple, String[] aliases) { - try { - return constructor.newInstance( tuple ); - } - catch ( Exception e ) { - throw new QueryException( - "could not instantiate class [" + constructor.getDeclaringClass().getName() + "] from tuple", - e - ); - } - } - - @Override - public List transformList(List collection) { - return collection; - } - - /** - * Define our hashCode by our defined constructor's hasCode. - * - * @return Our defined ctor hashCode - */ - @Override - public int hashCode() { - return constructor.hashCode(); - } - - /** - * 2 AliasToBeanConstructorResultTransformer are considered equal if they have the same - * defined constructor. - * - * @param other The other instance to check for equality. - * @return True if both have the same defined constuctor; false otherwise. - */ - @Override - public boolean equals(Object other) { - return other instanceof AliasToBeanConstructorResultTransformer - && constructor.equals( ( ( AliasToBeanConstructorResultTransformer ) other ).constructor ); - } -} +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.transform; +import java.lang.reflect.Constructor; +import java.util.List; + +import org.hibernate.QueryException; + +/** + * Wraps the tuples in a constructor call. + * + * todo : why Alias* in the name??? + */ +public class AliasToBeanConstructorResultTransformer implements ResultTransformer { + + private final Constructor constructor; + + /** + * Instantiates a AliasToBeanConstructorResultTransformer. + * + * @param constructor The constructor in which to wrap the tuples. + */ + public AliasToBeanConstructorResultTransformer(Constructor constructor) { + this.constructor = constructor; + } + + /** + * Wrap the incoming tuples in a call to our configured constructor. + */ + @Override + public Object transformTuple(Object[] tuple, String[] aliases) { + try { + return constructor.newInstance( tuple ); + } + catch ( Exception e ) { + throw new QueryException( + "could not instantiate class [" + constructor.getDeclaringClass().getName() + "] from tuple", + e + ); + } + } + + @Override + public List transformList(List collection) { + return collection; + } + + /** + * Define our hashCode by our defined constructor's hasCode. + * + * @return Our defined ctor hashCode + */ + @Override + public int hashCode() { + return constructor.hashCode(); + } + + /** + * 2 AliasToBeanConstructorResultTransformer are considered equal if they have the same + * defined constructor. + * + * @param other The other instance to check for equality. + * @return True if both have the same defined constructor; false otherwise. + */ + @Override + public boolean equals(Object other) { + return other instanceof AliasToBeanConstructorResultTransformer + && constructor.equals( ( ( AliasToBeanConstructorResultTransformer ) other ).constructor ); + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/transform/CacheableResultTransformer.java b/hibernate-core/src/main/java/org/hibernate/transform/CacheableResultTransformer.java index bdf98e7c13..1a1e40109f 100644 --- a/hibernate-core/src/main/java/org/hibernate/transform/CacheableResultTransformer.java +++ b/hibernate-core/src/main/java/org/hibernate/transform/CacheableResultTransformer.java @@ -177,7 +177,7 @@ public class CacheableResultTransformer implements ResultTransformer { * @param transformer - the transformer for the re-transformation * @param includeInTuple indicates the indexes of * - * @return transformedResults, with each element re-transformed (if nececessary) + * @return transformedResults, with each element re-transformed (if necessary) */ @SuppressWarnings( {"unchecked"}) public List retransformResults( @@ -230,7 +230,7 @@ public class CacheableResultTransformer implements ResultTransformer { * tuple, then, on return, elements corresponding to * excluded tuple elements will be null. * @param results - results that were previously transformed - * @return results, with each element untransformed (if nececessary) + * @return results, with each element untransformed (if necessary) */ @SuppressWarnings( {"unchecked"}) public List untransformToTuples(List results) { diff --git a/hibernate-core/src/main/java/org/hibernate/transform/ToListResultTransformer.java b/hibernate-core/src/main/java/org/hibernate/transform/ToListResultTransformer.java index aaa862ad34..943d016394 100644 --- a/hibernate-core/src/main/java/org/hibernate/transform/ToListResultTransformer.java +++ b/hibernate-core/src/main/java/org/hibernate/transform/ToListResultTransformer.java @@ -1,36 +1,36 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.transform; - -import java.util.Arrays; - -/** - * Tranforms each result row from a tuple into a {@link java.util.List} whose elements are each tuple value - */ -public class ToListResultTransformer extends BasicTransformerAdapter { - public static final ToListResultTransformer INSTANCE = new ToListResultTransformer(); - - /** - * Disallow instantiation of ToListResultTransformer. - */ - private ToListResultTransformer() { - } - - @Override - public Object transformTuple(Object[] tuple, String[] aliases) { - return Arrays.asList( tuple ); - } - - /** - * Serialization hook for ensuring singleton uniqueing. - * - * @return The singleton instance : {@link #INSTANCE} - */ - private Object readResolve() { - return INSTANCE; - } -} +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.transform; + +import java.util.Arrays; + +/** + * Transforms each result row from a tuple into a {@link java.util.List} whose elements are each tuple value + */ +public class ToListResultTransformer extends BasicTransformerAdapter { + public static final ToListResultTransformer INSTANCE = new ToListResultTransformer(); + + /** + * Disallow instantiation of ToListResultTransformer. + */ + private ToListResultTransformer() { + } + + @Override + public Object transformTuple(Object[] tuple, String[] aliases) { + return Arrays.asList( tuple ); + } + + /** + * Serialization hook for ensuring singleton uniqueing. + * + * @return The singleton instance : {@link #INSTANCE} + */ + private Object readResolve() { + return INSTANCE; + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/transform/Transformers.java b/hibernate-core/src/main/java/org/hibernate/transform/Transformers.java index 2f868d823a..a5b569458c 100644 --- a/hibernate-core/src/main/java/org/hibernate/transform/Transformers.java +++ b/hibernate-core/src/main/java/org/hibernate/transform/Transformers.java @@ -1,33 +1,33 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.transform; - - -final public class Transformers { - - private Transformers() {} - - /** - * Each row of results is a Map from alias to values/entities - */ - public static final AliasToEntityMapResultTransformer ALIAS_TO_ENTITY_MAP = - AliasToEntityMapResultTransformer.INSTANCE; - - /** - * Each row of results is a List - */ - public static final ToListResultTransformer TO_LIST = ToListResultTransformer.INSTANCE; - - /** - * Creates a resulttransformer that will inject aliased values into - * instances of Class via property methods or fields. - */ - public static ResultTransformer aliasToBean(Class target) { - return new AliasToBeanResultTransformer(target); - } - -} +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.transform; + + +final public class Transformers { + + private Transformers() {} + + /** + * Each row of results is a Map from alias to values/entities + */ + public static final AliasToEntityMapResultTransformer ALIAS_TO_ENTITY_MAP = + AliasToEntityMapResultTransformer.INSTANCE; + + /** + * Each row of results is a List + */ + public static final ToListResultTransformer TO_LIST = ToListResultTransformer.INSTANCE; + + /** + * Creates a resulttransformer that will inject aliased values into + * instances of Class via property methods or fields. + */ + public static ResultTransformer aliasToBean(Class target) { + return new AliasToBeanResultTransformer(target); + } + +} diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/IdentifierProperty.java b/hibernate-core/src/main/java/org/hibernate/tuple/IdentifierProperty.java index bf0828ad3c..fe2d28e4f4 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/IdentifierProperty.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/IdentifierProperty.java @@ -30,8 +30,6 @@ public class IdentifierProperty extends AbstractAttribute implements IdentifierA * * @param name The name of the property representing the identifier within * its owning entity. - * @param node The node name to use for XML-based representation of this - * property. * @param type The Hibernate Type for the identifier property. * @param embedded Is this an embedded identifier. * @param unsavedValue The value which, if found as the value on the identifier diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java index dddb5101c6..7ebedcd5b0 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java @@ -72,9 +72,9 @@ public interface Tuplizer { * @return The new, empty entity instance. */ public Object instantiate(); - + /** - * Is the given object considered an instance of the the entity (acconting + * Is the given object considered an instance of the the entity (accounting * for entity-mode) managed by this tuplizer. * * @param object The object to be checked. diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java index 609923b05e..916e02b6d5 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java @@ -17,7 +17,7 @@ import org.hibernate.tuple.Tuplizer; *

          * ComponentTuplizer implementations should have the following constructor signature: * (org.hibernate.mapping.Component) - * + * * @author Gavin King * @author Steve Ebersole */ @@ -35,13 +35,13 @@ public interface ComponentTuplizer extends Tuplizer, Serializable { * Set the value of the parent property. * * @param component The component instance on which to set the parent. - * @param parent The parent to be set on the comonent. + * @param parent The parent to be set on the component. * @param factory The current session factory. */ public void setParent(Object component, Object parent, SessionFactoryImplementor factory); /** - * Does the component managed by this tuuplizer contain a parent property? + * Does the component managed by this tuplizer contain a parent property? * * @return True if the component does contain a parent property; false otherwise. */ diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java index 45dfa75ba4..0e89527432 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java @@ -19,7 +19,7 @@ import org.hibernate.proxy.ProxyFactory; import org.hibernate.tuple.Tuplizer; /** - * Defines further responsibilities reagarding tuplization based on + * Defines further responsibilities regarding tuplization based on * a mapped entity. *

          * EntityTuplizer implementations should have the following constructor signatures: @@ -171,7 +171,7 @@ public interface EntityTuplizer extends Tuplizer { * * @param entity The entity from which to extract. * @param mergeMap a map of instances being merged to merged instances - * @param session The session in which the resuest is being made. + * @param session The session in which the result set is being made. * @return The insertable property values. * @throws HibernateException Indicates a problem access the properties */ @@ -242,7 +242,7 @@ public interface EntityTuplizer extends Tuplizer { /** * Given an entity instance, determine the most appropriate (most targeted) entity-name which represents it. * This is called in situations where we already know an entity name for the given entityInstance; we are being - * asked to determine if there is a more appropriate entity-name to use, specifically within an inheritence + * asked to determine if there is a more appropriate entity-name to use, specifically within an inheritance * hierarchy. *

          * For example, consider a case where a user calls session.update( "Animal", cat );. Here, the @@ -250,7 +250,7 @@ public interface EntityTuplizer extends Tuplizer { * of Cat which is a subclass of Animal. In this case, we would return Cat as the * entity-name. *

          - * null may be returned from calls to this method. The meaining of null in that case is assumed + * null may be returned from calls to this method. The meaning of null in that case is assumed * to be that we should use whatever explicit entity-name the user provided (Animal rather than Cat * in the example above). * @@ -259,7 +259,7 @@ public interface EntityTuplizer extends Tuplizer { * * @return The most appropriate entity name to use. * - * @throws HibernateException If we are unable to determine an entity-name within the inheritence hierarchy. + * @throws HibernateException If we are unable to determine an entity-name within the inheritance hierarchy. */ String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory); diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizerFactory.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizerFactory.java index ea0e52ebf7..8a84a5df6f 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizerFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizerFactory.java @@ -93,7 +93,7 @@ public class EntityTuplizerFactory implements Serializable { } /** - * Construct am instance of the default tuplizer for the given entity-mode. + * Construct an instance of the default tuplizer for the given entity-mode. * * @param entityMode The entity mode for which to build a default tuplizer. * @param metamodel The entity metadata. diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java index 2d8f4c1423..6d7b5d0cb7 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/PojoEntityTuplizer.java @@ -92,7 +92,7 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer { protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) { // determine the id getter and setter methods from the proxy interface (if any) // determine all interfaces needed by the resulting proxy - + /* * We need to preserve the order of the interfaces they were put into the set, since javassist will choose the * first one's class-loader to construct the proxy class with. This is also the reason why HibernateProxy.class diff --git a/hibernate-core/src/main/java/org/hibernate/type/ArrayType.java b/hibernate-core/src/main/java/org/hibernate/type/ArrayType.java index b64baad505..3f24c053ba 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/ArrayType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/ArrayType.java @@ -96,23 +96,23 @@ public class ArrayType extends CollectionType { public Object replaceElements( Object original, Object target, - Object owner, + Object owner, Map copyCache, SharedSessionContractImplementor session) throws HibernateException { - + int length = Array.getLength(original); if ( length!=Array.getLength(target) ) { //note: this affects the return value! target=instantiateResult(original); } - + Type elemType = getElementType( session.getFactory() ); for ( int i=0; iPersistentCollection - * + * * @see org.hibernate.collection.spi.PersistentCollection * @see org.hibernate.usertype.UserCollectionType * @author Gavin King diff --git a/hibernate-core/src/main/java/org/hibernate/type/EntityType.java b/hibernate-core/src/main/java/org/hibernate/type/EntityType.java index 640a0a86e2..ca89949f75 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/EntityType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/EntityType.java @@ -203,7 +203,7 @@ public abstract class EntityType extends AbstractType implements AssociationType * entity persister (nor to the session factory, to look it up) which is really * needed to "do the right thing" here... * - * @return The entiyt class. + * @return The entity class. */ @Override public final Class getReturnedClass() { @@ -533,7 +533,7 @@ public abstract class EntityType extends AbstractType implements AssociationType public abstract boolean isOneToOne(); /** - * Is the association modeled here a 1-1 according to the logical moidel? + * Is the association modeled here a 1-1 according to the logical model? * * @return True if a 1-1 in the logical model; false otherwise. */ @@ -636,7 +636,7 @@ public abstract class EntityType extends AbstractType implements AssociationType * Resolve an identifier via a load. * * @param id The entity id to resolve - * @param session The orginating session. + * @param session The originating session. * * @return The resolved identifier (i.e., loaded entity). * @@ -677,7 +677,7 @@ public abstract class EntityType extends AbstractType implements AssociationType * Load an instance by a unique key that is not the primary key. * * @param entityName The name of the entity to load - * @param uniqueKeyPropertyName The name of the property defining the uniqie key. + * @param uniqueKeyPropertyName The name of the property defining the unique key. * @param key The unique key property value. * @param session The originating session. * @@ -708,7 +708,7 @@ public abstract class EntityType extends AbstractType implements AssociationType Object result = persistenceContext.getEntity( euk ); if ( result == null ) { result = persister.loadByUniqueKey( uniqueKeyPropertyName, key, session ); - + // If the entity was not in the Persistence Context, but was found now, // add it to the Persistence Context if (result != null) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/SerializationException.java b/hibernate-core/src/main/java/org/hibernate/type/SerializationException.java index 2cc6f7033d..c1f796f65c 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/SerializationException.java +++ b/hibernate-core/src/main/java/org/hibernate/type/SerializationException.java @@ -8,7 +8,7 @@ package org.hibernate.type; import org.hibernate.HibernateException; /** - * Thrown when a property cannot be serializaed/deserialized + * Thrown when a property cannot be serialized/deserialized * @author Gavin King */ public class SerializationException extends HibernateException { diff --git a/hibernate-core/src/main/java/org/hibernate/type/SetType.java b/hibernate-core/src/main/java/org/hibernate/type/SetType.java index b7e23e7aad..71900367cc 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/SetType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/SetType.java @@ -41,5 +41,5 @@ public class SetType extends CollectionType { ? new HashSet() : new HashSet( anticipatedSize + (int)( anticipatedSize * .75f ), .75f ); } - + } diff --git a/hibernate-core/src/main/java/org/hibernate/type/Type.java b/hibernate-core/src/main/java/org/hibernate/type/Type.java index 0008c0cc7e..72bf4b9b67 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/Type.java +++ b/hibernate-core/src/main/java/org/hibernate/type/Type.java @@ -269,7 +269,7 @@ public interface Type extends Serializable { * * @param dbState the database state, in a "hydrated" form, with identifiers unresolved * @param currentState the current state of the object - * @param checkable which columns are actually updatable + * @param checkable which columns are actually checkable * @param session The session from which the request originated. * * @return true if the field has been modified diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/converter/AttributeConverterMutabilityPlanImpl.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/converter/AttributeConverterMutabilityPlanImpl.java index 5928e8763e..dfddbdd2f8 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/converter/AttributeConverterMutabilityPlanImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/converter/AttributeConverterMutabilityPlanImpl.java @@ -10,7 +10,7 @@ import org.hibernate.metamodel.model.convert.spi.JpaAttributeConverter; import org.hibernate.type.descriptor.java.MutableMutabilityPlan; /** - * The standard aproach for defining a MutabilityPlan for converted (AttributeConverter) + * The standard approach for defining a MutabilityPlan for converted (AttributeConverter) * values is to always assume that they are immutable to make sure that dirty checking, * deep copying and second-level caching all work properly no matter what. That was work * done under https://hibernate.atlassian.net/browse/HHH-10111 diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DataHelper.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DataHelper.java index 7bac410216..f99e82949d 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DataHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DataHelper.java @@ -239,7 +239,7 @@ public final class DataHelper { } /** - * Extract a portion of the bytes from the given stream., wrapping them in a new stream. + * Extract a portion of the bytes from the given stream, wrapping them in a new stream. * * @param inputStream The stream of bytes. * @param start The start position/offset (0-based, per general stream/reader contracts). @@ -292,7 +292,7 @@ public final class DataHelper { /** * Make sure we allocate a buffer sized not bigger than 2048, * not higher than what is actually needed, and at least one. - * + * * @param lengthHint the expected size of the full value * @return the buffer size */ diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/LobTypeMappings.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/LobTypeMappings.java index d68a7099bd..c246654c9f 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/LobTypeMappings.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/LobTypeMappings.java @@ -31,7 +31,7 @@ public final class LobTypeMappings { /** * * @param jdbcTypeCode - * @return + * @return true if corresponding Lob code exists; false otherwise. * @deprecated use {@link #isMappedToKnownLobCode(int)} */ @Deprecated @@ -42,7 +42,7 @@ public final class LobTypeMappings { /** * * @param jdbcTypeCode - * @return + * @return corresponding Lob code * @deprecated use {@link #getLobCodeTypeMapping(int)} */ @Deprecated diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/NationalizedTypeMappings.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/NationalizedTypeMappings.java index 9dd7c21ffa..d17b5952ec 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/NationalizedTypeMappings.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/NationalizedTypeMappings.java @@ -50,7 +50,7 @@ public final class NationalizedTypeMappings { /** * @deprecated use {@link #toNationalizedTypeCode(int)} * @param jdbcCode - * @return + * @return corresponding nationalized code */ @Deprecated public int getCorrespondingNationalizedCode(int jdbcCode) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java b/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java index 031fd2e09d..627c4c2e56 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java +++ b/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java @@ -140,7 +140,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable { * bound here. See {@link Scope} for more details regarding the stages * a TypeConfiguration goes through * - * @return + * @return The MetadataBuildingContext */ public MetadataBuildingContext getMetadataBuildingContext() { return scope.getMetadataBuildingContext(); diff --git a/hibernate-core/src/main/java/org/hibernate/usertype/LoggableUserType.java b/hibernate-core/src/main/java/org/hibernate/usertype/LoggableUserType.java index 51a35fe1ab..15f18fd861 100644 --- a/hibernate-core/src/main/java/org/hibernate/usertype/LoggableUserType.java +++ b/hibernate-core/src/main/java/org/hibernate/usertype/LoggableUserType.java @@ -17,7 +17,7 @@ public interface LoggableUserType { /** * Generate a loggable string representation of the collection (value). * - * @param value The collection to be logged; guarenteed to be non-null and initialized. + * @param value The collection to be logged; guaranteed to be non-null and initialized. * @param factory The factory. * @return The loggable string representation. */ diff --git a/hibernate-core/src/main/java/org/hibernate/usertype/UserCollectionType.java b/hibernate-core/src/main/java/org/hibernate/usertype/UserCollectionType.java index 5856c3534d..e117e6dd6c 100644 --- a/hibernate-core/src/main/java/org/hibernate/usertype/UserCollectionType.java +++ b/hibernate-core/src/main/java/org/hibernate/usertype/UserCollectionType.java @@ -65,7 +65,7 @@ public interface UserCollectionType { * but with the given anticipated size (i.e. accounting for initial size * and perhaps load factor). * - * @param anticipatedSize The anticipated size of the instaniated collection + * @param anticipatedSize The anticipated size of the instantiated collection * after we are done populating it. Note, may be negative to indicate that * we not yet know anything about the anticipated size (i.e., when initializing * from a result set row by row). diff --git a/hibernate-core/src/main/java/org/hibernate/usertype/UserType.java b/hibernate-core/src/main/java/org/hibernate/usertype/UserType.java index d5ecd4c702..ae0465b587 100644 --- a/hibernate-core/src/main/java/org/hibernate/usertype/UserType.java +++ b/hibernate-core/src/main/java/org/hibernate/usertype/UserType.java @@ -133,7 +133,7 @@ public interface UserType { * identifier values. (optional operation) * * @param value the object to be cached - * @return a cachable representation of the object + * @return a cacheable representation of the object * @throws HibernateException */ Serializable disassemble(Object value) throws HibernateException; @@ -144,7 +144,7 @@ public interface UserType { * * @param cached the object to be cached * @param owner the owner of the cached object - * @return a reconstructed object from the cachable representation + * @return a reconstructed object from the cacheable representation * @throws HibernateException */ Object assemble(Serializable cached, Object owner) throws HibernateException; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerTest.java index 13d0bebd86..6bc16d9565 100755 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/EntityManagerTest.java @@ -30,6 +30,7 @@ import org.hibernate.Session; import org.hibernate.cfg.Environment; import org.hibernate.jpa.AvailableSettings; import org.hibernate.jpa.HibernateEntityManagerFactory; +import org.hibernate.jpa.QueryHints; import org.hibernate.stat.Statistics; import org.hibernate.testing.TestForIssue; import org.junit.Test; @@ -488,6 +489,49 @@ public class EntityManagerTest extends BaseEntityManagerFunctionalTestCase { } } + @Test + @TestForIssue( jiraKey = "HHH-11958" ) + public void testReadonlyHibernateQueryHint() { + + EntityManager em = getOrCreateEntityManager(); + em.getTransaction().begin(); + Wallet w = new Wallet(); + w.setBrand("Lacoste"); + w.setModel("Minimic"); + w.setSerial("0324"); + em.persist(w); + try { + em.getTransaction().commit(); + } finally { + em.close(); + } + + em = getOrCreateEntityManager(); + Map hints = new HashMap<>(); + hints.put(QueryHints.HINT_READONLY, true); + + em.getTransaction().begin(); + + Wallet fetchedWallet = em.find(Wallet.class, w.getSerial(), hints); + fetchedWallet.setBrand("Givenchy"); + + try { + em.getTransaction().commit(); + } finally { + em.close(); + } + + em = getOrCreateEntityManager(); + em.getTransaction().begin(); + fetchedWallet = em.find(Wallet.class, w.getSerial()); + try { + em.getTransaction().commit(); + assertEquals("Lacoste", fetchedWallet.getBrand()); + } finally { + em.close(); + } + } + private static class MyObject { public int value; } diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/ejb3configuration/PersisterClassProviderTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/ejb3configuration/PersisterClassProviderTest.java index 71047045a6..a275fc488f 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/ejb3configuration/PersisterClassProviderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/ejb3configuration/PersisterClassProviderTest.java @@ -274,7 +274,7 @@ public class PersisterClassProviderTest { public boolean hasNaturalIdentifier() { return false; } - + @Override public int[] getNaturalIdentifierProperties() { return new int[0]; @@ -290,7 +290,7 @@ public class PersisterClassProviderTest { SharedSessionContractImplementor session) { return null; } - + @Override public boolean hasNaturalIdCache() { return false; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/cascade/CascadeTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/cascade/CascadeTest.java index 8e01ba206d..8a309b685f 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/cascade/CascadeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/cascade/CascadeTest.java @@ -23,7 +23,7 @@ import static org.junit.Assert.assertNull; /** * Check some of the individual cascade styles * - * @todo do something for refresh + * TODO: do something for refresh * * @author Emmanuel Bernard */ @@ -149,7 +149,7 @@ public class CascadeTest extends BaseCoreFunctionalTestCase { s = openSession(); tx = s.beginTransaction(); s.delete( s.get( Mouth.class, mouth.id ) ); - + tx.commit(); s.close(); } diff --git a/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/MapsIdProxyBidirectionalTest.java b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/MapsIdProxyBidirectionalTest.java new file mode 100644 index 0000000000..39c0900f42 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/MapsIdProxyBidirectionalTest.java @@ -0,0 +1,173 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.test.bytecode.enhancement.lazy.proxy; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.MapsId; +import javax.persistence.OneToOne; + +import org.hibernate.Hibernate; +import org.hibernate.annotations.LazyToOne; +import org.hibernate.annotations.LazyToOneOption; +import org.hibernate.boot.SessionFactoryBuilder; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.cfg.AvailableSettings; +import org.hibernate.stat.Statistics; + +import org.hibernate.testing.FailureExpected; +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner; +import org.hibernate.testing.bytecode.enhancement.EnhancementOptions; +import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +/** + * @author Gail Badner + */ + +@TestForIssue(jiraKey = "HHH-13814") +@RunWith( BytecodeEnhancerRunner.class ) +@EnhancementOptions( lazyLoading = true ) +public class MapsIdProxyBidirectionalTest extends BaseNonConfigCoreFunctionalTestCase { + + @Test + @TestForIssue(jiraKey = "HHH-13814") + public void testAssociation() { + inTransaction( + session -> { + final Statistics statistics = sessionFactory().getStatistics(); + statistics.clear(); + EmployerInfo employerInfo = session.get( EmployerInfo.class, 1 ); + + assertEquals( 1, statistics.getPrepareStatementCount() ); + + assertTrue( Hibernate.isPropertyInitialized( employerInfo, "employer" ) ); + final Employer employer = employerInfo.employer; + assertFalse( Hibernate.isInitialized( employer ) ); + Hibernate.initialize( employer ); + assertEquals( "Employer #" + employer.id, employer.name ); + + assertThat( statistics.getEntityLoadCount(), is( 2L ) ); + assertThat( statistics.getPrepareStatementCount(), is( 2L ) ); + } + ); + } + + @Test + @TestForIssue(jiraKey = "HHH-13814") + @FailureExpected( jiraKey = "HHH-13814") + public void testMappedByAssociation() { + inTransaction( + session -> { + final Statistics statistics = sessionFactory().getStatistics(); + statistics.clear(); + Employer employer = session.get( Employer.class, 1 ); + + assertEquals( 1, statistics.getPrepareStatementCount() ); + + assertTrue( Hibernate.isPropertyInitialized( employer, "employerInfo" ) ); + EmployerInfo employerInfo = employer.employerInfo; + assertFalse( Hibernate.isInitialized( employerInfo ) ); + Hibernate.initialize( employerInfo ); + assertTrue( Hibernate.isPropertyInitialized( employerInfo, "employer" ) ); + assertSame( employer, employerInfo.employer ); + + assertThat( statistics.getEntityLoadCount(), is( 2L ) ); + assertThat( statistics.getPrepareStatementCount(), is( 2L ) ); + } + ); + } + + + @Override + protected Class[] getAnnotatedClasses() { + return new Class[] { + EmployerInfo.class, + Employer.class + }; + } + + @Before + public void setUpData() { + inTransaction( + session -> { + final Employer employer = new Employer(); + employer.id = 1; + employer.name = "Employer #" + employer.id; + final EmployerInfo employerInfo = new EmployerInfo(); + employer.employerInfo = employerInfo; + employerInfo.employer = employer; + session.persist( employer ); + } + ); + } + + @After + public void cleanupDate() { + inTransaction( + session -> { + session.createQuery( "delete from EmployerInfo" ).executeUpdate(); + session.createQuery( "delete from Employer" ).executeUpdate(); + } + ); + } + + @Override + protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) { + super.configureStandardServiceRegistryBuilder( ssrb ); + ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" ); + ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" ); + ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" ); + ssrb.applySetting( AvailableSettings.SHOW_SQL, true ); + } + + @Override + protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) { + super.configureSessionFactoryBuilder( sfb ); + sfb.applyStatisticsSupport( true ); + sfb.applySecondLevelCacheSupport( false ); + sfb.applyQueryCacheSupport( false ); + } + + @Entity(name = "EmployerInfo") + public static class EmployerInfo { + @Id + private int id; + + @MapsId + @OneToOne(optional = false, fetch = FetchType.LAZY) + @LazyToOne(LazyToOneOption.NO_PROXY) + private Employer employer; + + private String info; + } + + @Entity(name = "Employer") + public static class Employer { + @Id + private int id; + + @OneToOne(optional = false, fetch = FetchType.LAZY, mappedBy = "employer", cascade = CascadeType.ALL) + @LazyToOne(LazyToOneOption.NO_PROXY) + private EmployerInfo employerInfo; + + private String name; + } +} \ No newline at end of file diff --git a/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/MapsIdProxyUnidirectionalTest.java b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/MapsIdProxyUnidirectionalTest.java new file mode 100644 index 0000000000..8fb188f4a0 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/MapsIdProxyUnidirectionalTest.java @@ -0,0 +1,137 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.test.bytecode.enhancement.lazy.proxy; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.MapsId; +import javax.persistence.OneToOne; + +import org.hibernate.Hibernate; +import org.hibernate.annotations.LazyToOne; +import org.hibernate.annotations.LazyToOneOption; +import org.hibernate.boot.SessionFactoryBuilder; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.cfg.AvailableSettings; +import org.hibernate.stat.Statistics; + +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner; +import org.hibernate.testing.bytecode.enhancement.EnhancementOptions; +import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +/** + * @author Gail Badner + */ + +@TestForIssue(jiraKey = "HHH-13814") +@RunWith( BytecodeEnhancerRunner.class ) +@EnhancementOptions( lazyLoading = true ) +public class MapsIdProxyUnidirectionalTest extends BaseNonConfigCoreFunctionalTestCase { + + @Test + @TestForIssue(jiraKey = "HHH-13814") + public void testBatchAssociation() { + inTransaction( + session -> { + final Statistics statistics = sessionFactory().getStatistics(); + statistics.clear(); + EmployerInfo employerInfo = session.get( EmployerInfo.class, 1 ); + + assertEquals( 1, statistics.getPrepareStatementCount() ); + + assertTrue( Hibernate.isPropertyInitialized( employerInfo, "employer" ) ); + assertFalse( Hibernate.isInitialized( employerInfo.employer ) ); + Hibernate.initialize( employerInfo.employer ); + + assertThat( statistics.getEntityLoadCount(), is( 2L ) ); + assertThat( statistics.getPrepareStatementCount(), is( 2L ) ); + } + ); + } + + @Override + protected Class[] getAnnotatedClasses() { + return new Class[] { + EmployerInfo.class, + Employer.class + }; + } + + @Before + public void setUpData() { + inTransaction( + session -> { + final Employer employer = new Employer(); + employer.id =1; + employer.name = "Employer #" + employer.id; + final EmployerInfo employerInfo = new EmployerInfo(); + employerInfo.employer = employer; + session.persist( employer ); + session.persist( employerInfo ); + } + ); + } + + @After + public void cleanupDate() { + inTransaction( + session -> { + session.createQuery( "delete from EmployerInfo" ).executeUpdate(); + session.createQuery( "delete from Employer" ).executeUpdate(); + } + ); + } + + @Override + protected void configureStandardServiceRegistryBuilder(StandardServiceRegistryBuilder ssrb) { + super.configureStandardServiceRegistryBuilder( ssrb ); + ssrb.applySetting( AvailableSettings.ALLOW_ENHANCEMENT_AS_PROXY, "true" ); + ssrb.applySetting( AvailableSettings.FORMAT_SQL, "false" ); + ssrb.applySetting( AvailableSettings.GENERATE_STATISTICS, "true" ); + ssrb.applySetting( AvailableSettings.SHOW_SQL, true ); + } + + @Override + protected void configureSessionFactoryBuilder(SessionFactoryBuilder sfb) { + super.configureSessionFactoryBuilder( sfb ); + sfb.applyStatisticsSupport( true ); + sfb.applySecondLevelCacheSupport( false ); + sfb.applyQueryCacheSupport( false ); + } + + @Entity(name = "EmployerInfo") + public static class EmployerInfo { + @Id + private int id; + + @MapsId + @OneToOne(optional = false, fetch = FetchType.LAZY) + @LazyToOne(LazyToOneOption.NO_PROXY) + private Employer employer; + + } + + @Entity(name = "Employer") + public static class Employer { + @Id + private int id; + + private String name; + } +} \ No newline at end of file