Skip to content

Commit

Permalink
HHH-15923 - Clean-up the org.hibernate.loader package
Browse files Browse the repository at this point in the history
HHH-15799 - API/internal split for org.hibernate.cfg package

and some minor Javadoc work
  • Loading branch information
sebersole committed Dec 21, 2022
1 parent 98174c8 commit 32cc739
Show file tree
Hide file tree
Showing 38 changed files with 174 additions and 183 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
*/
package org.hibernate.annotations;

import org.hibernate.property.access.spi.PropertyAccessStrategy;
import org.hibernate.binder.internal.AttributeAccessorBinder;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import org.hibernate.binder.internal.AttributeAccessorBinder;
import org.hibernate.property.access.spi.PropertyAccessStrategy;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* Names a persistent property access strategy ({@link PropertyAccessStrategy}) to use.
* Specifies an attribute {@linkplain PropertyAccessStrategy access strategy} to use.
* <p>
* Can be specified at either:<ul>
* <li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class BeanValidationIntegrator implements Integrator {
public static final String MODE_PROPERTY = "javax.persistence.validation.mode";
public static final String JAKARTA_MODE_PROPERTY = "jakarta.persistence.validation.mode";

private static final String ACTIVATOR_CLASS_NAME = "org.hibernate.cfg.beanvalidation.TypeSafeActivator";
private static final String ACTIVATOR_CLASS_NAME = "org.hibernate.boot.beanvalidation.TypeSafeActivator";
private static final String VALIDATE_SUPPLIED_FACTORY_METHOD_NAME = "validateSuppliedFactory";
private static final String ACTIVATE_METHOD_NAME = "activate";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
import org.hibernate.boot.spi.MetadataBuildingContext;
import org.hibernate.boot.spi.PropertyData;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.loader.PropertyPath;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Join;
import org.hibernate.mapping.KeyValue;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Table;
import org.hibernate.spi.NavigablePath;

import jakarta.persistence.Column;
import jakarta.persistence.Convert;
Expand Down Expand Up @@ -352,7 +352,7 @@ public Column[] getOverriddenColumn(String propertyName) {
}
}
if ( result == null ) {
String userPropertyName = extractUserPropertyName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY, propertyName );
String userPropertyName = extractUserPropertyName( NavigablePath.IDENTIFIER_MAPPER_PROPERTY, propertyName );
if ( userPropertyName != null ) {
result = super.getOverriddenColumn( userPropertyName );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
import org.hibernate.engine.spi.FilterDefinition;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.jpa.event.spi.CallbackType;
import org.hibernate.loader.PropertyPath;
import org.hibernate.mapping.BasicValue;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.DependantValue;
Expand All @@ -96,6 +95,7 @@
import org.hibernate.mapping.UnionSubclass;
import org.hibernate.mapping.Value;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.spi.NavigablePath;

import org.jboss.logging.Logger;

Expand Down Expand Up @@ -382,7 +382,7 @@ private Component createMapperProperty(
propertyAccessor
);
final Property mapperProperty = new Property();
mapperProperty.setName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY );
mapperProperty.setName( NavigablePath.IDENTIFIER_MAPPER_PROPERTY );
mapperProperty.setUpdateable( false );
mapperProperty.setInsertable( false );
mapperProperty.setPropertyAccessorName( "embedded" );
Expand All @@ -404,7 +404,7 @@ private Component createMapper(
propertyHolder,
new PropertyPreloadedData(
propertyAccessor,
PropertyPath.IDENTIFIER_MAPPER_PROPERTY,
NavigablePath.IDENTIFIER_MAPPER_PROPERTY,
compositeClass
),
baseInferredData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import org.hibernate.boot.model.source.spi.AttributePath;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.loader.PropertyPath;
import org.hibernate.spi.NavigablePath;

/**
* An ImplicitNamingStrategy implementation which uses full composite paths
Expand Down Expand Up @@ -37,7 +37,7 @@ public static void process(AttributePath attributePath, StringBuilder sb) {
process( parent, sb );
sb.append( '_' );
}
else if ( PropertyPath.IDENTIFIER_MAPPER_PROPERTY.equals( property ) ) {
else if ( NavigablePath.IDENTIFIER_MAPPER_PROPERTY.equals( property ) ) {
// skip it, do not pass go
sb.append( "id" );
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.loader.PropertyPath;
import org.hibernate.mapping.Any;
import org.hibernate.mapping.Array;
import org.hibernate.mapping.AttributeContainer;
Expand Down Expand Up @@ -148,6 +147,7 @@
import org.hibernate.mapping.Value;
import org.hibernate.resource.beans.spi.ManagedBean;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.spi.NavigablePath;
import org.hibernate.tuple.GenerationTiming;
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
import org.hibernate.type.BasicType;
Expand Down Expand Up @@ -850,7 +850,7 @@ private String extractIdClassName(IdentifierSourceAggregatedComposite identifier
return identifierSource.getEmbeddableSource().getTypeDescriptor().getName();
}

private static final String ID_MAPPER_PATH_PART = '<' + PropertyPath.IDENTIFIER_MAPPER_PROPERTY + '>';
private static final String ID_MAPPER_PATH_PART = '<' + NavigablePath.IDENTIFIER_MAPPER_PROPERTY + '>';

private void bindNonAggregatedCompositeEntityIdentifier(
MappingDocument mappingDocument,
Expand Down Expand Up @@ -899,7 +899,7 @@ private void bindNonAggregatedCompositeEntityIdentifier(
rootEntityDescriptor.setIdentifierMapper( mapper );
rootEntityDescriptor.setDeclaredIdentifierMapper( mapper );
Property property = new Property();
property.setName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY );
property.setName( NavigablePath.IDENTIFIER_MAPPER_PROPERTY );
property.setUpdateable( false );
property.setInsertable( false );
property.setValue( mapper );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.hibernate.event.spi.LoadEventListener;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.loader.entity.CacheEntityLoaderHelper;
import org.hibernate.loader.entity.CacheEntityLoaderHelper.PersistenceContextEntry;
import org.hibernate.loader.ast.internal.CacheEntityLoaderHelper;
import org.hibernate.loader.ast.internal.CacheEntityLoaderHelper.PersistenceContextEntry;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.CompositeIdentifierMapping;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.Properties;

import org.hibernate.MappingException;
import org.hibernate.Session;
import org.hibernate.TransientObjectException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.factory.spi.StandardGenerator;
Expand All @@ -22,7 +21,7 @@
import static org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved;
import static org.hibernate.id.IdentifierGeneratorHelper.SHORT_CIRCUIT_INDICATOR;
import static org.hibernate.internal.CoreLogging.messageLogger;
import static org.hibernate.loader.PropertyPath.IDENTIFIER_MAPPER_PROPERTY;
import static org.hibernate.spi.NavigablePath.IDENTIFIER_MAPPER_PROPERTY;

/**
* <b>foreign</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.Map;
import java.util.Set;

import jakarta.persistence.metamodel.Metamodel;
import org.hibernate.CacheMode;
import org.hibernate.ConnectionAcquisitionMode;
import org.hibernate.FetchNotFoundException;
Expand Down Expand Up @@ -53,6 +52,7 @@
import org.hibernate.TypeMismatchException;
import org.hibernate.UnknownProfileException;
import org.hibernate.UnresolvableObjectException;
import org.hibernate.binder.internal.TenantIdBinder;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
Expand All @@ -72,12 +72,11 @@
import org.hibernate.engine.spi.Status;
import org.hibernate.engine.transaction.spi.TransactionImplementor;
import org.hibernate.engine.transaction.spi.TransactionObserver;
import org.hibernate.event.spi.DeleteContext;
import org.hibernate.event.spi.MergeContext;
import org.hibernate.event.spi.AutoFlushEvent;
import org.hibernate.event.spi.AutoFlushEventListener;
import org.hibernate.event.spi.ClearEvent;
import org.hibernate.event.spi.ClearEventListener;
import org.hibernate.event.spi.DeleteContext;
import org.hibernate.event.spi.DeleteEvent;
import org.hibernate.event.spi.DeleteEventListener;
import org.hibernate.event.spi.DirtyCheckEvent;
Expand All @@ -94,6 +93,7 @@
import org.hibernate.event.spi.LoadEventListener.LoadType;
import org.hibernate.event.spi.LockEvent;
import org.hibernate.event.spi.LockEventListener;
import org.hibernate.event.spi.MergeContext;
import org.hibernate.event.spi.MergeEvent;
import org.hibernate.event.spi.MergeEventListener;
import org.hibernate.event.spi.PersistContext;
Expand All @@ -118,10 +118,10 @@
import org.hibernate.jpa.internal.util.FlushModeTypeHelper;
import org.hibernate.jpa.internal.util.LockModeTypeHelper;
import org.hibernate.jpa.internal.util.LockOptionsHelper;
import org.hibernate.loader.access.IdentifierLoadAccessImpl;
import org.hibernate.loader.access.LoadAccessContext;
import org.hibernate.loader.access.NaturalIdLoadAccessImpl;
import org.hibernate.loader.access.SimpleNaturalIdLoadAccessImpl;
import org.hibernate.loader.internal.IdentifierLoadAccessImpl;
import org.hibernate.loader.internal.LoadAccessContext;
import org.hibernate.loader.internal.NaturalIdLoadAccessImpl;
import org.hibernate.loader.internal.SimpleNaturalIdLoadAccessImpl;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.procedure.ProcedureCall;
Expand All @@ -141,7 +141,7 @@
import org.hibernate.stat.SessionStatistics;
import org.hibernate.stat.internal.SessionStatisticsImpl;
import org.hibernate.stat.spi.StatisticsImplementor;
import org.hibernate.binder.internal.TenantIdBinder;
import org.hibernate.type.descriptor.WrapperOptions;

import jakarta.persistence.CacheRetrieveMode;
import jakarta.persistence.CacheStoreMode;
Expand All @@ -152,14 +152,14 @@
import jakarta.persistence.LockModeType;
import jakarta.persistence.PersistenceException;
import jakarta.persistence.TransactionRequiredException;
import org.hibernate.type.descriptor.WrapperOptions;
import jakarta.persistence.metamodel.Metamodel;

import static org.hibernate.CacheMode.fromJpaModes;
import static org.hibernate.cfg.AvailableSettings.CRITERIA_COPY_TREE;
import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_SCOPE;
import static org.hibernate.cfg.AvailableSettings.JAKARTA_LOCK_TIMEOUT;
import static org.hibernate.cfg.AvailableSettings.JAKARTA_SHARED_CACHE_RETRIEVE_MODE;
import static org.hibernate.cfg.AvailableSettings.JAKARTA_SHARED_CACHE_STORE_MODE;
import static org.hibernate.cfg.AvailableSettings.CRITERIA_COPY_TREE;
import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_SCOPE;
import static org.hibernate.cfg.AvailableSettings.JPA_LOCK_TIMEOUT;
import static org.hibernate.cfg.AvailableSettings.JPA_SHARED_CACHE_RETRIEVE_MODE;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
import org.hibernate.HibernateException;

/**
* Thrown when Hibernate encounters a non-unique SQL alias in the ResultSet
* while processing the results of a {@linkplain org.hibernate.query.NativeQuery}
* using auto-discovery to understand the {@linkplain java.sql.ResultSetMetaData ResultSet metadata}
* for mapping the JDBC values to the domain result.
*
* @author Steve Ebersole
*/
public class NonUniqueDiscoveredSqlAliasException extends HibernateException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

/**
* @author Steve Ebersole
*
* @deprecated Use {@link NavigablePath} or {@link org.hibernate.metamodel.model.domain.NavigableRole}
* instead, depending on need.
*/
@Deprecated(since = "6", forRemoval = true)
public class PropertyPath implements DotIdentifierSequence {
public static final String IDENTIFIER_MAPPER_PROPERTY = NavigablePath.IDENTIFIER_MAPPER_PROPERTY;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.loader.ast.spi.Loadable;
import org.hibernate.loader.ast.spi.NaturalIdLoadOptions;
import org.hibernate.loader.ast.spi.NaturalIdLoader;
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
Expand All @@ -30,7 +29,6 @@
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.query.internal.SimpleQueryOptions;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.query.spi.QueryParameterBindings;
import org.hibernate.spi.NavigablePath;
import org.hibernate.sql.ast.Clause;
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
Expand Down Expand Up @@ -87,7 +85,7 @@ protected NaturalIdMapping naturalIdMapping() {
}

@Override
public Loadable getLoadable() {
public EntityMappingType getLoadable() {
return entityDescriptor();
}

Expand Down Expand Up @@ -177,17 +175,13 @@ protected <L> L selectByNaturalId(

final SelectStatement sqlSelect = new SelectStatement( rootQuerySpec, Collections.singletonList( domainResult ) );

final List<JdbcParameter> jdbcParameters = new ArrayList<>( naturalIdMapping.getJdbcTypeCount() );
final JdbcParameterBindings jdbcParamBindings = new JdbcParameterBindingsImpl( jdbcParameters.size() );
final JdbcParameterBindings jdbcParamBindings = new JdbcParameterBindingsImpl( naturalIdMapping.getJdbcTypeCount() );

applyNaturalIdRestriction(
bindValue,
rootTableGroup,
rootQuerySpec::applyPredicate,
(jdbcParameter, jdbcParameterBinding) -> {
jdbcParameters.add( jdbcParameter );
jdbcParamBindings.addBinding( jdbcParameter, jdbcParameterBinding );
},
jdbcParamBindings::addBinding,
sqlAstCreationState,
session
);
Expand Down Expand Up @@ -250,7 +244,7 @@ protected Expression resolveColumnReference(
TableGroup rootTableGroup,
SelectableMapping selectableMapping,
SqlExpressionResolver sqlExpressionResolver,
SessionFactoryImplementor sessionFactory) {
@SuppressWarnings("unused") SessionFactoryImplementor sessionFactory) {
final TableReference tableReference = rootTableGroup.getTableReference( rootTableGroup.getNavigablePath(), selectableMapping.getContainingTableExpression() );
if ( tableReference == null ) {
throw new IllegalStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* 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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
*/
package org.hibernate.loader.entity;
package org.hibernate.loader.ast.internal;

import org.hibernate.HibernateException;
import org.hibernate.Incubating;
Expand Down

0 comments on commit 32cc739

Please sign in to comment.