more removals of previously-deprecated stuff
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
7e536a269e
commit
5c29ed933e
|
@ -175,7 +175,7 @@ public class EntityInsertAction extends AbstractEntityInsertAction {
|
||||||
final StatisticsImplementor statistics = factory.getStatistics();
|
final StatisticsImplementor statistics = factory.getStatistics();
|
||||||
if ( put && statistics.isStatisticsEnabled() ) {
|
if ( put && statistics.isStatisticsEnabled() ) {
|
||||||
statistics.entityCachePut(
|
statistics.entityCachePut(
|
||||||
StatsHelper.INSTANCE.getRootEntityRole( persister ),
|
StatsHelper.getRootEntityRole( persister ),
|
||||||
cache.getRegion().getName()
|
cache.getRegion().getName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ public class EntityInsertAction extends AbstractEntityInsertAction {
|
||||||
final StatisticsImplementor statistics = factory.getStatistics();
|
final StatisticsImplementor statistics = factory.getStatistics();
|
||||||
if ( put && statistics.isStatisticsEnabled() ) {
|
if ( put && statistics.isStatisticsEnabled() ) {
|
||||||
statistics.entityCachePut(
|
statistics.entityCachePut(
|
||||||
StatsHelper.INSTANCE.getRootEntityRole( persister ),
|
StatsHelper.getRootEntityRole( persister ),
|
||||||
cache.getRegion().getName()
|
cache.getRegion().getName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,7 @@ public class EntityUpdateAction extends EntityAction {
|
||||||
final StatisticsImplementor statistics = session.getFactory().getStatistics();
|
final StatisticsImplementor statistics = session.getFactory().getStatistics();
|
||||||
if ( put && statistics.isStatisticsEnabled() ) {
|
if ( put && statistics.isStatisticsEnabled() ) {
|
||||||
statistics.entityCachePut(
|
statistics.entityCachePut(
|
||||||
StatsHelper.INSTANCE.getRootEntityRole( persister ),
|
StatsHelper.getRootEntityRole( persister ),
|
||||||
getPersister().getCacheAccessStrategy().getRegion().getName()
|
getPersister().getCacheAccessStrategy().getRegion().getName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ public class EntityUpdateAction extends EntityAction {
|
||||||
final StatisticsImplementor statistics = session.getFactory().getStatistics();
|
final StatisticsImplementor statistics = session.getFactory().getStatistics();
|
||||||
if ( put && statistics.isStatisticsEnabled() ) {
|
if ( put && statistics.isStatisticsEnabled() ) {
|
||||||
statistics.entityCachePut(
|
statistics.entityCachePut(
|
||||||
StatsHelper.INSTANCE.getRootEntityRole( getPersister() ),
|
StatsHelper.getRootEntityRole( getPersister() ),
|
||||||
cache.getRegion().getName()
|
cache.getRegion().getName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* 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>.
|
||||||
|
*/
|
||||||
|
package org.hibernate.boot.internal;
|
||||||
|
|
||||||
|
import org.hibernate.AnnotationException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates a failure processing a {@link org.hibernate.boot.spi.SecondPass},
|
||||||
|
* where the hope is that subsequent processing will be able to recover from it.
|
||||||
|
*
|
||||||
|
* @author Emmanuel Bernard
|
||||||
|
*
|
||||||
|
* @deprecated It would be nice to be able to eliminate this completely
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public class FailedSecondPassException extends AnnotationException {
|
||||||
|
/**
|
||||||
|
* Constructs a FailedSecondPassException using the given message and underlying cause.
|
||||||
|
*
|
||||||
|
* @param msg The message explaining the condition that caused the exception
|
||||||
|
* @param cause The underlying exception
|
||||||
|
*/
|
||||||
|
public FailedSecondPassException(String msg, Throwable cause) {
|
||||||
|
super( msg, cause );
|
||||||
|
}
|
||||||
|
}
|
|
@ -80,7 +80,6 @@ import org.hibernate.boot.spi.NaturalIdUniqueKeyBinder;
|
||||||
import org.hibernate.boot.spi.PropertyData;
|
import org.hibernate.boot.spi.PropertyData;
|
||||||
import org.hibernate.boot.spi.SecondPass;
|
import org.hibernate.boot.spi.SecondPass;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.cfg.RecoverableException;
|
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.spi.FilterDefinition;
|
import org.hibernate.engine.spi.FilterDefinition;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
@ -2036,7 +2035,7 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector,
|
||||||
try {
|
try {
|
||||||
pass.doSecondPass( getEntityBindingMap() );
|
pass.doSecondPass( getEntityBindingMap() );
|
||||||
}
|
}
|
||||||
catch (RecoverableException e) {
|
catch (FailedSecondPassException e) {
|
||||||
failingSecondPasses.add( pass );
|
failingSecondPasses.add( pass );
|
||||||
if ( originalException == null ) {
|
if ( originalException == null ) {
|
||||||
originalException = (RuntimeException) e.getCause();
|
originalException = (RuntimeException) e.getCause();
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.annotations.JoinColumnOrFormula;
|
import org.hibernate.annotations.JoinColumnOrFormula;
|
||||||
import org.hibernate.annotations.JoinFormula;
|
import org.hibernate.annotations.JoinFormula;
|
||||||
|
import org.hibernate.boot.internal.FailedSecondPassException;
|
||||||
import org.hibernate.boot.model.naming.EntityNaming;
|
import org.hibernate.boot.model.naming.EntityNaming;
|
||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
import org.hibernate.boot.model.naming.ImplicitJoinColumnNameSource;
|
import org.hibernate.boot.model.naming.ImplicitJoinColumnNameSource;
|
||||||
|
@ -27,7 +28,6 @@ import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||||
import org.hibernate.boot.spi.PropertyData;
|
import org.hibernate.boot.spi.PropertyData;
|
||||||
import org.hibernate.cfg.RecoverableException;
|
|
||||||
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
|
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.mapping.Column;
|
import org.hibernate.mapping.Column;
|
||||||
|
@ -324,7 +324,7 @@ public class AnnotatedJoinColumns extends AnnotatedColumns {
|
||||||
// we throw a recoverable exception here in case this
|
// we throw a recoverable exception here in case this
|
||||||
// is merely an ordering issue, so that the SecondPass
|
// is merely an ordering issue, so that the SecondPass
|
||||||
// will get reprocessed later
|
// will get reprocessed later
|
||||||
throw new RecoverableException( me.getMessage(), me );
|
throw new FailedSecondPassException( me.getMessage(), me );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Table table = table( columnOwner );
|
final Table table = table( columnOwner );
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* 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>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.cache.spi;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.hibernate.Remove;
|
|
||||||
import org.hibernate.engine.spi.TypedValue;
|
|
||||||
import org.hibernate.type.Type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allows cached queries to be keyed by enabled filters.
|
|
||||||
*
|
|
||||||
* @author Gavin King
|
|
||||||
*
|
|
||||||
* @deprecated this class is no longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2") @Remove
|
|
||||||
public final class FilterKey implements Serializable {
|
|
||||||
private final String filterName;
|
|
||||||
private final Map<String,TypedValue> filterParameters = new HashMap<>();
|
|
||||||
|
|
||||||
FilterKey(String name, Map<String,?> params, Map<String,Type> types) {
|
|
||||||
filterName = name;
|
|
||||||
for ( Map.Entry<String, ?> paramEntry : params.entrySet() ) {
|
|
||||||
final Type type = types.get( paramEntry.getKey() );
|
|
||||||
filterParameters.put( paramEntry.getKey(), new TypedValue( type, paramEntry.getValue() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int result = 13;
|
|
||||||
result = 37 * result + filterName.hashCode();
|
|
||||||
result = 37 * result + filterParameters.hashCode();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object other) {
|
|
||||||
if ( !(other instanceof FilterKey) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final FilterKey that = (FilterKey) other;
|
|
||||||
return that.filterName.equals( filterName )
|
|
||||||
&& that.filterParameters.equals( filterParameters );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "FilterKey[" + filterName + filterParameters + ']';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
* 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>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.cfg;
|
|
||||||
|
|
||||||
import org.hibernate.AnnotationException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An exception that indicates a condition where the hope is that subsequent processing will be able to
|
|
||||||
* recover from it.
|
|
||||||
*
|
|
||||||
* @deprecated Was only ever referenced in a single place, in an extremely dubious way.
|
|
||||||
*
|
|
||||||
* @author Emmanuel Bernard
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class RecoverableException extends AnnotationException {
|
|
||||||
/**
|
|
||||||
* Constructs a RecoverableException using the given message and underlying cause.
|
|
||||||
*
|
|
||||||
* @param msg The message explaining the condition that caused the exception
|
|
||||||
* @param cause The underlying exception
|
|
||||||
*/
|
|
||||||
public RecoverableException(String msg, Throwable cause) {
|
|
||||||
super( msg, cause );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a RecoverableException using the given message and underlying cause.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public RecoverableException(String msg) {
|
|
||||||
super( msg );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -655,7 +655,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
|
||||||
if ( pk != null ) {
|
if ( pk != null ) {
|
||||||
if ( statisticsEnabled ) {
|
if ( statisticsEnabled ) {
|
||||||
statistics.naturalIdCacheHit(
|
statistics.naturalIdCacheHit(
|
||||||
StatsHelper.INSTANCE.getRootEntityRole( persister ),
|
StatsHelper.getRootEntityRole( persister ),
|
||||||
naturalIdCacheAccessStrategy.getRegion().getName()
|
naturalIdCacheAccessStrategy.getRegion().getName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -683,7 +683,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
|
||||||
}
|
}
|
||||||
else if ( statisticsEnabled ) {
|
else if ( statisticsEnabled ) {
|
||||||
statistics.naturalIdCacheMiss(
|
statistics.naturalIdCacheMiss(
|
||||||
StatsHelper.INSTANCE.getRootEntityRole( persister ),
|
StatsHelper.getRootEntityRole( persister ),
|
||||||
naturalIdCacheAccessStrategy.getRegion().getName()
|
naturalIdCacheAccessStrategy.getRegion().getName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
/*
|
|
||||||
* 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>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.engine.transaction.spi;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*
|
|
||||||
* @deprecated use {@link org.hibernate.resource.transaction.spi.TransactionObserver}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6")
|
|
||||||
public interface TransactionObserver extends org.hibernate.resource.transaction.spi.TransactionObserver {
|
|
||||||
}
|
|
|
@ -9,7 +9,6 @@ package org.hibernate.graph;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.jpa.LegacySpecHints;
|
|
||||||
|
|
||||||
import static org.hibernate.jpa.LegacySpecHints.HINT_JAVAEE_FETCH_GRAPH;
|
import static org.hibernate.jpa.LegacySpecHints.HINT_JAVAEE_FETCH_GRAPH;
|
||||||
import static org.hibernate.jpa.LegacySpecHints.HINT_JAVAEE_LOAD_GRAPH;
|
import static org.hibernate.jpa.LegacySpecHints.HINT_JAVAEE_LOAD_GRAPH;
|
||||||
|
|
|
@ -70,7 +70,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.engine.transaction.spi.TransactionImplementor;
|
import org.hibernate.engine.transaction.spi.TransactionImplementor;
|
||||||
import org.hibernate.engine.transaction.spi.TransactionObserver;
|
import org.hibernate.resource.transaction.spi.TransactionObserver;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventManager;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
||||||
import org.hibernate.event.spi.AutoFlushEvent;
|
import org.hibernate.event.spi.AutoFlushEvent;
|
||||||
|
|
|
@ -277,13 +277,13 @@ public class CacheEntityLoaderHelper {
|
||||||
if ( statistics.isStatisticsEnabled() ) {
|
if ( statistics.isStatisticsEnabled() ) {
|
||||||
if ( ce == null ) {
|
if ( ce == null ) {
|
||||||
statistics.entityCacheMiss(
|
statistics.entityCacheMiss(
|
||||||
StatsHelper.INSTANCE.getRootEntityRole( persister ),
|
StatsHelper.getRootEntityRole( persister ),
|
||||||
cache.getRegion().getName()
|
cache.getRegion().getName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
statistics.entityCacheHit(
|
statistics.entityCacheHit(
|
||||||
StatsHelper.INSTANCE.getRootEntityRole( persister ),
|
StatsHelper.getRootEntityRole( persister ),
|
||||||
cache.getRegion().getName()
|
cache.getRegion().getName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -753,16 +753,6 @@ public class BasicCollectionPersister extends AbstractCollectionPersister {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean consumesEntityAlias() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean consumesCollectionAlias() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOneToMany() {
|
public boolean isOneToMany() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -255,14 +255,6 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean consumesEntityAlias() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean consumesCollectionAlias() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOneToMany() {
|
public boolean isOneToMany() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4301,16 +4301,6 @@ public abstract class AbstractEntityPersister
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean consumesEntityAlias() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean consumesCollectionAlias() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,5 +13,5 @@ import org.hibernate.metadata.ClassMetadata;
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public interface DeprecatedEntityStuff
|
public interface DeprecatedEntityStuff
|
||||||
extends OuterJoinLoadable, ClassMetadata, UniqueKeyLoadable, SQLLoadable, Lockable, org.hibernate.persister.entity.Queryable {
|
extends OuterJoinLoadable, ClassMetadata, UniqueKeyLoadable, SQLLoadable, Lockable, Queryable {
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,10 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget
|
||||||
* entity spaces.
|
* entity spaces.
|
||||||
*
|
*
|
||||||
* @return The synchronization spaces.
|
* @return The synchronization spaces.
|
||||||
|
*
|
||||||
|
* @deprecated No longer called
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since = "7.0", forRemoval = true)
|
||||||
default String[] getSynchronizationSpaces() {
|
default String[] getSynchronizationSpaces() {
|
||||||
return (String[]) getQuerySpaces();
|
return (String[]) getQuerySpaces();
|
||||||
}
|
}
|
||||||
|
@ -1222,7 +1225,6 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget
|
||||||
FilterAliasGenerator getFilterAliasGenerator(final String rootAlias);
|
FilterAliasGenerator getFilterAliasGenerator(final String rootAlias);
|
||||||
|
|
||||||
default FilterAliasGenerator getFilterAliasGenerator(TableGroup rootTableGroup) {
|
default FilterAliasGenerator getFilterAliasGenerator(TableGroup rootTableGroup) {
|
||||||
assert this instanceof Joinable;
|
|
||||||
return new TableGroupFilterAliasGenerator( ( (Joinable) this ).getTableName(), rootTableGroup );
|
return new TableGroupFilterAliasGenerator( ( (Joinable) this ).getTableName(), rootTableGroup );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,20 +41,4 @@ public interface Joinable extends Restrictable {
|
||||||
* Is this instance actually a CollectionPersister?
|
* Is this instance actually a CollectionPersister?
|
||||||
*/
|
*/
|
||||||
boolean isCollection();
|
boolean isCollection();
|
||||||
|
|
||||||
/**
|
|
||||||
* Very, very, very ugly...
|
|
||||||
*
|
|
||||||
* @return Does this persister "consume" entity column aliases in the result
|
|
||||||
* set?
|
|
||||||
*/
|
|
||||||
boolean consumesEntityAlias();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Very, very, very ugly...
|
|
||||||
*
|
|
||||||
* @return Does this persister "consume" collection column aliases in the result
|
|
||||||
* set?
|
|
||||||
*/
|
|
||||||
boolean consumesCollectionAlias();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,4 @@ public interface SQLLoadable extends Loadable {
|
||||||
*/
|
*/
|
||||||
Type getType();
|
Type getType();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,22 +15,16 @@ import org.hibernate.persister.entity.EntityPersister;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class StatsHelper {
|
public class StatsHelper {
|
||||||
/**
|
|
||||||
* Singleton access
|
|
||||||
*/
|
|
||||||
public static final StatsHelper INSTANCE = new StatsHelper();
|
|
||||||
|
|
||||||
public NavigableRole getRootEntityRole(EntityPersister entityDescriptor) {
|
public static NavigableRole getRootEntityRole(EntityPersister entityDescriptor) {
|
||||||
final String rootEntityName = entityDescriptor.getRootEntityName();
|
final String rootEntityName = entityDescriptor.getRootEntityName();
|
||||||
if ( entityDescriptor.getEntityName().equals( rootEntityName ) ) {
|
if ( entityDescriptor.getEntityName().equals( rootEntityName ) ) {
|
||||||
return entityDescriptor.getNavigableRole();
|
return entityDescriptor.getNavigableRole();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final EntityPersister rootEntityDescriptor = entityDescriptor.getFactory()
|
return entityDescriptor.getFactory().getMappingMetamodel()
|
||||||
.getRuntimeMetamodels()
|
.getEntityDescriptor( rootEntityName )
|
||||||
.getMappingMetamodel()
|
.getNavigableRole();
|
||||||
.getEntityDescriptor( rootEntityName );
|
|
||||||
return rootEntityDescriptor.getNavigableRole();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.hibernate.internal.util.NullnessUtil;
|
|
||||||
import org.hibernate.internal.util.collections.BoundedConcurrentHashMap;
|
import org.hibernate.internal.util.collections.BoundedConcurrentHashMap;
|
||||||
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
|
@ -160,9 +160,6 @@ public class ClobJavaType extends AbstractClassJavaType<Clob> {
|
||||||
Reader reader = (Reader) value;
|
Reader reader = (Reader) value;
|
||||||
return options.getLobCreator().createClob( DataHelper.extractString( reader ) );
|
return options.getLobCreator().createClob( DataHelper.extractString( reader ) );
|
||||||
}
|
}
|
||||||
else if ( String.class.isAssignableFrom( value.getClass() ) ) {
|
|
||||||
return options.getLobCreator().createClob( (String) value );
|
|
||||||
}
|
|
||||||
|
|
||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,148 +0,0 @@
|
||||||
/*
|
|
||||||
* 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>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.type.descriptor.java;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.sql.Blob;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
|
||||||
import org.hibernate.engine.jdbc.BinaryStream;
|
|
||||||
import org.hibernate.engine.jdbc.internal.BinaryStreamImpl;
|
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|
||||||
import org.hibernate.internal.util.compare.RowVersionComparator;
|
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Descriptor for {@code byte[]} handling specifically used for specifically for entity versions/timestamps.
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
* @author Gail Badner
|
|
||||||
*
|
|
||||||
* @deprecated No longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6")
|
|
||||||
public class RowVersionJavaType extends AbstractClassJavaType<byte[]>
|
|
||||||
implements VersionJavaType<byte[]> {
|
|
||||||
public static final RowVersionJavaType INSTANCE = new RowVersionJavaType();
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public RowVersionJavaType() {
|
|
||||||
super( byte[].class, ArrayMutabilityPlan.INSTANCE, RowVersionComparator.INSTANCE );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean areEqual(byte[] one, byte[] another) {
|
|
||||||
return one == another
|
|
||||||
|| ( one != null && another != null && Arrays.equals( one, another ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int extractHashCode(byte[] bytes) {
|
|
||||||
int hashCode = 1;
|
|
||||||
for ( byte aByte : bytes ) {
|
|
||||||
hashCode = 31 * hashCode + aByte;
|
|
||||||
}
|
|
||||||
return hashCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString(byte[] bytes) {
|
|
||||||
final StringBuilder buf = new StringBuilder( bytes.length * 2 );
|
|
||||||
for ( byte aByte : bytes ) {
|
|
||||||
final String hexStr = Integer.toHexString( aByte - Byte.MIN_VALUE );
|
|
||||||
if ( hexStr.length() == 1 ) {
|
|
||||||
buf.append( '0' );
|
|
||||||
}
|
|
||||||
buf.append( hexStr );
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String extractLoggableRepresentation(byte[] value) {
|
|
||||||
return (value == null) ? super.extractLoggableRepresentation( null ) : Arrays.toString( value );
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] fromString(CharSequence string) {
|
|
||||||
if ( string == null ) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if ( string.length() % 2 != 0 ) {
|
|
||||||
throw new IllegalArgumentException( "The string is not a valid string representation of a binary content." );
|
|
||||||
}
|
|
||||||
byte[] bytes = new byte[string.length() / 2];
|
|
||||||
for ( int i = 0; i < bytes.length; i++ ) {
|
|
||||||
final String hexStr = string.subSequence( i * 2, (i + 1) * 2 ).toString();
|
|
||||||
bytes[i] = (byte) (Integer.parseInt(hexStr, 16) + Byte.MIN_VALUE);
|
|
||||||
}
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <X> X unwrap(byte[] value, Class<X> type, WrapperOptions options) {
|
|
||||||
if ( value == null ) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if ( byte[].class.isAssignableFrom( type ) ) {
|
|
||||||
return (X) value;
|
|
||||||
}
|
|
||||||
if ( InputStream.class.isAssignableFrom( type ) ) {
|
|
||||||
return (X) new ByteArrayInputStream( value );
|
|
||||||
}
|
|
||||||
if ( BinaryStream.class.isAssignableFrom( type ) ) {
|
|
||||||
return (X) new BinaryStreamImpl( value );
|
|
||||||
}
|
|
||||||
if ( Blob.class.isAssignableFrom( type ) ) {
|
|
||||||
return (X) options.getLobCreator().createBlob( value );
|
|
||||||
}
|
|
||||||
|
|
||||||
throw unknownUnwrap( type );
|
|
||||||
}
|
|
||||||
|
|
||||||
public <X> byte[] wrap(X value, WrapperOptions options) {
|
|
||||||
if ( value == null ) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (value instanceof byte[]) {
|
|
||||||
return (byte[]) value;
|
|
||||||
}
|
|
||||||
if (value instanceof InputStream) {
|
|
||||||
return DataHelper.extractBytes( (InputStream) value );
|
|
||||||
}
|
|
||||||
if ( value instanceof Blob || DataHelper.isNClob( value.getClass() ) ) {
|
|
||||||
try {
|
|
||||||
return DataHelper.extractBytes( ( (Blob) value ).getBinaryStream() );
|
|
||||||
}
|
|
||||||
catch ( SQLException e ) {
|
|
||||||
throw new HibernateException( "Unable to access lob stream", e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw unknownWrap( value.getClass() );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte[] seed(
|
|
||||||
Long length, Integer precision, Integer scale, SharedSessionContractImplementor session) {
|
|
||||||
// Note : simply returns null for seed() and next() as the only known
|
|
||||||
// application of binary types for versioning is for use with the
|
|
||||||
// TIMESTAMP datatype supported by Sybase and SQL Server, which
|
|
||||||
// are completely db-generated values...
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte[] next(
|
|
||||||
byte[] current,
|
|
||||||
Long length,
|
|
||||||
Integer precision,
|
|
||||||
Integer scale, SharedSessionContractImplementor session) {
|
|
||||||
return current;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.orm.test.common;
|
package org.hibernate.orm.test.common;
|
||||||
|
|
||||||
import org.hibernate.engine.transaction.spi.TransactionObserver;
|
import org.hibernate.resource.transaction.spi.TransactionObserver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
|
|
@ -11,7 +11,7 @@ import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.Version;
|
import jakarta.persistence.Version;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.engine.transaction.spi.TransactionObserver;
|
import org.hibernate.resource.transaction.spi.TransactionObserver;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
|
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
|
|
@ -533,6 +533,6 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getEntityName(EntityPersister persister) {
|
private String getEntityName(EntityPersister persister) {
|
||||||
return StatsHelper.INSTANCE.getRootEntityRole( persister ).getFullPath();
|
return StatsHelper.getRootEntityRole( persister ).getFullPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,11 +198,6 @@ public abstract class MockCollectionPersister implements QueryableCollection {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean consumesCollectionAlias() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] toColumns(String propertyName) {
|
public String[] toColumns(String propertyName) {
|
||||||
return new String[] {""};
|
return new String[] {""};
|
||||||
|
|
|
@ -227,11 +227,6 @@ public abstract class MockEntityPersister implements EntityPersister, Queryable,
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean consumesEntityAlias() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getDiscriminatorType() {
|
public Type getDiscriminatorType() {
|
||||||
return typeConfiguration.getBasicTypeForJavaType(String.class);
|
return typeConfiguration.getBasicTypeForJavaType(String.class);
|
||||||
|
|
Loading…
Reference in New Issue