mark some ancient hacks as deprecated
because apparently some users depend on them also mark IdentifierGeneratorHelper as @Internal
This commit is contained in:
parent
4dc03a9c39
commit
6fd0ddfbec
|
@ -35,7 +35,7 @@ import static org.hibernate.spi.NavigablePath.IDENTIFIER_MAPPER_PROPERTY;
|
||||||
*
|
*
|
||||||
* @deprecated This remains around as an implementation detail of {@code hbm.xml} mappings.
|
* @deprecated This remains around as an implementation detail of {@code hbm.xml} mappings.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since = "6")
|
@Deprecated(since = "6", forRemoval = true)
|
||||||
public class ForeignGenerator implements IdentifierGenerator, StandardGenerator {
|
public class ForeignGenerator implements IdentifierGenerator, StandardGenerator {
|
||||||
private static final CoreMessageLogger LOG = messageLogger( ForeignGenerator.class );
|
private static final CoreMessageLogger LOG = messageLogger( ForeignGenerator.class );
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
package org.hibernate.id;
|
package org.hibernate.id;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.Internal;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.internal.CoreLogging;
|
import org.hibernate.internal.CoreLogging;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
|
@ -32,6 +33,7 @@ import java.util.Objects;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@Internal
|
||||||
public final class IdentifierGeneratorHelper {
|
public final class IdentifierGeneratorHelper {
|
||||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( IdentifierGeneratorHelper.class );
|
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( IdentifierGeneratorHelper.class );
|
||||||
|
|
||||||
|
@ -40,7 +42,10 @@ public final class IdentifierGeneratorHelper {
|
||||||
* short-circuit any continued generated id checking. Currently, this is only used in the case of the
|
* short-circuit any continued generated id checking. Currently, this is only used in the case of the
|
||||||
* {@linkplain ForeignGenerator foreign} generator as a way to signal that we should use the associated
|
* {@linkplain ForeignGenerator foreign} generator as a way to signal that we should use the associated
|
||||||
* entity's id value.
|
* entity's id value.
|
||||||
|
*
|
||||||
|
* @deprecated This is not an elegant way to do anything
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
public static final Serializable SHORT_CIRCUIT_INDICATOR = new Serializable() {
|
public static final Serializable SHORT_CIRCUIT_INDICATOR = new Serializable() {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -51,7 +56,10 @@ public final class IdentifierGeneratorHelper {
|
||||||
/**
|
/**
|
||||||
* Marker object returned from {@link IdentifierGenerator#generate} to indicate that the entity's
|
* Marker object returned from {@link IdentifierGenerator#generate} to indicate that the entity's
|
||||||
* identifier will be generated as part of the database insertion.
|
* identifier will be generated as part of the database insertion.
|
||||||
|
*
|
||||||
|
* @deprecated Use a {@link org.hibernate.generator.OnExecutionGenerator}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
public static final Serializable POST_INSERT_INDICATOR = new Serializable() {
|
public static final Serializable POST_INSERT_INDICATOR = new Serializable() {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -176,6 +184,7 @@ public final class IdentifierGeneratorHelper {
|
||||||
throw new IdentifierGenerationException( "Unknown IntegralDataTypeHolder impl [" + holder + "]" );
|
throw new IdentifierGenerationException( "Unknown IntegralDataTypeHolder impl [" + holder + "]" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Internal
|
||||||
public static class BasicHolder implements IntegralDataTypeHolder {
|
public static class BasicHolder implements IntegralDataTypeHolder {
|
||||||
private final Class<?> exactType;
|
private final Class<?> exactType;
|
||||||
private long value = Long.MIN_VALUE;
|
private long value = Long.MIN_VALUE;
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.hibernate.Internal;
|
import org.hibernate.Internal;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
@ -32,6 +31,7 @@ import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.spi.Mapping;
|
import org.hibernate.engine.spi.Mapping;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.id.CompositeNestedGeneratedValueGenerator;
|
import org.hibernate.id.CompositeNestedGeneratedValueGenerator;
|
||||||
|
import org.hibernate.id.IdentifierGenerationException;
|
||||||
import org.hibernate.id.IdentifierGenerator;
|
import org.hibernate.id.IdentifierGenerator;
|
||||||
import org.hibernate.id.factory.IdentifierGeneratorFactory;
|
import org.hibernate.id.factory.IdentifierGeneratorFactory;
|
||||||
import org.hibernate.internal.util.ReflectHelper;
|
import org.hibernate.internal.util.ReflectHelper;
|
||||||
|
@ -48,7 +48,6 @@ import org.hibernate.type.EmbeddedComponentType;
|
||||||
|
|
||||||
import static java.util.stream.Collectors.toList;
|
import static java.util.stream.Collectors.toList;
|
||||||
import static org.hibernate.generator.EventType.INSERT;
|
import static org.hibernate.generator.EventType.INSERT;
|
||||||
import static org.hibernate.id.IdentifierGeneratorHelper.POST_INSERT_INDICATOR;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mapping model object that represents an {@linkplain jakarta.persistence.Embeddable embeddable class}.
|
* A mapping model object that represents an {@linkplain jakarta.persistence.Embeddable embeddable class}.
|
||||||
|
@ -659,11 +658,12 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
|
||||||
@Override
|
@Override
|
||||||
public void execute(SharedSessionContractImplementor session, Object incomingObject, Object injectionContext) {
|
public void execute(SharedSessionContractImplementor session, Object incomingObject, Object injectionContext) {
|
||||||
if ( !subgenerator.generatedOnExecution() ) {
|
if ( !subgenerator.generatedOnExecution() ) {
|
||||||
Object generatedId = ( (BeforeExecutionGenerator) subgenerator).generate( session, incomingObject, null, INSERT );
|
final Object generatedId = ( (BeforeExecutionGenerator) subgenerator)
|
||||||
|
.generate( session, incomingObject, null, INSERT );
|
||||||
injector.set( injectionContext, generatedId );
|
injector.set( injectionContext, generatedId );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
injector.set( injectionContext, POST_INSERT_INDICATOR );
|
throw new IdentifierGenerationException( "Identity generation isn't supported for composite ids" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue