removal of deprecated unused code for H7 (#8485)
* remove unused stuff already marked forRemoval * remove old NamingStrategy stuff which does not actually work anymore * some cleanups to the mapping package - make a couple of deprecated methods private - delete some unnecessary code - remove all obsolete "iterator" methods
This commit is contained in:
parent
f74ab49f9e
commit
c4868bbdaf
|
@ -15,22 +15,6 @@ Hibernate looks at this as 2-stage process:
|
||||||
* Second is the resolving of this logical name to a physical name which is defined
|
* Second is the resolving of this logical name to a physical name which is defined
|
||||||
by the <<PhysicalNamingStrategy>> contract.
|
by the <<PhysicalNamingStrategy>> contract.
|
||||||
|
|
||||||
|
|
||||||
[NOTE]
|
|
||||||
.Historical NamingStrategy contract
|
|
||||||
====
|
|
||||||
Historically Hibernate defined just a single `org.hibernate.cfg.NamingStrategy`. That singular
|
|
||||||
NamingStrategy contract actually combined the separate concerns that are now modeled individually
|
|
||||||
as ImplicitNamingStrategy and PhysicalNamingStrategy.
|
|
||||||
|
|
||||||
Also, the NamingStrategy contract was often not flexible enough to properly apply a given naming
|
|
||||||
"rule", either because the API lacked the information to decide or because the API was honestly
|
|
||||||
not well defined as it grew.
|
|
||||||
|
|
||||||
Due to these limitations, `org.hibernate.cfg.NamingStrategy` has been deprecated
|
|
||||||
in favor of ImplicitNamingStrategy and PhysicalNamingStrategy.
|
|
||||||
====
|
|
||||||
|
|
||||||
At the core, the idea behind each naming strategy is to minimize the amount of
|
At the core, the idea behind each naming strategy is to minimize the amount of
|
||||||
repetitive information a developer must provide for mapping a domain model.
|
repetitive information a developer must provide for mapping a domain model.
|
||||||
|
|
||||||
|
|
|
@ -111,43 +111,4 @@ public class QueryException extends HibernateException {
|
||||||
protected final String getOriginalMessage() {
|
protected final String getOriginalMessage() {
|
||||||
return super.getMessage();
|
return super.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Wraps this exception with another, of same kind, with the specified query string.
|
|
||||||
* If this exception already has a query string defined, the same exception ({@code this})
|
|
||||||
* is returned. Otherwise, the protected {@link #generateQueryException(String)} is called,
|
|
||||||
* to allow subclasses to properly create the correct subclass for return.
|
|
||||||
*
|
|
||||||
* @param queryString The query string that led to the QueryException
|
|
||||||
*
|
|
||||||
* @return {@code this}, if {@code this} has {@code null} for {@link #getQueryString()};
|
|
||||||
* otherwise a new {@code QueryException} (or subclass) is returned.
|
|
||||||
*
|
|
||||||
* @deprecated This method is no longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true)
|
|
||||||
public final QueryException wrapWithQueryString(String queryString) {
|
|
||||||
if ( this.getQueryString() != null ) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
return generateQueryException( queryString );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called from {@link #wrapWithQueryString(String)} when we really need to
|
|
||||||
* generate a new {@code QueryException} (or subclass).
|
|
||||||
*
|
|
||||||
* @implNote implementors should take care to use {@link #getOriginalMessage()}
|
|
||||||
* for the message, not {@link #getMessage()}
|
|
||||||
*
|
|
||||||
* @param queryString The query string
|
|
||||||
*
|
|
||||||
* @return The generated {@code QueryException} (or subclass)
|
|
||||||
*
|
|
||||||
* @see #getOriginalMessage()
|
|
||||||
*/
|
|
||||||
protected QueryException generateQueryException(String queryString) {
|
|
||||||
return new QueryException( getOriginalMessage(), queryString, this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,4 @@ public class QueryParameterException extends QueryException {
|
||||||
public QueryParameterException(String message, String queryString) {
|
public QueryParameterException(String message, String queryString) {
|
||||||
super( message, queryString );
|
super( message, queryString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected QueryException generateQueryException(String queryString) {
|
|
||||||
return new QueryParameterException( super.getOriginalMessage(), queryString, this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +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.boot;
|
|
||||||
|
|
||||||
import jakarta.persistence.AttributeConverter;
|
|
||||||
|
|
||||||
import org.hibernate.Remove;
|
|
||||||
import org.hibernate.boot.model.convert.spi.ConverterDescriptor;
|
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delayed information about an AttributeConverter. Delayed until we have
|
|
||||||
* access to {@link org.hibernate.boot.internal.ClassmateContext} during
|
|
||||||
* the MetadataSources to Metadata process.
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*
|
|
||||||
* @deprecated no longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true) @Remove
|
|
||||||
public interface AttributeConverterInfo {
|
|
||||||
Class<? extends AttributeConverter> getConverterClass();
|
|
||||||
ConverterDescriptor toConverterDescriptor(MetadataBuildingContext context);
|
|
||||||
}
|
|
|
@ -75,14 +75,6 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
|
||||||
addSessionFactoryObservers( new SessionFactoryObserverForRegistration() );
|
addSessionFactoryObservers( new SessionFactoryObserverForRegistration() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated This constructor will be removed
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true)
|
|
||||||
public SessionFactoryBuilderImpl(MetadataImplementor metadata, SessionFactoryOptionsBuilder optionsBuilder) {
|
|
||||||
this( metadata, optionsBuilder, metadata.getTypeConfiguration().getMetadataBuildingContext().getBootstrapContext() );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SessionFactoryBuilder applyBeanManager(Object beanManager) {
|
public SessionFactoryBuilder applyBeanManager(Object beanManager) {
|
||||||
this.optionsBuilder.applyBeanManager( beanManager );
|
this.optionsBuilder.applyBeanManager( beanManager );
|
||||||
|
|
|
@ -1,21 +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.boot.model.internal;
|
|
||||||
|
|
||||||
import org.hibernate.Remove;
|
|
||||||
import org.hibernate.boot.AttributeConverterInfo;
|
|
||||||
import org.hibernate.boot.model.convert.spi.ConverterRegistry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*
|
|
||||||
* @deprecated use {@link ConverterRegistry}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true) @Remove
|
|
||||||
public interface AttributeConverterDefinitionCollector extends ConverterRegistry {
|
|
||||||
void addAttributeConverter(AttributeConverterInfo info);
|
|
||||||
}
|
|
|
@ -27,7 +27,7 @@
|
||||||
* </li>
|
* </li>
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* @apiNote The API defined in this package replaced the now-deprecated interface
|
* @apiNote The API defined in this package replaced the now-removed interface
|
||||||
* {@link org.hibernate.cfg.NamingStrategy} from older versions of Hibernate.
|
* {@code org.hibernate.cfg.NamingStrategy} from older versions of Hibernate.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.boot.model.naming;
|
package org.hibernate.boot.model.naming;
|
||||||
|
|
|
@ -6,12 +6,15 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.boot.model.source.internal.hbm;
|
package org.hibernate.boot.model.source.internal.hbm;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmFetchProfileType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmFetchProfileType;
|
||||||
import org.hibernate.mapping.FetchProfile;
|
import org.hibernate.mapping.FetchProfile;
|
||||||
import org.hibernate.mapping.MetadataSource;
|
import org.hibernate.mapping.MetadataSource;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
import static jakarta.persistence.FetchType.EAGER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -69,8 +72,17 @@ public class FetchProfileBinder {
|
||||||
context.getOrigin()
|
context.getOrigin()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
profile.addFetch( entityName, fetchBinding.getAssociation(), fetchBinding.getStyle().value() );
|
String association = fetchBinding.getAssociation();
|
||||||
|
profile.addFetch( new FetchProfile.Fetch(entityName, association, fetchMode(fetchBinding.getStyle().value()), EAGER ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static FetchMode fetchMode(String style) {
|
||||||
|
for ( FetchMode mode: FetchMode.values() ) {
|
||||||
|
if ( mode.name().equalsIgnoreCase( style ) ) {
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException( "Unknown FetchMode: " + style );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4124,8 +4124,7 @@ public class ModelBinder {
|
||||||
|
|
||||||
final List<Identifier> columnNames = new ArrayList<>();
|
final List<Identifier> columnNames = new ArrayList<>();
|
||||||
|
|
||||||
final UniqueKey uk = new UniqueKey();
|
final UniqueKey uk = new UniqueKey(entityBinding.getTable() );
|
||||||
uk.setTable( entityBinding.getTable() );
|
|
||||||
for ( Property attributeBinding : attributeBindings ) {
|
for ( Property attributeBinding : attributeBindings ) {
|
||||||
for ( Selectable selectable : attributeBinding.getSelectables() ) {
|
for ( Selectable selectable : attributeBinding.getSelectables() ) {
|
||||||
if ( selectable instanceof Column ) {
|
if ( selectable instanceof Column ) {
|
||||||
|
|
|
@ -229,14 +229,4 @@ public interface MetadataBuildingOptions {
|
||||||
* Check to see if extensions can be hosted in CDI
|
* Check to see if extensions can be hosted in CDI
|
||||||
*/
|
*/
|
||||||
boolean isAllowExtensionsInCdi();
|
boolean isAllowExtensionsInCdi();
|
||||||
|
|
||||||
/**
|
|
||||||
* Check to see if extensions can be hosted in CDI
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #isAllowExtensionsInCdi()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
default boolean disallowExtensionsInCdi() {
|
|
||||||
return !isAllowExtensionsInCdi();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,6 @@ class ByteBuddyEnhancementContext {
|
||||||
this.enhancementContext = Objects.requireNonNull( enhancementContext );
|
this.enhancementContext = Objects.requireNonNull( enhancementContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated as it's currently unused and we're not always actually sourcing the classes to be transformed
|
|
||||||
* from a classloader, so this getter can't always be honoured correctly.
|
|
||||||
* @return the ClassLoader provided by the underlying EnhancementContext. Might be otherwise ignored.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public ClassLoader getLoadingClassLoader() {
|
|
||||||
return enhancementContext.getLoadingClassLoader();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEntityClass(TypeDescription classDescriptor) {
|
public boolean isEntityClass(TypeDescription classDescriptor) {
|
||||||
return enhancementContext.isEntityClass( new UnloadedTypeDescription( classDescriptor ) );
|
return enhancementContext.isEntityClass( new UnloadedTypeDescription( classDescriptor ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +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 org.hibernate.Remove;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*
|
|
||||||
* @deprecated This helper class is no longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since="6.2") @Remove
|
|
||||||
public class QuerySpacesHelper {
|
|
||||||
/**
|
|
||||||
* Singleton access
|
|
||||||
*/
|
|
||||||
public static final QuerySpacesHelper INSTANCE = new QuerySpacesHelper();
|
|
||||||
|
|
||||||
private QuerySpacesHelper() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] toStringArray(Set spacesSet) {
|
|
||||||
return (String[]) spacesSet.toArray( new String[0] );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> toStringSet(String[] spacesArray) {
|
|
||||||
final HashSet<String> set = new HashSet<>();
|
|
||||||
Collections.addAll( set, spacesArray );
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Serializable> toSerializableSet(String[] spacesArray) {
|
|
||||||
final HashSet<Serializable> set = new HashSet<>();
|
|
||||||
Collections.addAll( set, spacesArray );
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -210,15 +210,4 @@ public interface AvailableSettings
|
||||||
* {@code hibernate.event.listener.eventType packageName.ClassName1, packageName.ClassName2}
|
* {@code hibernate.event.listener.eventType packageName.ClassName1, packageName.ClassName2}
|
||||||
*/
|
*/
|
||||||
String EVENT_LISTENER_PREFIX = "hibernate.event.listener";
|
String EVENT_LISTENER_PREFIX = "hibernate.event.listener";
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated There are much better ways to control the flush mode of a session,
|
|
||||||
* for example, {@link org.hibernate.SessionBuilder#flushMode} or
|
|
||||||
* {@link org.hibernate.Session#setHibernateFlushMode}.
|
|
||||||
*
|
|
||||||
* @see org.hibernate.jpa.HibernateHints#HINT_FLUSH_MODE
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true)
|
|
||||||
@SuppressWarnings("DeprecatedIsStillUsed")
|
|
||||||
String FLUSH_MODE = "org.hibernate.flushMode";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1001,17 +1001,6 @@ public class Configuration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #addSqlFunction(String, SqmFunctionDescriptor)}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public Map<String,SqmFunctionDescriptor> getSqlFunctions() {
|
|
||||||
if ( customFunctionDescriptors == null ) {
|
|
||||||
customFunctionDescriptors = new HashMap<>();
|
|
||||||
}
|
|
||||||
return customFunctionDescriptors;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a {@linkplain SqmFunctionDescriptor function descriptor} to
|
* Adds a {@linkplain SqmFunctionDescriptor function descriptor} to
|
||||||
* this configuration.
|
* this configuration.
|
||||||
|
|
|
@ -1,86 +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 java.util.Locale;
|
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Emmanuel Bernard
|
|
||||||
*
|
|
||||||
* @deprecated {@link NamingStrategy} itself has been deprecated
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class DefaultComponentSafeNamingStrategy extends PersistenceStandardNamingStrategy {
|
|
||||||
public static final NamingStrategy INSTANCE = new DefaultComponentSafeNamingStrategy();
|
|
||||||
|
|
||||||
protected static String addUnderscores(String name) {
|
|
||||||
return name.replace( '.', '_' ).toLowerCase(Locale.ROOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String propertyToColumnName(String propertyName) {
|
|
||||||
return addUnderscores( propertyName );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String collectionTableName(
|
|
||||||
String ownerEntity,
|
|
||||||
String ownerEntityTable,
|
|
||||||
String associatedEntity,
|
|
||||||
String associatedEntityTable,
|
|
||||||
String propertyName) {
|
|
||||||
final String entityTableName = associatedEntityTable != null
|
|
||||||
? associatedEntityTable
|
|
||||||
: addUnderscores(propertyName);
|
|
||||||
return tableName( ownerEntityTable + "_" + entityTableName );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String foreignKeyColumnName(
|
|
||||||
String propertyName,
|
|
||||||
String propertyEntityName,
|
|
||||||
String propertyTableName,
|
|
||||||
String referencedColumnName) {
|
|
||||||
String header = propertyName != null ? addUnderscores( propertyName ) : propertyTableName;
|
|
||||||
if ( header == null ) {
|
|
||||||
throw new AssertionFailure( "NamingStrategy not properly filled" );
|
|
||||||
}
|
|
||||||
return columnName( header + "_" + referencedColumnName );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String logicalColumnName(String columnName, String propertyName) {
|
|
||||||
return StringHelper.isNotEmpty( columnName ) ? columnName : propertyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String logicalCollectionTableName(
|
|
||||||
String tableName,
|
|
||||||
String ownerEntityTable,
|
|
||||||
String associatedEntityTable,
|
|
||||||
String propertyName) {
|
|
||||||
if ( tableName != null ) {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
final String entityTableName = associatedEntityTable != null ? associatedEntityTable : propertyName;
|
|
||||||
return ownerEntityTable + "_" + entityTableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) {
|
|
||||||
return StringHelper.isNotEmpty( columnName ) ?
|
|
||||||
columnName :
|
|
||||||
propertyName + "_" + referencedColumn;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,124 +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 java.io.Serializable;
|
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default {@link NamingStrategy}
|
|
||||||
*
|
|
||||||
* @see ImprovedNamingStrategy a better alternative
|
|
||||||
* @author Gavin King
|
|
||||||
*
|
|
||||||
* @deprecated {@link NamingStrategy} itself has been deprecated
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class DefaultNamingStrategy implements NamingStrategy, Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The singleton instance
|
|
||||||
*/
|
|
||||||
public static final NamingStrategy INSTANCE = new DefaultNamingStrategy();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the unqualified class name
|
|
||||||
*/
|
|
||||||
public String classToTableName(String className) {
|
|
||||||
return StringHelper.unqualify(className);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return the unqualified property name
|
|
||||||
*/
|
|
||||||
public String propertyToColumnName(String propertyName) {
|
|
||||||
return StringHelper.unqualify(propertyName);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return the argument
|
|
||||||
*/
|
|
||||||
public String tableName(String tableName) {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return the argument
|
|
||||||
*/
|
|
||||||
public String columnName(String columnName) {
|
|
||||||
return columnName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the unqualified property name, not the best strategy but a backward compatible one
|
|
||||||
*/
|
|
||||||
public String collectionTableName(
|
|
||||||
String ownerEntity,
|
|
||||||
String ownerEntityTable,
|
|
||||||
String associatedEntity,
|
|
||||||
String associatedEntityTable,
|
|
||||||
String propertyName) {
|
|
||||||
//use a degenerated strategy for backward compatibility
|
|
||||||
return StringHelper.unqualify(propertyName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the argument
|
|
||||||
*/
|
|
||||||
public String joinKeyColumnName(String joinedColumn, String joinedTable) {
|
|
||||||
return columnName( joinedColumn );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the property name or propertyTableName
|
|
||||||
*/
|
|
||||||
public String foreignKeyColumnName(
|
|
||||||
String propertyName,
|
|
||||||
String propertyEntityName,
|
|
||||||
String propertyTableName,
|
|
||||||
String referencedColumnName) {
|
|
||||||
final String header = propertyName != null ? StringHelper.unqualify( propertyName ) : propertyTableName;
|
|
||||||
if (header == null) {
|
|
||||||
throw new AssertionFailure("NammingStrategy not properly filled");
|
|
||||||
}
|
|
||||||
return columnName( header ); //+ "_" + referencedColumnName not used for backward compatibility
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the column name or the unqualified property name
|
|
||||||
*/
|
|
||||||
public String logicalColumnName(String columnName, String propertyName) {
|
|
||||||
return StringHelper.isNotEmpty( columnName ) ? columnName : StringHelper.unqualify( propertyName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns either the table name if explicit or
|
|
||||||
* if there is an associated table, the concatenation of owner entity table and associated table
|
|
||||||
* otherwise the concatenation of owner entity table and the unqualified property name
|
|
||||||
*/
|
|
||||||
public String logicalCollectionTableName(
|
|
||||||
String tableName,
|
|
||||||
String ownerEntityTable,
|
|
||||||
String associatedEntityTable,
|
|
||||||
String propertyName) {
|
|
||||||
if ( tableName != null ) {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
final String entityTableName = associatedEntityTable != null
|
|
||||||
? associatedEntityTable
|
|
||||||
: StringHelper.unqualify(propertyName);
|
|
||||||
return ownerEntityTable + "_" + entityTableName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return the column name if explicit or the concatenation of the property name and the referenced column
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) {
|
|
||||||
return StringHelper.isNotEmpty( columnName ) ? columnName : propertyName + "_" + referencedColumn;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,136 +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 java.io.Serializable;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An improved naming strategy that prefers embedded
|
|
||||||
* underscores to mixed case names
|
|
||||||
*
|
|
||||||
* @see DefaultNamingStrategy the default strategy
|
|
||||||
* @author Gavin King
|
|
||||||
*
|
|
||||||
* @deprecated {@link NamingStrategy} itself has been deprecated
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class ImprovedNamingStrategy implements NamingStrategy, Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A convenient singleton instance
|
|
||||||
*/
|
|
||||||
public static final NamingStrategy INSTANCE = new ImprovedNamingStrategy();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the unqualified class name, mixed case converted to
|
|
||||||
* underscores
|
|
||||||
*/
|
|
||||||
public String classToTableName(String className) {
|
|
||||||
return addUnderscores( StringHelper.unqualify(className) );
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return the full property path with underscore separators, mixed
|
|
||||||
* case converted to underscores
|
|
||||||
*/
|
|
||||||
public String propertyToColumnName(String propertyName) {
|
|
||||||
return addUnderscores( StringHelper.unqualify(propertyName) );
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Convert mixed case to underscores
|
|
||||||
*/
|
|
||||||
public String tableName(String tableName) {
|
|
||||||
return addUnderscores(tableName);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Convert mixed case to underscores
|
|
||||||
*/
|
|
||||||
public String columnName(String columnName) {
|
|
||||||
return addUnderscores(columnName);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static String addUnderscores(String name) {
|
|
||||||
StringBuilder buf = new StringBuilder( name.replace('.', '_') );
|
|
||||||
for (int i=1; i<buf.length()-1; i++) {
|
|
||||||
if (
|
|
||||||
Character.isLowerCase( buf.charAt(i-1) ) &&
|
|
||||||
Character.isUpperCase( buf.charAt(i) ) &&
|
|
||||||
Character.isLowerCase( buf.charAt(i+1) )
|
|
||||||
) {
|
|
||||||
buf.insert(i++, '_');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return buf.toString().toLowerCase(Locale.ROOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String collectionTableName(
|
|
||||||
String ownerEntity, String ownerEntityTable, String associatedEntity, String associatedEntityTable,
|
|
||||||
String propertyName
|
|
||||||
) {
|
|
||||||
return tableName( ownerEntityTable + '_' + propertyToColumnName(propertyName) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the argument
|
|
||||||
*/
|
|
||||||
public String joinKeyColumnName(String joinedColumn, String joinedTable) {
|
|
||||||
return columnName( joinedColumn );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the property name or propertyTableName
|
|
||||||
*/
|
|
||||||
public String foreignKeyColumnName(
|
|
||||||
String propertyName,
|
|
||||||
String propertyEntityName,
|
|
||||||
String propertyTableName,
|
|
||||||
String referencedColumnName
|
|
||||||
) {
|
|
||||||
String header = propertyName != null ? StringHelper.unqualify( propertyName ) : propertyTableName;
|
|
||||||
if (header == null) {
|
|
||||||
throw new AssertionFailure("NamingStrategy not properly filled");
|
|
||||||
}
|
|
||||||
return columnName( header ); //+ "_" + referencedColumnName not used for backward compatibility
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the column name or the unqualified property name
|
|
||||||
*/
|
|
||||||
public String logicalColumnName(String columnName, String propertyName) {
|
|
||||||
return StringHelper.isNotEmpty( columnName ) ? columnName : StringHelper.unqualify( propertyName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns either the table name if explicit or
|
|
||||||
* if there is an associated table, the concatenation of owner entity table and associated table
|
|
||||||
* otherwise the concatenation of owner entity table and the unqualified property name
|
|
||||||
*/
|
|
||||||
public String logicalCollectionTableName(String tableName,
|
|
||||||
String ownerEntityTable, String associatedEntityTable, String propertyName
|
|
||||||
) {
|
|
||||||
if ( tableName != null ) {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
String entityTableName = associatedEntityTable != null
|
|
||||||
? associatedEntityTable
|
|
||||||
: StringHelper.unqualify(propertyName);
|
|
||||||
return ownerEntityTable + "_" + entityTableName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Return the column name if explicit or the concatenation of the property name and the referenced column
|
|
||||||
*/
|
|
||||||
public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) {
|
|
||||||
return StringHelper.isNotEmpty( columnName ) ?
|
|
||||||
columnName :
|
|
||||||
StringHelper.unqualify( propertyName ) + "_" + referencedColumn;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,109 +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;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A set of rules for determining the physical column
|
|
||||||
* and table names given the information in the mapping
|
|
||||||
* document. May be used to implement project-scoped
|
|
||||||
* naming standards for database objects.
|
|
||||||
*
|
|
||||||
* @see DefaultNamingStrategy
|
|
||||||
* @see ImprovedNamingStrategy
|
|
||||||
* @author Gavin King
|
|
||||||
* @author Emmanuel Bernard
|
|
||||||
*
|
|
||||||
* @deprecated {@link org.hibernate.boot.model.naming.ImplicitNamingStrategy}
|
|
||||||
* and {@link org.hibernate.boot.model.naming.PhysicalNamingStrategy} should
|
|
||||||
* be used instead.
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public interface NamingStrategy {
|
|
||||||
/**
|
|
||||||
* Return a table name for an entity class
|
|
||||||
* @param className the fully-qualified class name
|
|
||||||
* @return a table name
|
|
||||||
*/
|
|
||||||
String classToTableName(String className);
|
|
||||||
/**
|
|
||||||
* Return a column name for a property path expression
|
|
||||||
* @param propertyName a property path
|
|
||||||
* @return a column name
|
|
||||||
*/
|
|
||||||
String propertyToColumnName(String propertyName);
|
|
||||||
/**
|
|
||||||
* Alter the table name given in the mapping document
|
|
||||||
* @param tableName a table name
|
|
||||||
* @return a table name
|
|
||||||
*/
|
|
||||||
String tableName(String tableName);
|
|
||||||
/**
|
|
||||||
* Alter the column name given in the mapping document
|
|
||||||
* @param columnName a column name
|
|
||||||
* @return a column name
|
|
||||||
*/
|
|
||||||
String columnName(String columnName);
|
|
||||||
/**
|
|
||||||
* Return a collection table name ie an association having a join table
|
|
||||||
*
|
|
||||||
* @param ownerEntity
|
|
||||||
* @param ownerEntityTable owner side table name
|
|
||||||
* @param associatedEntity
|
|
||||||
* @param associatedEntityTable reverse side table name if any
|
|
||||||
* @param propertyName collection role
|
|
||||||
*/
|
|
||||||
String collectionTableName(
|
|
||||||
String ownerEntity, String ownerEntityTable, String associatedEntity, String associatedEntityTable,
|
|
||||||
String propertyName
|
|
||||||
);
|
|
||||||
/**
|
|
||||||
* Return the join key column name ie a FK column used in a JOINED strategy or for a secondary table
|
|
||||||
*
|
|
||||||
* @param joinedColumn joined column name (logical one) used to join with
|
|
||||||
* @param joinedTable joined table name (ie the referenced table) used to join with
|
|
||||||
*/
|
|
||||||
String joinKeyColumnName(String joinedColumn, String joinedTable);
|
|
||||||
/**
|
|
||||||
* Return the foreign key column name for the given parameters
|
|
||||||
* @param propertyName the property name involved
|
|
||||||
* @param propertyEntityName
|
|
||||||
* @param propertyTableName the property table name involved (logical one)
|
|
||||||
* @param referencedColumnName the referenced column name involved (logical one)
|
|
||||||
*/
|
|
||||||
String foreignKeyColumnName(
|
|
||||||
String propertyName, String propertyEntityName, String propertyTableName, String referencedColumnName
|
|
||||||
);
|
|
||||||
/**
|
|
||||||
* 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 insensitively unique for a given table
|
|
||||||
*
|
|
||||||
* @param columnName given column name if any
|
|
||||||
* @param propertyName property name of this column
|
|
||||||
*/
|
|
||||||
String logicalColumnName(String columnName, String propertyName);
|
|
||||||
/**
|
|
||||||
* Returns the logical collection table name used to refer to a table in the mapping metadata
|
|
||||||
*
|
|
||||||
* @param tableName the metadata explicit name
|
|
||||||
* @param ownerEntityTable owner table entity table name (logical one)
|
|
||||||
* @param associatedEntityTable reverse side table name if any (logical one)
|
|
||||||
* @param propertyName collection role
|
|
||||||
*/
|
|
||||||
String logicalCollectionTableName(String tableName, String ownerEntityTable, String associatedEntityTable, String propertyName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the logical foreign key column name used to refer to this column in the mapping metadata
|
|
||||||
*
|
|
||||||
* @param columnName given column name in the metadata if any
|
|
||||||
* @param propertyName property name
|
|
||||||
* @param referencedColumn referenced column name (logical one) in the join
|
|
||||||
*/
|
|
||||||
String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn);
|
|
||||||
}
|
|
|
@ -1,90 +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 java.io.Serializable;
|
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Naming strategy implementing the EJB3 standards
|
|
||||||
*
|
|
||||||
* @author Emmanuel Bernard
|
|
||||||
*
|
|
||||||
* @deprecated {@link NamingStrategy} itself has been deprecated
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class PersistenceStandardNamingStrategy implements NamingStrategy, Serializable {
|
|
||||||
public static final NamingStrategy INSTANCE = new PersistenceStandardNamingStrategy();
|
|
||||||
|
|
||||||
public String classToTableName(String className) {
|
|
||||||
return StringHelper.unqualify( className );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String propertyToColumnName(String propertyName) {
|
|
||||||
return StringHelper.unqualify( propertyName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String tableName(String tableName) {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String columnName(String columnName) {
|
|
||||||
return columnName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String collectionTableName(
|
|
||||||
String ownerEntity, String ownerEntityTable, String associatedEntity, String associatedEntityTable,
|
|
||||||
String propertyName
|
|
||||||
) {
|
|
||||||
String entityTableName = associatedEntityTable != null
|
|
||||||
? associatedEntityTable
|
|
||||||
: StringHelper.unqualify(propertyName);
|
|
||||||
return tableName( ownerEntityTable + "_" + entityTableName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String joinKeyColumnName(String joinedColumn, String joinedTable) {
|
|
||||||
return columnName( joinedColumn );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String foreignKeyColumnName(
|
|
||||||
String propertyName,
|
|
||||||
String propertyEntityName,
|
|
||||||
String propertyTableName,
|
|
||||||
String referencedColumnName) {
|
|
||||||
String header = propertyName != null ? StringHelper.unqualify( propertyName ) : propertyTableName;
|
|
||||||
if ( header == null ) {
|
|
||||||
throw new AssertionFailure( "NamingStrategy not properly filled" );
|
|
||||||
}
|
|
||||||
return columnName( header + "_" + referencedColumnName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String logicalColumnName(String columnName, String propertyName) {
|
|
||||||
return StringHelper.isNotEmpty( columnName ) ? columnName : StringHelper.unqualify( propertyName );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String logicalCollectionTableName(
|
|
||||||
String tableName,
|
|
||||||
String ownerEntityTable, String associatedEntityTable, String propertyName
|
|
||||||
) {
|
|
||||||
if ( tableName != null ) {
|
|
||||||
return tableName;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
String entityTableName = associatedEntityTable != null
|
|
||||||
? associatedEntityTable
|
|
||||||
: StringHelper.unqualify(propertyName);
|
|
||||||
return ownerEntityTable + "_" + entityTableName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) {
|
|
||||||
return StringHelper.isNotEmpty( columnName ) ?
|
|
||||||
columnName :
|
|
||||||
StringHelper.unqualify( propertyName ) + "_" + referencedColumn;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hibernate builds its {@linkplain org.hibernate.mapping build-time model}
|
|
||||||
* incrementally, often delaying operations until other pieces of information
|
|
||||||
* are available. A second pass represents one of these delayed operations.
|
|
||||||
*
|
|
||||||
* @author Emmanuel Bernard
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link org.hibernate.boot.spi.SecondPass} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public interface SecondPass extends org.hibernate.boot.spi.SecondPass {
|
|
||||||
}
|
|
|
@ -352,14 +352,6 @@ public abstract class AbstractHANADialect extends Dialect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link HANAServerConfiguration#fromDialectResolutionInfo(DialectResolutionInfo)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
protected static DatabaseVersion createVersion(DialectResolutionInfo info) {
|
|
||||||
return HANAServerConfiguration.fromDialectResolutionInfo( info ).getFullVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String castPattern(CastType from, CastType to) {
|
public String castPattern(CastType from, CastType to) {
|
||||||
if ( to == CastType.BOOLEAN ) {
|
if ( to == CastType.BOOLEAN ) {
|
||||||
|
|
|
@ -172,14 +172,6 @@ public abstract class AbstractTransactSQLDialect extends Dialect {
|
||||||
return replaceLtrimRtrim( specification, isWhitespace );
|
return replaceLtrimRtrim( specification, isWhitespace );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #replaceLtrimRtrim(TrimSpec, boolean)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true )
|
|
||||||
public static String replaceLtrimRtrim(TrimSpec specification, char character) {
|
|
||||||
return replaceLtrimRtrim( specification, character == ' ' );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String replaceLtrimRtrim(TrimSpec specification, boolean isWhitespace) {
|
public static String replaceLtrimRtrim(TrimSpec specification, boolean isWhitespace) {
|
||||||
switch ( specification ) {
|
switch ( specification ) {
|
||||||
case LEADING:
|
case LEADING:
|
||||||
|
|
|
@ -1537,22 +1537,6 @@ public abstract class Dialect implements ConversionContext, TypeContributor, Fun
|
||||||
return "cast(?1 as ?2)";
|
return "cast(?1 as ?2)";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtain a pattern for the SQL equivalent to a
|
|
||||||
* {@code trim()} function call. The resulting
|
|
||||||
* pattern must contain a ?1 placeholder for the
|
|
||||||
* argument of type {@link String}.
|
|
||||||
*
|
|
||||||
* @param specification {@code leading} or {@code trailing}
|
|
||||||
* @param character the character to trim
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #trimPattern(TrimSpec, boolean)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true )
|
|
||||||
public String trimPattern(TrimSpec specification, char character) {
|
|
||||||
return trimPattern( specification, character == ' ' );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain a pattern for the SQL equivalent to a
|
* Obtain a pattern for the SQL equivalent to a
|
||||||
* {@code trim()} function call. The resulting
|
* {@code trim()} function call. The resulting
|
||||||
|
@ -2041,28 +2025,6 @@ public abstract class Dialect implements ConversionContext, TypeContributor, Fun
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If this dialect supports specifying lock timeouts, are those timeouts
|
|
||||||
* rendered into the {@code SQL} string as parameters? The implication
|
|
||||||
* is that Hibernate will need to bind the timeout value as a parameter
|
|
||||||
* in the {@link PreparedStatement}. If true, the parameter position
|
|
||||||
* is always handled as the last parameter; if the dialect specifies the
|
|
||||||
* lock timeout elsewhere in the {@code SQL} statement then the timeout
|
|
||||||
* value should be directly rendered into the statement and this method
|
|
||||||
* should return false.
|
|
||||||
*
|
|
||||||
* @return True if the lock timeout is rendered into the {@code SQL}
|
|
||||||
* string as a parameter; false otherwise.
|
|
||||||
*
|
|
||||||
* @deprecated This is never called, and since at least Hibernate 5 has
|
|
||||||
* just returned {@code false} in every dialect. It will be
|
|
||||||
* removed.
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public boolean isLockTimeoutParameterized() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link LockingStrategy} which is able to acquire a database-level
|
* A {@link LockingStrategy} which is able to acquire a database-level
|
||||||
* lock with the specified {@linkplain LockMode level}.
|
* lock with the specified {@linkplain LockMode level}.
|
||||||
|
@ -3724,22 +3686,6 @@ public abstract class Dialect implements ConversionContext, TypeContributor, Fun
|
||||||
return !useInputStreamToInsertBlob();
|
return !useInputStreamToInsertBlob();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Does this dialect support parameters within the {@code SELECT} clause
|
|
||||||
* of {@code INSERT ... SELECT ...} statements?
|
|
||||||
*
|
|
||||||
* @return True if this is supported; false otherwise.
|
|
||||||
*
|
|
||||||
* @since 3.2
|
|
||||||
*
|
|
||||||
* @deprecated This seems to be supported on all platforms, and we don't
|
|
||||||
* call this except in test suite
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public boolean supportsParametersInInsertSelect() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this dialect support references to result variables
|
* Does this dialect support references to result variables
|
||||||
* (i.e, select items) by column positions (1-origin) as defined
|
* (i.e, select items) by column positions (1-origin) as defined
|
||||||
|
@ -4636,16 +4582,6 @@ public abstract class Dialect implements ConversionContext, TypeContributor, Fun
|
||||||
return supportsNoWait();
|
return supportsNoWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated This is no longer called
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public String inlineLiteral(String literal) {
|
|
||||||
final StringBuilder sb = new StringBuilder( literal.length() + 2 );
|
|
||||||
appendLiteral( new StringBuilderSqlAppender( sb ), literal );
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a literal string to the given {@link SqlAppender}.
|
* Append a literal string to the given {@link SqlAppender}.
|
||||||
*
|
*
|
||||||
|
|
|
@ -285,11 +285,6 @@ public class DialectDelegateWrapper extends Dialect {
|
||||||
return wrapped.castPattern( from, to );
|
return wrapped.castPattern( from, to );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String trimPattern(TrimSpec specification, char character) {
|
|
||||||
return wrapped.trimPattern( specification, character );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String trimPattern(TrimSpec specification, boolean isWhitespace) {
|
public String trimPattern(TrimSpec specification, boolean isWhitespace) {
|
||||||
return wrapped.trimPattern( specification, isWhitespace );
|
return wrapped.trimPattern( specification, isWhitespace );
|
||||||
|
@ -405,12 +400,6 @@ public class DialectDelegateWrapper extends Dialect {
|
||||||
return wrapped.supportsLockTimeouts();
|
return wrapped.supportsLockTimeouts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public boolean isLockTimeoutParameterized() {
|
|
||||||
return wrapped.isLockTimeoutParameterized();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
|
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
|
||||||
return wrapped.getLockingStrategy( lockable, lockMode );
|
return wrapped.getLockingStrategy( lockable, lockMode );
|
||||||
|
@ -1046,12 +1035,6 @@ public class DialectDelegateWrapper extends Dialect {
|
||||||
return wrapped.useConnectionToCreateLob();
|
return wrapped.useConnectionToCreateLob();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public boolean supportsParametersInInsertSelect() {
|
|
||||||
return wrapped.supportsParametersInInsertSelect();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsOrdinalSelectItemReference() {
|
public boolean supportsOrdinalSelectItemReference() {
|
||||||
return wrapped.supportsOrdinalSelectItemReference();
|
return wrapped.supportsOrdinalSelectItemReference();
|
||||||
|
@ -1367,12 +1350,6 @@ public class DialectDelegateWrapper extends Dialect {
|
||||||
return wrapped.supportsWait();
|
return wrapped.supportsWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public String inlineLiteral(String literal) {
|
|
||||||
return wrapped.inlineLiteral( literal );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendLiteral(SqlAppender appender, String literal) {
|
public void appendLiteral(SqlAppender appender, String literal) {
|
||||||
wrapped.appendLiteral( appender, literal );
|
wrapped.appendLiteral( appender, literal );
|
||||||
|
|
|
@ -1,25 +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.dialect;
|
|
||||||
|
|
||||||
import org.hibernate.type.descriptor.jdbc.EnumJdbcType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an {@code enum} type on MySQL.
|
|
||||||
* <p>
|
|
||||||
* Hibernate will automatically use this for enums mapped
|
|
||||||
* as {@link jakarta.persistence.EnumType#STRING}.
|
|
||||||
*
|
|
||||||
* @see org.hibernate.type.SqlTypes#ENUM
|
|
||||||
* @see MySQLDialect#getEnumTypeDeclaration(String, String[])
|
|
||||||
* @deprecated Use {@link EnumJdbcType} instead
|
|
||||||
*
|
|
||||||
* @author Gavin King
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public class MySQLEnumJdbcType extends EnumJdbcType {
|
|
||||||
}
|
|
|
@ -52,14 +52,6 @@ public class MySQLSqlAstTranslator<T extends JdbcOperation> extends AbstractSqlA
|
||||||
super( sessionFactory, statement );
|
super( sessionFactory, statement );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #getSqlType(CastTarget, SessionFactoryImplementor)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public static String getSqlType(CastTarget castTarget, Dialect dialect) {
|
|
||||||
return getSqlType( castTarget, castTarget.getSqlType(), dialect );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getSqlType(CastTarget castTarget, SessionFactoryImplementor factory) {
|
public static String getSqlType(CastTarget castTarget, SessionFactoryImplementor factory) {
|
||||||
final String sqlType = getCastTypeName( castTarget, factory.getTypeConfiguration() );
|
final String sqlType = getCastTypeName( castTarget, factory.getTypeConfiguration() );
|
||||||
return getSqlType( castTarget, sqlType, factory.getJdbcServices().getDialect() );
|
return getSqlType( castTarget, sqlType, factory.getJdbcServices().getDialect() );
|
||||||
|
|
|
@ -547,46 +547,6 @@ public class PostgreSQLDialect extends Dialect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used, and should be removed
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
protected void extractField(
|
|
||||||
StringBuilder pattern,
|
|
||||||
TemporalUnit unit,
|
|
||||||
TemporalType fromTimestamp,
|
|
||||||
TemporalType toTimestamp,
|
|
||||||
TemporalUnit toUnit) {
|
|
||||||
pattern.append( "extract(" );
|
|
||||||
pattern.append( translateDurationField( unit ) );
|
|
||||||
pattern.append( " from " );
|
|
||||||
if ( toTimestamp == TemporalType.DATE && fromTimestamp == TemporalType.DATE ) {
|
|
||||||
// special case subtraction of two
|
|
||||||
// dates results in an integer not
|
|
||||||
// an Interval
|
|
||||||
pattern.append( "age(?3,?2)" );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
switch ( unit ) {
|
|
||||||
case YEAR:
|
|
||||||
case MONTH:
|
|
||||||
case QUARTER:
|
|
||||||
pattern.append( "age(?3,?2)" );
|
|
||||||
break;
|
|
||||||
case DAY:
|
|
||||||
case HOUR:
|
|
||||||
case MINUTE:
|
|
||||||
case SECOND:
|
|
||||||
case EPOCH:
|
|
||||||
pattern.append( "?3-?2" );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new SemanticException( unit + " is not a legal field" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pattern.append( ")" ).append( unit.conversionFactor( toUnit, this ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeZoneSupport getTimeZoneSupport() {
|
public TimeZoneSupport getTimeZoneSupport() {
|
||||||
return TimeZoneSupport.NORMALIZE;
|
return TimeZoneSupport.NORMALIZE;
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.hibernate.query.sqm.TemporalUnit;
|
||||||
import org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor;
|
import org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor;
|
||||||
import org.hibernate.query.sqm.function.AbstractSqmSelfRenderingFunctionDescriptor;
|
import org.hibernate.query.sqm.function.AbstractSqmSelfRenderingFunctionDescriptor;
|
||||||
import org.hibernate.query.sqm.function.FunctionRenderer;
|
import org.hibernate.query.sqm.function.FunctionRenderer;
|
||||||
import org.hibernate.query.sqm.function.FunctionRenderingSupport;
|
|
||||||
import org.hibernate.query.sqm.function.MultipatternSqmFunctionDescriptor;
|
import org.hibernate.query.sqm.function.MultipatternSqmFunctionDescriptor;
|
||||||
import org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression;
|
import org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression;
|
||||||
import org.hibernate.query.sqm.function.SelfRenderingSqmFunction;
|
import org.hibernate.query.sqm.function.SelfRenderingSqmFunction;
|
||||||
|
@ -174,33 +173,6 @@ public class FormatFunction extends AbstractSqmFunctionDescriptor implements Fun
|
||||||
private final boolean supportsPatternLiterals;
|
private final boolean supportsPatternLiterals;
|
||||||
private final TypeConfiguration typeConfiguration;
|
private final TypeConfiguration typeConfiguration;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #FormatSqmFunction(SqmFunctionDescriptor, FunctionRenderer, List, ReturnableType, ArgumentsValidator, FunctionReturnTypeResolver, boolean, QueryEngine)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public FormatSqmFunction(
|
|
||||||
SqmFunctionDescriptor descriptor,
|
|
||||||
FunctionRenderingSupport renderingSupport,
|
|
||||||
List<? extends SqmTypedNode<?>> arguments,
|
|
||||||
ReturnableType<T> impliedResultType,
|
|
||||||
ArgumentsValidator argumentsValidator,
|
|
||||||
FunctionReturnTypeResolver returnTypeResolver,
|
|
||||||
boolean supportsPatternLiterals,
|
|
||||||
QueryEngine queryEngine) {
|
|
||||||
super(
|
|
||||||
descriptor,
|
|
||||||
renderingSupport,
|
|
||||||
arguments,
|
|
||||||
impliedResultType,
|
|
||||||
argumentsValidator,
|
|
||||||
returnTypeResolver,
|
|
||||||
queryEngine.getCriteriaBuilder(),
|
|
||||||
"format"
|
|
||||||
);
|
|
||||||
this.supportsPatternLiterals = supportsPatternLiterals;
|
|
||||||
this.typeConfiguration = queryEngine.getTypeConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
public FormatSqmFunction(
|
public FormatSqmFunction(
|
||||||
SqmFunctionDescriptor descriptor,
|
SqmFunctionDescriptor descriptor,
|
||||||
FunctionRenderer renderer,
|
FunctionRenderer renderer,
|
||||||
|
|
|
@ -1,34 +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.dialect.identity;
|
|
||||||
|
|
||||||
import org.hibernate.Remove;
|
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.generator.EventType;
|
|
||||||
import org.hibernate.id.PostInsertIdentityPersister;
|
|
||||||
import org.hibernate.id.insert.GetGeneratedKeysDelegate;
|
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Andrea Boriero
|
|
||||||
*
|
|
||||||
* @deprecated no longer used, use {@link GetGeneratedKeysDelegate} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true) @Remove
|
|
||||||
public class Oracle12cGetGeneratedKeysDelegate extends GetGeneratedKeysDelegate {
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #Oracle12cGetGeneratedKeysDelegate(EntityPersister)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
public Oracle12cGetGeneratedKeysDelegate(PostInsertIdentityPersister persister, Dialect dialect) {
|
|
||||||
this( persister );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Oracle12cGetGeneratedKeysDelegate(EntityPersister persister) {
|
|
||||||
super( persister, false, EventType.INSERT );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -48,14 +48,6 @@ public class Oracle12LimitHandler extends AbstractLimitHandler {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #processSql(String, boolean, boolean, LockOptions)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
protected String processSql(String sql, boolean hasFirstRow, LockOptions lockOptions) {
|
|
||||||
return processSql( sql, hasFirstRow, true, lockOptions );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String processSql(String sql, boolean hasFirstRow, boolean hasMaxRows, LockOptions lockOptions) {
|
protected String processSql(String sql, boolean hasFirstRow, boolean hasMaxRows, LockOptions lockOptions) {
|
||||||
if ( lockOptions != null ) {
|
if ( lockOptions != null ) {
|
||||||
final LockMode lockMode = lockOptions.getLockMode();
|
final LockMode lockMode = lockOptions.getLockMode();
|
||||||
|
@ -75,14 +67,6 @@ public class Oracle12LimitHandler extends AbstractLimitHandler {
|
||||||
return processSqlOffsetFetch( sql, hasFirstRow, hasMaxRows );
|
return processSqlOffsetFetch( sql, hasFirstRow, hasMaxRows );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #processSqlOffsetFetch(String, boolean, boolean)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
protected String processSqlOffsetFetch(String sql, boolean hasFirstRow) {
|
|
||||||
return processSqlOffsetFetch( sql, hasFirstRow, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String processSqlOffsetFetch(String sql, boolean hasFirstRow, boolean hasMaxRows) {
|
protected String processSqlOffsetFetch(String sql, boolean hasFirstRow, boolean hasMaxRows) {
|
||||||
|
|
||||||
final int forUpdateLastIndex = getForUpdateIndex( sql );
|
final int forUpdateLastIndex = getForUpdateIndex( sql );
|
||||||
|
@ -109,14 +93,6 @@ public class Oracle12LimitHandler extends AbstractLimitHandler {
|
||||||
return insertAtEnd(offsetFetchString, sql);
|
return insertAtEnd(offsetFetchString, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #processSql(String, int, boolean, boolean)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
protected String processSql(String sql, int forUpdateIndex, boolean hasFirstRow) {
|
|
||||||
return processSql( sql, forUpdateIndex, hasFirstRow, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String processSql(String sql, int forUpdateIndex, boolean hasFirstRow, boolean hasMaxRows) {
|
protected String processSql(String sql, int forUpdateIndex, boolean hasFirstRow, boolean hasMaxRows) {
|
||||||
bindLimitParametersInReverseOrder = true;
|
bindLimitParametersInReverseOrder = true;
|
||||||
useMaxForLimit = true;
|
useMaxForLimit = true;
|
||||||
|
|
|
@ -19,11 +19,6 @@ import org.hibernate.dialect.Dialect;
|
||||||
* @see <a href="https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CREATE-SEQUENCE.html">Oracle Database Documentation</a>
|
* @see <a href="https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CREATE-SEQUENCE.html">Oracle Database Documentation</a>
|
||||||
*/
|
*/
|
||||||
public final class OracleSequenceSupport extends NextvalSequenceSupport {
|
public final class OracleSequenceSupport extends NextvalSequenceSupport {
|
||||||
/**
|
|
||||||
* @deprecated Construct instance based on version instead.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public static final SequenceSupport INSTANCE = new OracleSequenceSupport( true, false );
|
|
||||||
|
|
||||||
public static SequenceSupport getInstance(final Dialect dialect) {
|
public static SequenceSupport getInstance(final Dialect dialect) {
|
||||||
return new OracleSequenceSupport(dialect.getVersion());
|
return new OracleSequenceSupport(dialect.getVersion());
|
||||||
|
|
|
@ -221,7 +221,8 @@ public class TemporaryTable implements Exportable, Contributable {
|
||||||
.getEntityBinding( pluralAttribute.findContainingEntityMapping().getEntityName() );
|
.getEntityBinding( pluralAttribute.findContainingEntityMapping().getEntityName() );
|
||||||
final Property property = findPropertyByName( declaringClass, attributeName );
|
final Property property = findPropertyByName( declaringClass, attributeName );
|
||||||
assert property != null;
|
assert property != null;
|
||||||
final Iterator<Selectable> columnIterator = ( (Collection) property.getValue() ).getKey().getSelectables().iterator();
|
final Collection collection = (Collection) property.getValue();
|
||||||
|
final Iterator<Selectable> columnIterator = collection.getKey().getSelectables().iterator();
|
||||||
fkTarget.forEachSelectable(
|
fkTarget.forEachSelectable(
|
||||||
(columnIndex, selection) -> {
|
(columnIndex, selection) -> {
|
||||||
final Selectable selectable = columnIterator.next();
|
final Selectable selectable = columnIterator.next();
|
||||||
|
@ -401,7 +402,7 @@ public class TemporaryTable implements Exportable, Contributable {
|
||||||
final PersistentClass declaringClass = runtimeModelCreationContext.getBootModel()
|
final PersistentClass declaringClass = runtimeModelCreationContext.getBootModel()
|
||||||
.getEntityBinding( attribute.findContainingEntityMapping().getEntityName() );
|
.getEntityBinding( attribute.findContainingEntityMapping().getEntityName() );
|
||||||
final SimpleValue value = (SimpleValue) declaringClass.getProperty( attribute.getAttributeName() ).getValue();
|
final SimpleValue value = (SimpleValue) declaringClass.getProperty( attribute.getAttributeName() ).getValue();
|
||||||
final Iterator<Selectable> columnIterator = value.getConstraintColumnIterator();
|
final Iterator<Selectable> columnIterator = value.getVirtualSelectables().iterator();
|
||||||
attribute.forEachSelectable(
|
attribute.forEachSelectable(
|
||||||
(columnIndex, selection) -> {
|
(columnIndex, selection) -> {
|
||||||
final Selectable selectable = columnIterator.next();
|
final Selectable selectable = columnIterator.next();
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.hibernate.dialect.Dialect;
|
||||||
/**
|
/**
|
||||||
* @deprecated use {@link org.hibernate.dialect.unique.AlterTableUniqueDelegate}
|
* @deprecated use {@link org.hibernate.dialect.unique.AlterTableUniqueDelegate}
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="6.2")
|
@Deprecated(since="6.2", forRemoval = true)
|
||||||
public class DefaultUniqueDelegate extends AlterTableUniqueDelegate {
|
public class DefaultUniqueDelegate extends AlterTableUniqueDelegate {
|
||||||
public DefaultUniqueDelegate(Dialect dialect) {
|
public DefaultUniqueDelegate(Dialect dialect) {
|
||||||
super(dialect);
|
super(dialect);
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.engine;
|
package org.hibernate.engine;
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
|
||||||
import org.hibernate.annotations.OptimisticLockType;
|
import org.hibernate.annotations.OptimisticLockType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,51 +64,4 @@ public enum OptimisticLockStyle {
|
||||||
public boolean isNone() {
|
public boolean isNone() {
|
||||||
return this == NONE;
|
return this == NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated these integer codes have not been used for a long time
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true)
|
|
||||||
public int getOldCode() {
|
|
||||||
switch (this) {
|
|
||||||
case NONE:
|
|
||||||
return -1;
|
|
||||||
case VERSION:
|
|
||||||
return 0;
|
|
||||||
case DIRTY:
|
|
||||||
return 1;
|
|
||||||
case ALL:
|
|
||||||
return 2;
|
|
||||||
default:
|
|
||||||
throw new AssertionFailure("Unknown OptimisticLockStyle");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Given an old code (one of the int constants from Cascade),
|
|
||||||
* interpret it as one of the new enums.
|
|
||||||
*
|
|
||||||
* @param oldCode The old int constant code
|
|
||||||
*
|
|
||||||
* @return The interpreted enum value
|
|
||||||
*
|
|
||||||
* @throws IllegalArgumentException If the code did not match any legacy constant.
|
|
||||||
*
|
|
||||||
* @deprecated these integer codes have not been used for a long time
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true)
|
|
||||||
public static OptimisticLockStyle interpretOldCode(int oldCode) {
|
|
||||||
switch ( oldCode ) {
|
|
||||||
case -1:
|
|
||||||
return NONE;
|
|
||||||
case 0:
|
|
||||||
return VERSION;
|
|
||||||
case 1:
|
|
||||||
return DIRTY;
|
|
||||||
case 2:
|
|
||||||
return ALL;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException( "Illegal legacy optimistic lock style code : " + oldCode );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.hibernate.boot.registry.StandardServiceInitiator;
|
import org.hibernate.boot.registry.StandardServiceInitiator;
|
||||||
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.cfg.JdbcSettings;
|
import org.hibernate.cfg.JdbcSettings;
|
||||||
import org.hibernate.dialect.DatabaseVersion;
|
import org.hibernate.dialect.DatabaseVersion;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
@ -89,7 +90,8 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated This setting was never a documented feature of Hibernate,
|
* @deprecated This setting was never a documented feature of Hibernate,
|
||||||
* is not supported, and will be removed.
|
* is not supported, and will be removed. Use
|
||||||
|
* {@value org.hibernate.cfg.JdbcSettings#ALLOW_METADATA_ON_BOOT}.
|
||||||
*/
|
*/
|
||||||
@Deprecated(since="6", forRemoval = true)
|
@Deprecated(since="6", forRemoval = true)
|
||||||
private static final String USE_JDBC_METADATA_DEFAULTS = "hibernate.temp.use_jdbc_metadata_defaults";
|
private static final String USE_JDBC_METADATA_DEFAULTS = "hibernate.temp.use_jdbc_metadata_defaults";
|
||||||
|
@ -713,11 +715,6 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
|
||||||
public int getFetchSize() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doesConnectionProviderDisableAutoCommit() {
|
public boolean doesConnectionProviderDisableAutoCommit() {
|
||||||
return connectionProviderDisablesAutoCommit;
|
return connectionProviderDisablesAutoCommit;
|
||||||
|
|
|
@ -6,15 +6,9 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.engine.profile;
|
package org.hibernate.engine.profile;
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
|
||||||
import org.hibernate.annotations.FetchMode;
|
|
||||||
import org.hibernate.engine.FetchStyle;
|
import org.hibernate.engine.FetchStyle;
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import static org.hibernate.engine.FetchTiming.IMMEDIATE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Models an individual fetch override within a {@link FetchProfile}.
|
* Models an individual fetch override within a {@link FetchProfile}.
|
||||||
*
|
*
|
||||||
|
@ -25,21 +19,6 @@ public class Fetch {
|
||||||
private final FetchStyle method;
|
private final FetchStyle method;
|
||||||
private final FetchTiming timing;
|
private final FetchTiming timing;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a {@link Fetch}.
|
|
||||||
*
|
|
||||||
* @param association The association to be fetched
|
|
||||||
* @param style How to fetch it
|
|
||||||
*
|
|
||||||
* @deprecated use {@link #Fetch(Association,FetchStyle,FetchTiming)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public Fetch(Association association, Style style) {
|
|
||||||
this.association = association;
|
|
||||||
this.method = style.toFetchStyle();
|
|
||||||
this.timing = IMMEDIATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a {@link Fetch}.
|
* Constructs a {@link Fetch}.
|
||||||
*
|
*
|
||||||
|
@ -59,16 +38,6 @@ public class Fetch {
|
||||||
return association;
|
return association;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The fetch style applied to the association.
|
|
||||||
*
|
|
||||||
* @deprecated use {@link #getMethod()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public Style getStyle() {
|
|
||||||
return Style.fromFetchStyle( method );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The fetch method to be applied to the association.
|
* The fetch method to be applied to the association.
|
||||||
*/
|
*/
|
||||||
|
@ -83,87 +52,6 @@ public class Fetch {
|
||||||
return timing;
|
return timing;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The type or style of fetch.
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link FetchStyle}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public enum Style {
|
|
||||||
/**
|
|
||||||
* Fetch via a join
|
|
||||||
*/
|
|
||||||
JOIN,
|
|
||||||
/**
|
|
||||||
* Fetch via a subsequent select
|
|
||||||
*/
|
|
||||||
SELECT,
|
|
||||||
/**
|
|
||||||
* Fetch via a subsequent subselect
|
|
||||||
*/
|
|
||||||
SUBSELECT;
|
|
||||||
|
|
||||||
public FetchStyle toFetchStyle() {
|
|
||||||
switch (this) {
|
|
||||||
case SELECT:
|
|
||||||
return FetchStyle.SELECT;
|
|
||||||
case SUBSELECT:
|
|
||||||
return FetchStyle.SUBSELECT;
|
|
||||||
case JOIN:
|
|
||||||
return FetchStyle.JOIN;
|
|
||||||
default:
|
|
||||||
throw new AssertionFailure("Unknown Fetch.Style");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Style fromFetchStyle(FetchStyle fetchStyle) {
|
|
||||||
switch (fetchStyle) {
|
|
||||||
case SELECT:
|
|
||||||
return SELECT;
|
|
||||||
case SUBSELECT:
|
|
||||||
return SUBSELECT;
|
|
||||||
case JOIN:
|
|
||||||
return JOIN;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unhandled FetchStyle");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return name().toLowerCase(Locale.ROOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a style given an externalized string representation
|
|
||||||
*
|
|
||||||
* @param name The externalized representation
|
|
||||||
*
|
|
||||||
* @return The style; {@link #JOIN} is returned if not recognized
|
|
||||||
*/
|
|
||||||
public static Style parse(String name) {
|
|
||||||
for ( Style style: values() ) {
|
|
||||||
if ( style.name().equalsIgnoreCase( name ) ) {
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return JOIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Style forMethod(FetchMode fetchMode) {
|
|
||||||
switch ( fetchMode ) {
|
|
||||||
case JOIN:
|
|
||||||
return JOIN;
|
|
||||||
case SELECT:
|
|
||||||
return SELECT;
|
|
||||||
case SUBSELECT:
|
|
||||||
return SUBSELECT;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException( "Unknown FetchMode" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Fetch[" + method + "{" + association.getRole() + "}]";
|
return "Fetch[" + method + "{" + association.getRole() + "}]";
|
||||||
|
|
|
@ -61,32 +61,6 @@ public class FetchProfile {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a {@linkplain Fetch fetch override} to the profile.
|
|
||||||
*
|
|
||||||
* @param association The association to be fetched
|
|
||||||
* @param fetchStyleName The name of the fetch style to apply
|
|
||||||
*
|
|
||||||
* @deprecated No longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public void addFetch(Association association, String fetchStyleName) {
|
|
||||||
addFetch( new Fetch( association, Fetch.Style.parse( fetchStyleName ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a {@linkplain Fetch fetch override} to the profile.
|
|
||||||
*
|
|
||||||
* @param association The association to be fetched
|
|
||||||
* @param style The style to apply
|
|
||||||
*
|
|
||||||
* @deprecated No longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public void addFetch(Association association, Fetch.Style style) {
|
|
||||||
addFetch( new Fetch( association, style ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a {@linkplain Fetch fetch override} to the profile.
|
* Add a {@linkplain Fetch fetch override} to the profile.
|
||||||
*
|
*
|
||||||
|
@ -159,28 +133,6 @@ public class FetchProfile {
|
||||||
return fetches.get( role );
|
return fetches.get( role );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Does this fetch profile contain any collection join fetches?
|
|
||||||
*
|
|
||||||
* @deprecated No longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public boolean isContainsJoinFetchedCollection() {
|
|
||||||
return containsJoinFetchedCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Does this fetch profile contained any bag join fetches?
|
|
||||||
*
|
|
||||||
* @deprecated No longer used
|
|
||||||
*
|
|
||||||
* @return Value for property 'containsJoinFetchedBag'.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public boolean isContainsJoinFetchedBag() {
|
|
||||||
return containsJoinFetchedBag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "FetchProfile[" + name + "]";
|
return "FetchProfile[" + name + "]";
|
||||||
|
|
|
@ -1,41 +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.query.spi;
|
|
||||||
|
|
||||||
import org.hibernate.graph.GraphSemantic;
|
|
||||||
import org.hibernate.graph.spi.AppliedGraph;
|
|
||||||
import org.hibernate.graph.spi.RootGraphImplementor;
|
|
||||||
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Encapsulates a JPA EntityGraph provided through a JPQL query hint. Converts the fetches into a list of AST
|
|
||||||
* FromElements. The logic is kept here as much as possible in order to make it easy to remove this in the future,
|
|
||||||
* once our AST is improved and this "hack" is no longer needed.
|
|
||||||
*
|
|
||||||
* @author Brett Meyer
|
|
||||||
*
|
|
||||||
* @deprecated use {@link AppliedGraph} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.0")
|
|
||||||
public class EntityGraphQueryHint implements AppliedGraph {
|
|
||||||
private final AppliedGraph delegate;
|
|
||||||
|
|
||||||
public EntityGraphQueryHint(AppliedGraph delegate) {
|
|
||||||
this.delegate = delegate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable GraphSemantic getSemantic() {
|
|
||||||
return delegate.getSemantic();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable RootGraphImplementor<?> getGraph() {
|
|
||||||
return delegate.getGraph();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,245 +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.query.spi;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.hibernate.engine.query.ParameterRecognitionException;
|
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
|
||||||
import org.hibernate.query.sql.spi.ParameterRecognizer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements a parameter parser recognizer specifically for the purpose
|
|
||||||
* of journaling parameter locations.
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
* @deprecated No longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.4", forRemoval = true)
|
|
||||||
public class ParamLocationRecognizer implements ParameterRecognizer {
|
|
||||||
|
|
||||||
private Map<String, NamedParameterDescriptor<?>> namedParameterDescriptors;
|
|
||||||
private Map<Integer, OrdinalParameterDescriptor<?>> ordinalParameterDescriptors;
|
|
||||||
|
|
||||||
private Map<String, InFlightNamedParameterState> inFlightNamedStateMap;
|
|
||||||
private Map<Integer, InFlightOrdinalParameterState> inFlightOrdinalStateMap;
|
|
||||||
private Map<Integer, InFlightJpaOrdinalParameterState> inFlightJpaOrdinalStateMap;
|
|
||||||
|
|
||||||
private final int jdbcStyleOrdinalCountBase;
|
|
||||||
private int jdbcStyleOrdinalCount;
|
|
||||||
|
|
||||||
public ParamLocationRecognizer(int jdbcStyleOrdinalCountBase) {
|
|
||||||
this.jdbcStyleOrdinalCountBase = jdbcStyleOrdinalCountBase;
|
|
||||||
this.jdbcStyleOrdinalCount = jdbcStyleOrdinalCountBase;
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Convenience method for creating a param location recognizer and
|
|
||||||
// * initiating the parse.
|
|
||||||
// */
|
|
||||||
// public static ParamLocationRecognizer parseLocations(
|
|
||||||
// String query,
|
|
||||||
// SessionFactoryImplementor sessionFactory) {
|
|
||||||
// final ParamLocationRecognizer recognizer = new ParamLocationRecognizer( 1 );
|
|
||||||
// ParameterParser.parse( query, recognizer );
|
|
||||||
// return recognizer;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void validate() {
|
|
||||||
if ( inFlightNamedStateMap != null && ( inFlightOrdinalStateMap != null || inFlightJpaOrdinalStateMap != null ) ) {
|
|
||||||
throw mixedParamStrategy();
|
|
||||||
}
|
|
||||||
|
|
||||||
// we know `inFlightNamedStateMap` is null, so no need to check it again
|
|
||||||
|
|
||||||
if ( inFlightOrdinalStateMap != null && inFlightJpaOrdinalStateMap != null ) {
|
|
||||||
throw mixedParamStrategy();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( inFlightNamedStateMap != null ) {
|
|
||||||
final Map<String, NamedParameterDescriptor<?>> tmp = new HashMap<>();
|
|
||||||
for ( InFlightNamedParameterState inFlightState : inFlightNamedStateMap.values() ) {
|
|
||||||
tmp.put( inFlightState.name, inFlightState.complete() );
|
|
||||||
}
|
|
||||||
namedParameterDescriptors = Collections.unmodifiableMap( tmp );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
namedParameterDescriptors = Collections.emptyMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( inFlightOrdinalStateMap == null && inFlightJpaOrdinalStateMap == null ) {
|
|
||||||
ordinalParameterDescriptors = Collections.emptyMap();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
final Map<Integer, OrdinalParameterDescriptor<?>> tmp = new HashMap<>();
|
|
||||||
if ( inFlightOrdinalStateMap != null ) {
|
|
||||||
for ( InFlightOrdinalParameterState state : inFlightOrdinalStateMap.values() ) {
|
|
||||||
tmp.put( state.identifier, state.complete() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for ( InFlightJpaOrdinalParameterState state : inFlightJpaOrdinalStateMap.values() ) {
|
|
||||||
tmp.put( state.identifier, state.complete() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ordinalParameterDescriptors = Collections.unmodifiableMap( tmp );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ParameterRecognitionException mixedParamStrategy() {
|
|
||||||
throw new ParameterRecognitionException( "Mixed parameter strategies - use just one of named, positional or JPA-ordinal strategy" );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, NamedParameterDescriptor<?>> getNamedParameterDescriptionMap() {
|
|
||||||
return namedParameterDescriptors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Integer, OrdinalParameterDescriptor<?>> getOrdinalParameterDescriptionMap() {
|
|
||||||
return ordinalParameterDescriptors;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// Recognition code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
|
|
||||||
// NOTE : we keep track of `inFlightOrdinalStateMap` versus `inFlightJpaOrdinalStateMap`
|
|
||||||
// in order to perform better validations of mixed parameter strategies
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ordinalParameter(int position) {
|
|
||||||
if ( inFlightOrdinalStateMap == null ) {
|
|
||||||
inFlightOrdinalStateMap = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
final int label = jdbcStyleOrdinalCount++;
|
|
||||||
inFlightOrdinalStateMap.put(
|
|
||||||
label,
|
|
||||||
new InFlightOrdinalParameterState( label, label - jdbcStyleOrdinalCountBase, position )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void namedParameter(String name, int position) {
|
|
||||||
getOrBuildNamedParameterDescription( name ).add( position );
|
|
||||||
}
|
|
||||||
|
|
||||||
private InFlightNamedParameterState getOrBuildNamedParameterDescription(String name) {
|
|
||||||
if ( inFlightNamedStateMap == null ) {
|
|
||||||
inFlightNamedStateMap = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
InFlightNamedParameterState descriptor = inFlightNamedStateMap.get( name );
|
|
||||||
if ( descriptor == null ) {
|
|
||||||
descriptor = new InFlightNamedParameterState( name );
|
|
||||||
inFlightNamedStateMap.put( name, descriptor );
|
|
||||||
}
|
|
||||||
return descriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void jpaPositionalParameter(int name, int position) {
|
|
||||||
getOrBuildJpaOrdinalParameterDescription( name ).add( position );
|
|
||||||
}
|
|
||||||
|
|
||||||
private InFlightJpaOrdinalParameterState getOrBuildJpaOrdinalParameterDescription(int name) {
|
|
||||||
if ( inFlightJpaOrdinalStateMap == null ) {
|
|
||||||
inFlightJpaOrdinalStateMap = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
InFlightJpaOrdinalParameterState descriptor = inFlightJpaOrdinalStateMap.get( name );
|
|
||||||
if ( descriptor == null ) {
|
|
||||||
descriptor = new InFlightJpaOrdinalParameterState( name );
|
|
||||||
inFlightJpaOrdinalStateMap.put( name, descriptor );
|
|
||||||
}
|
|
||||||
return descriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void other(char character) {
|
|
||||||
// don't care...
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal in-flight representation of a recognized named parameter
|
|
||||||
*/
|
|
||||||
public static class InFlightNamedParameterState {
|
|
||||||
private final String name;
|
|
||||||
private final List<Integer> sourcePositions = new ArrayList<>();
|
|
||||||
|
|
||||||
InFlightNamedParameterState(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void add(int position) {
|
|
||||||
sourcePositions.add( position );
|
|
||||||
}
|
|
||||||
|
|
||||||
private NamedParameterDescriptor<?> complete() {
|
|
||||||
return new NamedParameterDescriptor<>(
|
|
||||||
name,
|
|
||||||
null,
|
|
||||||
ArrayHelper.toIntArray( sourcePositions )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal in-flight representation of a recognized named parameter
|
|
||||||
*/
|
|
||||||
public static class InFlightOrdinalParameterState {
|
|
||||||
private final int identifier;
|
|
||||||
private final int valuePosition;
|
|
||||||
private final int sourcePosition;
|
|
||||||
|
|
||||||
InFlightOrdinalParameterState(int label, int valuePosition, int sourcePosition) {
|
|
||||||
this.identifier = label;
|
|
||||||
this.valuePosition = valuePosition;
|
|
||||||
this.sourcePosition = sourcePosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
private OrdinalParameterDescriptor<?> complete() {
|
|
||||||
return new OrdinalParameterDescriptor<>(
|
|
||||||
identifier,
|
|
||||||
valuePosition,
|
|
||||||
null,
|
|
||||||
new int[] { sourcePosition }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal in-flight representation of a recognized named parameter
|
|
||||||
*/
|
|
||||||
public static class InFlightJpaOrdinalParameterState {
|
|
||||||
private final int identifier;
|
|
||||||
private final List<Integer> sourcePositions = new ArrayList<>();
|
|
||||||
|
|
||||||
InFlightJpaOrdinalParameterState(int identifier) {
|
|
||||||
this.identifier = identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void add(int position) {
|
|
||||||
sourcePositions.add( position );
|
|
||||||
}
|
|
||||||
|
|
||||||
private OrdinalParameterDescriptor<?> complete() {
|
|
||||||
return new OrdinalParameterDescriptor<>(
|
|
||||||
identifier,
|
|
||||||
identifier - 1,
|
|
||||||
null,
|
|
||||||
ArrayHelper.toIntArray( sourcePositions )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -88,10 +88,6 @@ public enum ExecuteUpdateResultCheckStyle {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ExecuteUpdateResultCheckStyle determineDefault(@Nullable String customSql, boolean callable) {
|
|
||||||
return customSql != null && callable ? PARAM : COUNT;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static @Nullable Supplier<? extends Expectation> expectationConstructor(
|
public static @Nullable Supplier<? extends Expectation> expectationConstructor(
|
||||||
@Nullable ExecuteUpdateResultCheckStyle style) {
|
@Nullable ExecuteUpdateResultCheckStyle style) {
|
||||||
return style == null ? null : style.expectationConstructor();
|
return style == null ? null : style.expectationConstructor();
|
||||||
|
|
|
@ -310,11 +310,6 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.getFastSessionServices();
|
return delegate.getFastSessionServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
|
||||||
public DeserializationResolver<?> getDeserializationResolver() {
|
|
||||||
return delegate.getDeserializationResolver();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getIdentifierType(String className) throws MappingException {
|
public Type getIdentifierType(String className) throws MappingException {
|
||||||
return delegate.getIdentifierType( className );
|
return delegate.getIdentifierType( className );
|
||||||
|
|
|
@ -212,12 +212,6 @@ public interface SessionFactoryImplementor
|
||||||
T resolve();
|
T resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated this is never called
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true)
|
|
||||||
DeserializationResolver<?> getDeserializationResolver();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated no longer for internal use, use {@link #getMappingMetamodel()} or {@link #getJpaMetamodel()}
|
* @deprecated no longer for internal use, use {@link #getMappingMetamodel()} or {@link #getJpaMetamodel()}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -544,25 +544,6 @@ public interface SharedSessionContractImplementor
|
||||||
default void autoPreFlush(){
|
default void autoPreFlush(){
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Are we currently enforcing a {@linkplain GraphSemantic#FETCH fetch graph}?
|
|
||||||
*
|
|
||||||
* @deprecated this is not used anywhere
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
default boolean isEnforcingFetchGraph() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable or disable {@linkplain GraphSemantic#FETCH fetch graph} enforcement.
|
|
||||||
*
|
|
||||||
* @deprecated this is not used anywhere
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
default void setEnforcingFetchGraph(boolean enforcingFetchGraph) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if there is a Hibernate or JTA transaction in progress and,
|
* Check if there is a Hibernate or JTA transaction in progress and,
|
||||||
* if there is not, flush if necessary, making sure that the connection
|
* if there is not, flush if necessary, making sure that the connection
|
||||||
|
|
|
@ -140,16 +140,4 @@ public interface IdentifierGenerator extends BeforeExecutionGenerator, Exportabl
|
||||||
default EnumSet<EventType> getEventTypes() {
|
default EnumSet<EventType> getEventTypes() {
|
||||||
return INSERT_ONLY;
|
return INSERT_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if JDBC batch inserts are supported.
|
|
||||||
*
|
|
||||||
* @return JDBC batch inserts are supported.
|
|
||||||
*
|
|
||||||
* @deprecated this method is no longer called
|
|
||||||
*/
|
|
||||||
@Deprecated(since="6.2", forRemoval = true)
|
|
||||||
default boolean supportsJdbcBatchInserts() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,28 +12,19 @@ import java.math.BigInteger;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.ResultSetMetaData;
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
|
||||||
import org.hibernate.Internal;
|
import org.hibernate.Internal;
|
||||||
import org.hibernate.TransientObjectException;
|
import org.hibernate.TransientObjectException;
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.generator.values.internal.GeneratedValuesHelper;
|
|
||||||
import org.hibernate.internal.CoreLogging;
|
import org.hibernate.internal.CoreLogging;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
|
||||||
import org.hibernate.metamodel.mapping.SqlTypedMapping;
|
|
||||||
import org.hibernate.metamodel.model.domain.NavigableRole;
|
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.type.EntityType;
|
import org.hibernate.type.EntityType;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
import org.hibernate.type.descriptor.WrapperOptions;
|
|
||||||
|
|
||||||
import static org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved;
|
import static org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved;
|
||||||
import static org.hibernate.internal.util.StringHelper.unquote;
|
|
||||||
import static org.hibernate.spi.NavigablePath.IDENTIFIER_MAPPER_PROPERTY;
|
import static org.hibernate.spi.NavigablePath.IDENTIFIER_MAPPER_PROPERTY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,71 +53,6 @@ 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 database insertion.
|
|
||||||
*
|
|
||||||
* @deprecated Use a {@link org.hibernate.generator.OnExecutionGenerator}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.2")
|
|
||||||
public static final Serializable POST_INSERT_INDICATOR = new Serializable() {
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "POST_INSERT_INDICATOR";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the generated identifier when using identity columns
|
|
||||||
*
|
|
||||||
* @param path The {@link NavigableRole#getFullPath()}
|
|
||||||
* @param resultSet The result set from which to extract the generated identity
|
|
||||||
* @param wrapperOptions The session
|
|
||||||
* @return The generated identity value
|
|
||||||
* @throws SQLException Can be thrown while accessing the result set
|
|
||||||
* @throws HibernateException Indicates a problem reading back a generated identity value.
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link GeneratedValuesHelper#getGeneratedValues} instead
|
|
||||||
*/
|
|
||||||
@Deprecated( since = "6.5", forRemoval = true )
|
|
||||||
public static Object getGeneratedIdentity(
|
|
||||||
String path,
|
|
||||||
ResultSet resultSet,
|
|
||||||
PostInsertIdentityPersister persister,
|
|
||||||
WrapperOptions wrapperOptions) throws SQLException {
|
|
||||||
if ( !resultSet.next() ) {
|
|
||||||
throw new HibernateException( "The database returned no natively generated identity value : " + path );
|
|
||||||
}
|
|
||||||
|
|
||||||
JdbcMapping identifierType = ( (SqlTypedMapping) persister.getIdentifierMapping() ).getJdbcMapping();
|
|
||||||
Object id = identifierType.getJdbcValueExtractor()
|
|
||||||
.extract( resultSet, columnIndex( resultSet, persister ), wrapperOptions );
|
|
||||||
LOG.debugf( "Natively generated identity (%s) : %s", path, id );
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int columnIndex(ResultSet resultSet, PostInsertIdentityPersister persister) {
|
|
||||||
try {
|
|
||||||
ResultSetMetaData metaData = resultSet.getMetaData();
|
|
||||||
String keyColumnName = persister.getRootTableKeyColumnNames()[0];
|
|
||||||
Dialect dialect = persister.getFactory().getJdbcServices().getDialect();
|
|
||||||
for ( int i = 1 ; i<=metaData.getColumnCount(); i++ ) {
|
|
||||||
if ( equal( keyColumnName, metaData.getColumnName(i), dialect ) ) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (SQLException e) {
|
|
||||||
LOG.debugf( "Could not determine column index from JDBC metadata", e );
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean equal(String keyColumnName, String alias, Dialect dialect) {
|
|
||||||
return alias.equalsIgnoreCase( keyColumnName )
|
|
||||||
|| alias.equalsIgnoreCase( unquote( keyColumnName, dialect ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IntegralDataTypeHolder getIntegralDataTypeHolder(Class<?> integralType) {
|
public static IntegralDataTypeHolder getIntegralDataTypeHolder(Class<?> integralType) {
|
||||||
if ( integralType == Long.class
|
if ( integralType == Long.class
|
||||||
|| integralType == Integer.class
|
|| integralType == Integer.class
|
||||||
|
@ -412,7 +338,7 @@ public final class IdentifierGeneratorHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (int) ( value ^ ( value >>> 32 ) );
|
return Long.hashCode(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,32 +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.id;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An optional contract for {@link org.hibernate.type.Type} or
|
|
||||||
* {@link org.hibernate.usertype.UserType} implementations to handle generated
|
|
||||||
* id values any way they see fit as opposed to being limited to the discrete set of
|
|
||||||
* numeric types handled by {@link IdentifierGeneratorHelper}
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*
|
|
||||||
* @deprecated this interface is unnecessary and no longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true)
|
|
||||||
public interface ResultSetIdentifierConsumer {
|
|
||||||
/**
|
|
||||||
* Given a result set, consume/extract the necessary values and construct an
|
|
||||||
* appropriate identifier value.
|
|
||||||
*
|
|
||||||
* @param resultSet The result set containing the value(s) to be used in building
|
|
||||||
* the identifier value.
|
|
||||||
* @return The identifier value.
|
|
||||||
*/
|
|
||||||
Object consumeIdentifier(ResultSet resultSet);
|
|
||||||
}
|
|
|
@ -16,7 +16,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.generator.EventType;
|
import org.hibernate.generator.EventType;
|
||||||
import org.hibernate.generator.values.AbstractGeneratedValuesMutationDelegate;
|
import org.hibernate.generator.values.AbstractGeneratedValuesMutationDelegate;
|
||||||
import org.hibernate.generator.values.GeneratedValues;
|
import org.hibernate.generator.values.GeneratedValues;
|
||||||
import org.hibernate.id.PostInsertIdentityPersister;
|
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.pretty.MessageHelper;
|
import org.hibernate.pretty.MessageHelper;
|
||||||
|
|
||||||
|
@ -30,13 +29,6 @@ import org.hibernate.pretty.MessageHelper;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractReturningDelegate extends AbstractGeneratedValuesMutationDelegate
|
public abstract class AbstractReturningDelegate extends AbstractGeneratedValuesMutationDelegate
|
||||||
implements InsertGeneratedIdentifierDelegate {
|
implements InsertGeneratedIdentifierDelegate {
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #AbstractReturningDelegate(EntityPersister, EventType, boolean, boolean)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
public AbstractReturningDelegate(PostInsertIdentityPersister persister) {
|
|
||||||
super( persister, EventType.INSERT );
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbstractReturningDelegate(
|
public AbstractReturningDelegate(
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
|
@ -92,18 +84,6 @@ public abstract class AbstractReturningDelegate extends AbstractGeneratedValuesM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
protected Object executeAndExtract(
|
|
||||||
String sql,
|
|
||||||
PreparedStatement preparedStatement,
|
|
||||||
SharedSessionContractImplementor session) {
|
|
||||||
final GeneratedValues generatedValues = executeAndExtractReturning( sql, preparedStatement, session );
|
|
||||||
return generatedValues.getGeneratedValue( persister.getIdentifierMapping() );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract GeneratedValues executeAndExtractReturning(
|
protected abstract GeneratedValues executeAndExtractReturning(
|
||||||
String sql,
|
String sql,
|
||||||
PreparedStatement preparedStatement,
|
PreparedStatement preparedStatement,
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.generator.EventType;
|
import org.hibernate.generator.EventType;
|
||||||
import org.hibernate.generator.values.AbstractGeneratedValuesMutationDelegate;
|
import org.hibernate.generator.values.AbstractGeneratedValuesMutationDelegate;
|
||||||
import org.hibernate.generator.values.GeneratedValues;
|
import org.hibernate.generator.values.GeneratedValues;
|
||||||
import org.hibernate.id.PostInsertIdentityPersister;
|
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.pretty.MessageHelper;
|
import org.hibernate.pretty.MessageHelper;
|
||||||
|
|
||||||
|
@ -35,13 +34,6 @@ import static org.hibernate.generator.values.internal.GeneratedValuesHelper.getG
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractSelectingDelegate extends AbstractGeneratedValuesMutationDelegate
|
public abstract class AbstractSelectingDelegate extends AbstractGeneratedValuesMutationDelegate
|
||||||
implements InsertGeneratedIdentifierDelegate {
|
implements InsertGeneratedIdentifierDelegate {
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #AbstractSelectingDelegate(EntityPersister, EventType, boolean, boolean)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
protected AbstractSelectingDelegate(PostInsertIdentityPersister persister) {
|
|
||||||
super( persister, EventType.INSERT );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected AbstractSelectingDelegate(
|
protected AbstractSelectingDelegate(
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
|
@ -62,16 +54,6 @@ public abstract class AbstractSelectingDelegate extends AbstractGeneratedValuesM
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No substitute.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
protected Object extractGeneratedValues(ResultSet resultSet, SharedSessionContractImplementor session)
|
|
||||||
throws SQLException {
|
|
||||||
final GeneratedValues generatedValues = extractReturningValues( resultSet, session );
|
|
||||||
return generatedValues.getGeneratedValue( persister.getIdentifierMapping() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the generated key value from the given result set after execution of {@link #getSelectSQL()}.
|
* Extract the generated key value from the given result set after execution of {@link #getSelectSQL()}.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,10 +6,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.id.insert;
|
package org.hibernate.id.insert;
|
||||||
|
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.generator.EventType;
|
import org.hibernate.generator.EventType;
|
||||||
import org.hibernate.id.PostInsertIdentityPersister;
|
|
||||||
import org.hibernate.internal.CoreLogging;
|
import org.hibernate.internal.CoreLogging;
|
||||||
import org.hibernate.jdbc.Expectation;
|
import org.hibernate.jdbc.Expectation;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
@ -23,14 +21,6 @@ import org.hibernate.sql.model.ast.builder.TableMutationBuilder;
|
||||||
public class BasicSelectingDelegate extends AbstractSelectingDelegate {
|
public class BasicSelectingDelegate extends AbstractSelectingDelegate {
|
||||||
final private EntityPersister persister;
|
final private EntityPersister persister;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #BasicSelectingDelegate(EntityPersister)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
public BasicSelectingDelegate(PostInsertIdentityPersister persister, Dialect dialect) {
|
|
||||||
this( persister );
|
|
||||||
}
|
|
||||||
|
|
||||||
public BasicSelectingDelegate(EntityPersister persister) {
|
public BasicSelectingDelegate(EntityPersister persister) {
|
||||||
super( persister, EventType.INSERT, false, false );
|
super( persister, EventType.INSERT, false, false );
|
||||||
this.persister = persister;
|
this.persister = persister;
|
||||||
|
|
|
@ -13,7 +13,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.engine.jdbc.mutation.JdbcValueBindings;
|
import org.hibernate.engine.jdbc.mutation.JdbcValueBindings;
|
||||||
import org.hibernate.engine.jdbc.mutation.group.PreparedStatementDetails;
|
import org.hibernate.engine.jdbc.mutation.group.PreparedStatementDetails;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||||
|
@ -24,7 +23,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.generator.EventType;
|
import org.hibernate.generator.EventType;
|
||||||
import org.hibernate.generator.values.GeneratedValueBasicResultBuilder;
|
import org.hibernate.generator.values.GeneratedValueBasicResultBuilder;
|
||||||
import org.hibernate.generator.values.GeneratedValues;
|
import org.hibernate.generator.values.GeneratedValues;
|
||||||
import org.hibernate.id.PostInsertIdentityPersister;
|
|
||||||
import org.hibernate.jdbc.Expectation;
|
import org.hibernate.jdbc.Expectation;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.sql.model.ast.builder.TableInsertBuilderStandard;
|
import org.hibernate.sql.model.ast.builder.TableInsertBuilderStandard;
|
||||||
|
@ -47,14 +45,6 @@ import static org.hibernate.internal.util.StringHelper.unquote;
|
||||||
public class GetGeneratedKeysDelegate extends AbstractReturningDelegate {
|
public class GetGeneratedKeysDelegate extends AbstractReturningDelegate {
|
||||||
private final String[] columnNames;
|
private final String[] columnNames;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #GetGeneratedKeysDelegate(EntityPersister, boolean, EventType)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
public GetGeneratedKeysDelegate(PostInsertIdentityPersister persister, Dialect dialect, boolean inferredKeys) {
|
|
||||||
this( persister, inferredKeys, EventType.INSERT );
|
|
||||||
}
|
|
||||||
|
|
||||||
public GetGeneratedKeysDelegate(
|
public GetGeneratedKeysDelegate(
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
boolean inferredKeys,
|
boolean inferredKeys,
|
||||||
|
|
|
@ -1,23 +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.id.insert;
|
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
|
||||||
import org.hibernate.sql.Insert;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nothing more than a distinguishing subclass of {@link 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(SessionFactoryImplementor sessionFactory) {
|
|
||||||
super( sessionFactory );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,16 +8,9 @@ package org.hibernate.id.insert;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
|
||||||
import org.hibernate.engine.jdbc.mutation.JdbcValueBindings;
|
|
||||||
import org.hibernate.engine.jdbc.mutation.group.PreparedStatementDetails;
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.generator.values.GeneratedValues;
|
import org.hibernate.generator.values.GeneratedValues;
|
||||||
import org.hibernate.generator.values.GeneratedValuesMutationDelegate;
|
import org.hibernate.generator.values.GeneratedValuesMutationDelegate;
|
||||||
import org.hibernate.jdbc.Expectation;
|
|
||||||
import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping;
|
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
|
||||||
import org.hibernate.sql.model.ast.builder.TableInsertBuilder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each implementation defines a strategy for retrieving a primary key
|
* Each implementation defines a strategy for retrieving a primary key
|
||||||
|
@ -42,43 +35,12 @@ import org.hibernate.sql.model.ast.builder.TableInsertBuilder;
|
||||||
*
|
*
|
||||||
* @deprecated Use {@link GeneratedValuesMutationDelegate} instead.
|
* @deprecated Use {@link GeneratedValuesMutationDelegate} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
@Deprecated(since = "6.5", forRemoval = true)
|
||||||
public interface InsertGeneratedIdentifierDelegate extends GeneratedValuesMutationDelegate {
|
public interface InsertGeneratedIdentifierDelegate extends GeneratedValuesMutationDelegate {
|
||||||
/**
|
|
||||||
* Create a {@link TableInsertBuilder} with any specific identity
|
|
||||||
* handling already built in.
|
|
||||||
*/
|
|
||||||
default TableInsertBuilder createTableInsertBuilder(
|
|
||||||
BasicEntityIdentifierMapping identifierMapping,
|
|
||||||
Expectation expectation,
|
|
||||||
SessionFactoryImplementor sessionFactory) {
|
|
||||||
return (TableInsertBuilder) createTableMutationBuilder( expectation, sessionFactory );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
PreparedStatement prepareStatement(String insertSql, SharedSessionContractImplementor session);
|
PreparedStatement prepareStatement(String insertSql, SharedSessionContractImplementor session);
|
||||||
|
|
||||||
/**
|
|
||||||
* Perform the {@code insert} and extract the database-generated
|
|
||||||
* primary key value.
|
|
||||||
*
|
|
||||||
* @see #createTableInsertBuilder
|
|
||||||
*/
|
|
||||||
default Object performInsert(
|
|
||||||
PreparedStatementDetails insertStatementDetails,
|
|
||||||
JdbcValueBindings valueBindings,
|
|
||||||
Object entity,
|
|
||||||
SharedSessionContractImplementor session) {
|
|
||||||
final EntityPersister entityPersister = session.getEntityPersister( null, entity );
|
|
||||||
final GeneratedValues generatedValues = performMutation(
|
|
||||||
insertStatementDetails,
|
|
||||||
valueBindings,
|
|
||||||
entity,
|
|
||||||
session
|
|
||||||
);
|
|
||||||
return generatedValues.getGeneratedValue( entityPersister.getIdentifierMapping() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append SQL specific to this delegate's mode of handling generated
|
* Append SQL specific to this delegate's mode of handling generated
|
||||||
* primary key values to the given {@code insert} statement.
|
* primary key values to the given {@code insert} statement.
|
||||||
|
@ -89,22 +51,6 @@ public interface InsertGeneratedIdentifierDelegate extends GeneratedValuesMutati
|
||||||
return insertSQL;
|
return insertSQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the given {@code insert} statement and return the generated
|
|
||||||
* key value.
|
|
||||||
*
|
|
||||||
* @param insertSQL The {@code insert} statement string
|
|
||||||
* @param session The session in which we are operating
|
|
||||||
* @param binder The parameter binder
|
|
||||||
*
|
|
||||||
* @return The generated identifier value
|
|
||||||
*/
|
|
||||||
default Object performInsert(String insertSQL, SharedSessionContractImplementor session, Binder binder) {
|
|
||||||
final EntityPersister entityPersister = session.getEntityPersister( null, binder.getEntity() );
|
|
||||||
final GeneratedValues generatedValues = performInsertReturning( insertSQL, session, binder );
|
|
||||||
return generatedValues.getGeneratedValue( entityPersister.getIdentifierMapping() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the given {@code insert} statement and return the generated
|
* Execute the given {@code insert} statement and return the generated
|
||||||
* key value.
|
* key value.
|
||||||
|
|
|
@ -12,7 +12,6 @@ import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
@ -22,7 +21,6 @@ import org.hibernate.generator.values.GeneratedValueBasicResultBuilder;
|
||||||
import org.hibernate.generator.values.GeneratedValues;
|
import org.hibernate.generator.values.GeneratedValues;
|
||||||
import org.hibernate.generator.values.GeneratedValuesMutationDelegate;
|
import org.hibernate.generator.values.GeneratedValuesMutationDelegate;
|
||||||
import org.hibernate.generator.values.internal.TableUpdateReturningBuilder;
|
import org.hibernate.generator.values.internal.TableUpdateReturningBuilder;
|
||||||
import org.hibernate.id.PostInsertIdentityPersister;
|
|
||||||
import org.hibernate.jdbc.Expectation;
|
import org.hibernate.jdbc.Expectation;
|
||||||
import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping;
|
import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
@ -47,14 +45,6 @@ public class InsertReturningDelegate extends AbstractReturningDelegate {
|
||||||
private final MutatingTableReference tableReference;
|
private final MutatingTableReference tableReference;
|
||||||
private final List<ColumnReference> generatedColumns;
|
private final List<ColumnReference> generatedColumns;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #InsertReturningDelegate(EntityPersister, EventType)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
public InsertReturningDelegate(PostInsertIdentityPersister persister, Dialect dialect) {
|
|
||||||
this( persister, EventType.INSERT );
|
|
||||||
}
|
|
||||||
|
|
||||||
public InsertReturningDelegate(EntityPersister persister, EventType timing) {
|
public InsertReturningDelegate(EntityPersister persister, EventType timing) {
|
||||||
super(
|
super(
|
||||||
persister,
|
persister,
|
||||||
|
|
|
@ -1,51 +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.id.insert;
|
|
||||||
import org.hibernate.MappingException;
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
|
||||||
import org.hibernate.sql.Insert;
|
|
||||||
import org.hibernate.generator.OnExecutionGenerator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specialized {@link IdentifierGeneratingInsert} which appends the database
|
|
||||||
* specific clause which signifies to return generated {@code IDENTITY} values
|
|
||||||
* to the end of the insert statement.
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*
|
|
||||||
* @deprecated This is not used anymore in any of the
|
|
||||||
* {@link org.hibernate.generator.values.GeneratedValuesMutationDelegate} implementations.
|
|
||||||
*/
|
|
||||||
@Deprecated( since = "6.5" )
|
|
||||||
public class InsertSelectIdentityInsert extends IdentifierGeneratingInsert {
|
|
||||||
protected String identityColumnName;
|
|
||||||
|
|
||||||
public InsertSelectIdentityInsert(SessionFactoryImplementor sessionFactory) {
|
|
||||||
super( sessionFactory );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Insert addIdentityColumn(String columnName) {
|
|
||||||
identityColumnName = columnName;
|
|
||||||
return super.addIdentityColumn( columnName );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Insert addGeneratedColumns(String[] columnNames, OnExecutionGenerator generator) {
|
|
||||||
if ( columnNames.length != 1 ) {
|
|
||||||
//TODO: Should this allow multiple columns? Would require changing
|
|
||||||
// IdentityColumnSupport.appendIdentitySelectToInsert()
|
|
||||||
throw new MappingException("wrong number of generated columns");
|
|
||||||
}
|
|
||||||
identityColumnName = columnNames[0];
|
|
||||||
return super.addGeneratedColumns( columnNames, generator );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toStatementString() {
|
|
||||||
return getDialect().getIdentityColumnSupport()
|
|
||||||
.appendIdentitySelectToInsert( identityColumnName, super.toStatementString() );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,33 +10,24 @@ import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.generator.EventType;
|
import org.hibernate.generator.EventType;
|
||||||
import org.hibernate.generator.values.GeneratedValues;
|
import org.hibernate.generator.values.GeneratedValues;
|
||||||
import org.hibernate.id.PostInsertIdentityPersister;
|
|
||||||
import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping;
|
import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
|
||||||
import static org.hibernate.generator.values.internal.GeneratedValuesHelper.getGeneratedValues;
|
import static org.hibernate.generator.values.internal.GeneratedValuesHelper.getGeneratedValues;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specialized {@link IdentifierGeneratingInsert} which appends the database
|
* Specialized {@link GetGeneratedKeysDelegate} which appends the database
|
||||||
* specific clause which signifies to return generated {@code IDENTITY} values
|
* specific clause which signifies to return generated {@code IDENTITY} values
|
||||||
* to the end of the insert statement.
|
* to the end of the insert statement.
|
||||||
*
|
*
|
||||||
* @author Christian Beikov
|
* @author Christian Beikov
|
||||||
*/
|
*/
|
||||||
public class SybaseJConnGetGeneratedKeysDelegate extends GetGeneratedKeysDelegate {
|
public class SybaseJConnGetGeneratedKeysDelegate extends GetGeneratedKeysDelegate {
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SybaseJConnGetGeneratedKeysDelegate(EntityPersister)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
public SybaseJConnGetGeneratedKeysDelegate(PostInsertIdentityPersister persister, Dialect dialect) {
|
|
||||||
this( persister );
|
|
||||||
}
|
|
||||||
|
|
||||||
public SybaseJConnGetGeneratedKeysDelegate(EntityPersister persister) {
|
public SybaseJConnGetGeneratedKeysDelegate(EntityPersister persister) {
|
||||||
super( persister, true, EventType.INSERT );
|
super( persister, true, EventType.INSERT );
|
||||||
|
|
|
@ -6,13 +6,9 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.id.insert;
|
package org.hibernate.id.insert;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.id.PostInsertIdentityPersister;
|
|
||||||
import org.hibernate.metamodel.mapping.EntityRowIdMapping;
|
|
||||||
import org.hibernate.metamodel.mapping.ModelPart;
|
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.sql.ast.tree.expression.ColumnReference;
|
import org.hibernate.sql.ast.tree.expression.ColumnReference;
|
||||||
import org.hibernate.sql.model.ast.MutatingTableReference;
|
import org.hibernate.sql.model.ast.MutatingTableReference;
|
||||||
|
@ -20,42 +16,12 @@ import org.hibernate.sql.model.ast.TableInsert;
|
||||||
import org.hibernate.sql.model.ast.builder.AbstractTableInsertBuilder;
|
import org.hibernate.sql.model.ast.builder.AbstractTableInsertBuilder;
|
||||||
import org.hibernate.sql.model.internal.TableInsertStandard;
|
import org.hibernate.sql.model.internal.TableInsertStandard;
|
||||||
|
|
||||||
import static org.hibernate.generator.values.internal.GeneratedValuesHelper.getActualGeneratedModelPart;
|
|
||||||
import static org.hibernate.internal.util.NullnessUtil.castNonNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class TableInsertReturningBuilder extends AbstractTableInsertBuilder {
|
public class TableInsertReturningBuilder extends AbstractTableInsertBuilder {
|
||||||
private final List<ColumnReference> generatedColumns;
|
private final List<ColumnReference> generatedColumns;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #TableInsertReturningBuilder(EntityPersister, MutatingTableReference, List, SessionFactoryImplementor)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
public TableInsertReturningBuilder(
|
|
||||||
PostInsertIdentityPersister mutationTarget,
|
|
||||||
SessionFactoryImplementor sessionFactory) {
|
|
||||||
this(
|
|
||||||
mutationTarget,
|
|
||||||
new MutatingTableReference( mutationTarget.getIdentifierTableMapping() ),
|
|
||||||
new ArrayList<>(),
|
|
||||||
sessionFactory
|
|
||||||
);
|
|
||||||
final List<? extends ModelPart> insertGeneratedProperties = getMutationTarget().getInsertGeneratedProperties();
|
|
||||||
for ( final ModelPart prop : insertGeneratedProperties ) {
|
|
||||||
generatedColumns.add( new ColumnReference(
|
|
||||||
getMutatingTable(),
|
|
||||||
getActualGeneratedModelPart( castNonNull( prop.asBasicValuedModelPart() ) )
|
|
||||||
) );
|
|
||||||
}
|
|
||||||
// special case for rowid when the dialect supports it
|
|
||||||
final EntityRowIdMapping rowIdMapping = getMutationTarget().getRowIdMapping();
|
|
||||||
if ( rowIdMapping != null && getJdbcServices().getDialect().supportsInsertReturningRowId() ) {
|
|
||||||
generatedColumns.add( new ColumnReference( getMutatingTable(), rowIdMapping ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableInsertReturningBuilder(
|
public TableInsertReturningBuilder(
|
||||||
EntityPersister mutationTarget,
|
EntityPersister mutationTarget,
|
||||||
MutatingTableReference tableReference,
|
MutatingTableReference tableReference,
|
||||||
|
|
|
@ -11,12 +11,10 @@ import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.generator.EventType;
|
import org.hibernate.generator.EventType;
|
||||||
import org.hibernate.generator.values.GeneratedValueBasicResultBuilder;
|
import org.hibernate.generator.values.GeneratedValueBasicResultBuilder;
|
||||||
import org.hibernate.id.PostInsertIdentityPersister;
|
|
||||||
import org.hibernate.jdbc.Expectation;
|
import org.hibernate.jdbc.Expectation;
|
||||||
import org.hibernate.metamodel.mapping.EntityRowIdMapping;
|
import org.hibernate.metamodel.mapping.EntityRowIdMapping;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
@ -37,14 +35,6 @@ public class UniqueKeySelectingDelegate extends AbstractSelectingDelegate {
|
||||||
|
|
||||||
private final String selectString;
|
private final String selectString;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #UniqueKeySelectingDelegate(EntityPersister, String[], EventType)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true, since = "6.5" )
|
|
||||||
public UniqueKeySelectingDelegate(PostInsertIdentityPersister persister, Dialect dialect, String[] uniqueKeyPropertyNames) {
|
|
||||||
this( persister, uniqueKeyPropertyNames, EventType.INSERT );
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniqueKeySelectingDelegate(
|
public UniqueKeySelectingDelegate(
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
String[] uniqueKeyPropertyNames,
|
String[] uniqueKeyPropertyNames,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
package org.hibernate.internal;
|
package org.hibernate.internal;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
import org.hibernate.boot.spi.MetadataImplementor;
|
import org.hibernate.boot.spi.MetadataImplementor;
|
||||||
import org.hibernate.engine.FetchStyle;
|
import org.hibernate.engine.FetchStyle;
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
|
@ -57,7 +58,7 @@ public class FetchProfileHelper {
|
||||||
( (FetchProfileAffectee) owner ).registerAffectingFetchProfile( profileName);
|
( (FetchProfileAffectee) owner ).registerAffectingFetchProfile( profileName);
|
||||||
|
|
||||||
final Association association = new Association( owner, mappingFetch.getAssociation() );
|
final Association association = new Association( owner, mappingFetch.getAssociation() );
|
||||||
final FetchStyle fetchStyle = Fetch.Style.forMethod( mappingFetch.getMethod() ).toFetchStyle();
|
final FetchStyle fetchStyle = fetchStyle( mappingFetch.getMethod() );
|
||||||
final FetchTiming fetchTiming = FetchTiming.forType( mappingFetch.getType() );
|
final FetchTiming fetchTiming = FetchTiming.forType( mappingFetch.getType() );
|
||||||
|
|
||||||
// validate the specified association fetch
|
// validate the specified association fetch
|
||||||
|
@ -73,6 +74,19 @@ public class FetchProfileHelper {
|
||||||
return fetchProfile;
|
return fetchProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static FetchStyle fetchStyle(FetchMode fetchMode) {
|
||||||
|
switch ( fetchMode ) {
|
||||||
|
case JOIN:
|
||||||
|
return FetchStyle.JOIN;
|
||||||
|
case SELECT:
|
||||||
|
return FetchStyle.SELECT;
|
||||||
|
case SUBSELECT:
|
||||||
|
return FetchStyle.SUBSELECT;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException( "Unknown FetchMode" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void validateFetchablePart(ModelPart fetchablePart, String profileName, Association association) {
|
private static void validateFetchablePart(ModelPart fetchablePart, String profileName, Association association) {
|
||||||
if ( fetchablePart == null ) {
|
if ( fetchablePart == null ) {
|
||||||
throw new HibernateException( String.format(
|
throw new HibernateException( String.format(
|
||||||
|
|
|
@ -59,11 +59,6 @@ public class JdbcSessionContextImpl implements JdbcSessionContext {
|
||||||
return settings().isGetGeneratedKeysEnabled();
|
return settings().isGetGeneratedKeysEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
|
||||||
public int getFetchSize() {
|
|
||||||
return settings().getJdbcFetchSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getFetchSizeOrNull() {
|
public Integer getFetchSizeOrNull() {
|
||||||
return settings().getJdbcFetchSize();
|
return settings().getJdbcFetchSize();
|
||||||
|
|
|
@ -217,14 +217,6 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
|
||||||
|
|
||||||
private final transient SchemaManager schemaManager;
|
private final transient SchemaManager schemaManager;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated This constructor will be removed
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true)
|
|
||||||
public SessionFactoryImpl(MetadataImplementor bootMetamodel, SessionFactoryOptions options) {
|
|
||||||
this( bootMetamodel, options, bootMetamodel.getTypeConfiguration().getMetadataBuildingContext().getBootstrapContext() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public SessionFactoryImpl(
|
public SessionFactoryImpl(
|
||||||
final MetadataImplementor bootMetamodel,
|
final MetadataImplementor bootMetamodel,
|
||||||
final SessionFactoryOptions options,
|
final SessionFactoryOptions options,
|
||||||
|
@ -776,12 +768,6 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
|
||||||
return sqlStringGenerationContext;
|
return sqlStringGenerationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated
|
|
||||||
public DeserializationResolver<?> getDeserializationResolver() {
|
|
||||||
return () -> (SessionFactoryImplementor)
|
|
||||||
SessionFactoryRegistry.INSTANCE.findSessionFactory( uuid, name );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override @SuppressWarnings({"rawtypes","unchecked"})
|
@Override @SuppressWarnings({"rawtypes","unchecked"})
|
||||||
public <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass) {
|
public <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass) {
|
||||||
return (List) getJpaMetamodel().findEntityGraphsByJavaType( entityClass );
|
return (List) getJpaMetamodel().findEntityGraphsByJavaType( entityClass );
|
||||||
|
|
|
@ -2493,9 +2493,6 @@ public class SessionImpl
|
||||||
final EffectiveEntityGraph effectiveEntityGraph = loadQueryInfluencers.getEffectiveEntityGraph();
|
final EffectiveEntityGraph effectiveEntityGraph = loadQueryInfluencers.getEffectiveEntityGraph();
|
||||||
effectiveEntityGraph.applyConfiguredGraph( properties );
|
effectiveEntityGraph.applyConfiguredGraph( properties );
|
||||||
loadQueryInfluencers.setReadOnly( getReadOnlyHint( properties ) );
|
loadQueryInfluencers.setReadOnly( getReadOnlyHint( properties ) );
|
||||||
if ( effectiveEntityGraph.getSemantic() == GraphSemantic.FETCH ) {
|
|
||||||
setEnforcingFetchGraph( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
return byId( entityClass )
|
return byId( entityClass )
|
||||||
.with( determineAppropriateLocalCacheMode( properties ) )
|
.with( determineAppropriateLocalCacheMode( properties ) )
|
||||||
|
@ -2558,7 +2555,6 @@ public class SessionImpl
|
||||||
finally {
|
finally {
|
||||||
loadQueryInfluencers.getEffectiveEntityGraph().clear();
|
loadQueryInfluencers.getEffectiveEntityGraph().clear();
|
||||||
loadQueryInfluencers.setReadOnly( null );
|
loadQueryInfluencers.setReadOnly( null );
|
||||||
setEnforcingFetchGraph( false );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3098,15 +3094,4 @@ public class SessionImpl
|
||||||
private Boolean getReadOnlyFromLoadQueryInfluencers() {
|
private Boolean getReadOnlyFromLoadQueryInfluencers() {
|
||||||
return loadQueryInfluencers != null ? loadQueryInfluencers.getReadOnly() : null;
|
return loadQueryInfluencers != null ? loadQueryInfluencers.getReadOnly() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated(forRemoval = true)
|
|
||||||
public boolean isEnforcingFetchGraph() {
|
|
||||||
return isEnforcingFetchGraph;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override @Deprecated(forRemoval = true)
|
|
||||||
public void setEnforcingFetchGraph(boolean isEnforcingFetchGraph) {
|
|
||||||
this.isEnforcingFetchGraph = isEnforcingFetchGraph;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,10 @@ import java.sql.CallableStatement;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.Internal;
|
import org.hibernate.Internal;
|
||||||
import org.hibernate.StaleStateException;
|
import org.hibernate.StaleStateException;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||||
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
|
||||||
import org.hibernate.internal.CoreLogging;
|
import org.hibernate.internal.CoreLogging;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
|
|
||||||
|
@ -109,52 +107,6 @@ public class Expectations {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Base Expectation impls ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link RowCount}, creating a custom subclass if necessary
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5")
|
|
||||||
public static class BasicExpectation extends Expectation.RowCount {
|
|
||||||
private final int expectedRowCount;
|
|
||||||
|
|
||||||
protected BasicExpectation(int expectedRowCount) {
|
|
||||||
this.expectedRowCount = expectedRowCount;
|
|
||||||
if ( expectedRowCount < 0 ) {
|
|
||||||
throw new IllegalArgumentException( "Expected row count must be greater than zero" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int expectedRowCount() {
|
|
||||||
return expectedRowCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link OutParameter}, creating a custom subclass if necessary
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5")
|
|
||||||
public static class BasicParamExpectation extends Expectation.OutParameter {
|
|
||||||
private final int parameterPosition;
|
|
||||||
private final int expectedRowCount;
|
|
||||||
|
|
||||||
protected BasicParamExpectation(int expectedRowCount, int parameterPosition) {
|
|
||||||
this.expectedRowCount = expectedRowCount;
|
|
||||||
this.parameterPosition = parameterPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int expectedRowCount() {
|
|
||||||
return expectedRowCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int parameterIndex() {
|
|
||||||
return parameterPosition;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Various Expectation instances ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// Various Expectation instances ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,29 +127,6 @@ public class Expectations {
|
||||||
@Deprecated(since = "6.5")
|
@Deprecated(since = "6.5")
|
||||||
public static final Expectation PARAM = new Expectation.OutParameter();
|
public static final Expectation PARAM = new Expectation.OutParameter();
|
||||||
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public static Expectation appropriateExpectation(ExecuteUpdateResultCheckStyle style) {
|
|
||||||
switch ( style ) {
|
|
||||||
case NONE:
|
|
||||||
return NONE;
|
|
||||||
case COUNT:
|
|
||||||
return BASIC;
|
|
||||||
case PARAM:
|
|
||||||
return PARAM;
|
|
||||||
default:
|
|
||||||
throw new AssertionFailure( "unknown result check style: " + style );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Expectations() {
|
private Expectations() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unused, for removal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public static final int USUAL_EXPECTED_COUNT = 1;
|
|
||||||
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public static final int USUAL_PARAM_POSITION = 1;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,94 +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.loader;
|
|
||||||
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
|
||||||
import org.hibernate.spi.DotIdentifierSequence;
|
|
||||||
import org.hibernate.spi.NavigablePath;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
|
|
||||||
|
|
||||||
private final PropertyPath parent;
|
|
||||||
private final String property;
|
|
||||||
private final String fullPath;
|
|
||||||
|
|
||||||
public PropertyPath(PropertyPath parent, String property) {
|
|
||||||
this.parent = parent;
|
|
||||||
this.property = property;
|
|
||||||
|
|
||||||
// the _identifierMapper is a "hidden" property on entities with composite keys.
|
|
||||||
// concatenating it will prevent the path from correctly being used to look up
|
|
||||||
// various things such as criteria paths and fetch profile association paths
|
|
||||||
if ( IDENTIFIER_MAPPER_PROPERTY.equals( property ) ) {
|
|
||||||
this.fullPath = parent != null ? parent.getFullPath() : "";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
final String prefix;
|
|
||||||
if ( parent != null ) {
|
|
||||||
final String resolvedParent = parent.getFullPath();
|
|
||||||
if ( StringHelper.isEmpty( resolvedParent ) ) {
|
|
||||||
prefix = "";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
prefix = resolvedParent + '.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
prefix = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fullPath = prefix + property;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public PropertyPath(String property) {
|
|
||||||
this( null, property );
|
|
||||||
}
|
|
||||||
|
|
||||||
public PropertyPath() {
|
|
||||||
this( "" );
|
|
||||||
}
|
|
||||||
|
|
||||||
public PropertyPath append(String property) {
|
|
||||||
return new PropertyPath( this, property );
|
|
||||||
}
|
|
||||||
|
|
||||||
public PropertyPath getParent() {
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLocalName() {
|
|
||||||
return property;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProperty() {
|
|
||||||
return property;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFullPath() {
|
|
||||||
return fullPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRoot() {
|
|
||||||
return parent == null && StringHelper.isEmpty( property );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return getClass().getSimpleName() + '[' + fullPath + ']';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -19,13 +19,4 @@ public interface AfterLoadAction {
|
||||||
* The action trigger - the {@code entity} is being loaded
|
* The action trigger - the {@code entity} is being loaded
|
||||||
*/
|
*/
|
||||||
void afterLoad(Object entity, EntityMappingType entityMappingType, SharedSessionContractImplementor session);
|
void afterLoad(Object entity, EntityMappingType entityMappingType, SharedSessionContractImplementor session);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use the {@linkplain #afterLoad(Object, EntityMappingType, SharedSessionContractImplementor) updated form}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
default void afterLoad(SharedSessionContractImplementor session, Object entity, org.hibernate.persister.entity.Loadable persister) {
|
|
||||||
afterLoad( entity, persister, session );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -592,14 +592,6 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe
|
||||||
return customInsertCallable;
|
return customInsertCallable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getInsertExpectation()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public ExecuteUpdateResultCheckStyle getCustomSQLInsertCheckStyle() {
|
|
||||||
return insertCheckStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
||||||
this.customSQLUpdate = customSQLUpdate;
|
this.customSQLUpdate = customSQLUpdate;
|
||||||
this.customUpdateCallable = callable;
|
this.customUpdateCallable = callable;
|
||||||
|
@ -615,14 +607,6 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe
|
||||||
return customUpdateCallable;
|
return customUpdateCallable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getUpdateExpectation()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public ExecuteUpdateResultCheckStyle getCustomSQLUpdateCheckStyle() {
|
|
||||||
return updateCheckStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
||||||
this.customSQLDelete = customSQLDelete;
|
this.customSQLDelete = customSQLDelete;
|
||||||
this.customDeleteCallable = callable;
|
this.customDeleteCallable = callable;
|
||||||
|
@ -638,14 +622,6 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe
|
||||||
return customDeleteCallable;
|
return customDeleteCallable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getDeleteExpectation()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public ExecuteUpdateResultCheckStyle getCustomSQLDeleteCheckStyle() {
|
|
||||||
return deleteCheckStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomSQLDeleteAll(
|
public void setCustomSQLDeleteAll(
|
||||||
String customSQLDeleteAll,
|
String customSQLDeleteAll,
|
||||||
boolean callable,
|
boolean callable,
|
||||||
|
|
|
@ -19,7 +19,6 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.hibernate.Internal;
|
import org.hibernate.Internal;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.Remove;
|
|
||||||
import org.hibernate.boot.model.relational.Database;
|
import org.hibernate.boot.model.relational.Database;
|
||||||
import org.hibernate.boot.model.relational.ExportableProducer;
|
import org.hibernate.boot.model.relational.ExportableProducer;
|
||||||
import org.hibernate.boot.model.relational.QualifiedName;
|
import org.hibernate.boot.model.relational.QualifiedName;
|
||||||
|
@ -166,11 +165,6 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
|
||||||
return properties.size();
|
return properties.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated @Remove
|
|
||||||
public Iterator<Property> getPropertyIterator() {
|
|
||||||
return properties.iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Property> getProperties() {
|
public List<Property> getProperties() {
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,20 +5,13 @@
|
||||||
* 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.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.boot.model.relational.Exportable;
|
import org.hibernate.boot.model.relational.Exportable;
|
||||||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mapping model object representing a constraint on a relational database table.
|
* A mapping model object representing a constraint on a relational database table.
|
||||||
|
@ -40,82 +33,6 @@ public abstract class Constraint implements Exportable, Serializable {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If a constraint is not explicitly named, this is called to generate
|
|
||||||
* a unique hash using the table and column names.
|
|
||||||
* Static so the name can be generated prior to creating the Constraint.
|
|
||||||
* They're cached, keyed by name, in multiple locations.
|
|
||||||
*
|
|
||||||
* @return String The generated name
|
|
||||||
*
|
|
||||||
* @deprecated This method does not respect the {@link org.hibernate.boot.model.naming.ImplicitNamingStrategy}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public static String generateName(String prefix, Table table, Column... columns) {
|
|
||||||
// Use a concatenation that guarantees uniqueness, even if identical names
|
|
||||||
// exist between all table and column identifiers.
|
|
||||||
final StringBuilder sb = new StringBuilder( "table`" + table.getName() + "`" );
|
|
||||||
// Ensure a consistent ordering of columns, regardless of the order
|
|
||||||
// they were bound.
|
|
||||||
// Clone the list, as sometimes a set of order-dependent Column
|
|
||||||
// bindings are given.
|
|
||||||
final Column[] alphabeticalColumns = columns.clone();
|
|
||||||
Arrays.sort( alphabeticalColumns, Comparator.comparing( Column::getName ) );
|
|
||||||
for ( Column column : alphabeticalColumns ) {
|
|
||||||
final String columnName = column == null ? "" : column.getName();
|
|
||||||
sb.append( "column`" ).append( columnName ).append( "`" );
|
|
||||||
}
|
|
||||||
return prefix + hashedName( sb.toString() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper method for {@link #generateName(String, Table, Column...)}.
|
|
||||||
*
|
|
||||||
* @return String The generated name
|
|
||||||
*
|
|
||||||
* @deprecated This method does not respect the {@link org.hibernate.boot.model.naming.ImplicitNamingStrategy}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public static String generateName(String prefix, Table table, List<Column> columns) {
|
|
||||||
// N.B. legacy APIs are involved: can't trust that the columns List is actually
|
|
||||||
// containing Column instances - the generic type isn't consistently enforced.
|
|
||||||
// So some elements might be Formula instances, but they don't need to be part
|
|
||||||
// of the name generation.
|
|
||||||
final Column[] defensive = columns.stream()
|
|
||||||
.filter( (Object thing) -> thing instanceof Column )
|
|
||||||
.toArray( Column[]::new );
|
|
||||||
return generateName( prefix, table, defensive);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash a constraint name using MD5. Convert the MD5 digest to base 35
|
|
||||||
* (full alphanumeric), guaranteeing
|
|
||||||
* that the length of the name will always be smaller than the 30
|
|
||||||
* character identifier restriction enforced by a few dialects.
|
|
||||||
*
|
|
||||||
* @param name The name to be hashed.
|
|
||||||
* @return String The hashed name.
|
|
||||||
*
|
|
||||||
* @deprecated Only used from deprecated methods
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public static String hashedName(String name) {
|
|
||||||
try {
|
|
||||||
final MessageDigest md = MessageDigest.getInstance( "MD5" );
|
|
||||||
md.reset();
|
|
||||||
md.update( name.getBytes() );
|
|
||||||
final byte[] digest = md.digest();
|
|
||||||
final BigInteger bigInt = new BigInteger( 1, digest );
|
|
||||||
// By converting to base 35 (full alphanumeric), we guarantee
|
|
||||||
// that the length of the name will always be smaller than the 30
|
|
||||||
// character identifier restriction enforced by a few dialects.
|
|
||||||
return bigInt.toString( 35 );
|
|
||||||
}
|
|
||||||
catch ( NoSuchAlgorithmException e ) {
|
|
||||||
throw new HibernateException( "Unable to generate a hashed Constraint name", e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addColumn(Column column) {
|
public void addColumn(Column column) {
|
||||||
if ( !columns.contains( column ) ) {
|
if ( !columns.contains( column ) ) {
|
||||||
columns.add( column );
|
columns.add( column );
|
||||||
|
@ -156,37 +73,11 @@ public abstract class Constraint implements Exportable, Serializable {
|
||||||
this.table = table;
|
this.table = table;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public boolean isGenerated(Dialect dialect) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Column> getColumns() {
|
public List<Column> getColumns() {
|
||||||
return columns;
|
return columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated this method is no longer called
|
|
||||||
*/
|
|
||||||
@Deprecated(since="6.2", forRemoval = true)
|
|
||||||
public abstract String sqlConstraintString(
|
|
||||||
SqlStringGenerationContext context,
|
|
||||||
String constraintName,
|
|
||||||
String defaultCatalog,
|
|
||||||
String defaultSchema);
|
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getSimpleName() + '(' + getTable().getName() + getColumns() + ") as " + name;
|
return getClass().getSimpleName() + '(' + getTable().getName() + getColumns() + ") as " + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return String The prefix to use in generated constraint names. Examples:
|
|
||||||
* "UK_", "FK_", and "PK_".
|
|
||||||
* @deprecated No longer used, should be removed
|
|
||||||
*/
|
|
||||||
@Deprecated(since="6.5", forRemoval = true)
|
|
||||||
public abstract String generatedConstraintNamePrefix();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,16 +112,6 @@ public class DenormalizedTable extends Table {
|
||||||
return includedTable.getPrimaryKey();
|
return includedTable.getPrimaryKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated(forRemoval = true)
|
|
||||||
public Iterator<UniqueKey> getUniqueKeyIterator() {
|
|
||||||
if ( !includedTable.isPhysicalTable() ) {
|
|
||||||
for ( UniqueKey uniqueKey : includedTable.getUniqueKeys().values() ) {
|
|
||||||
createUniqueKey( uniqueKey.getColumns() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return getUniqueKeys().values().iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Table getIncludedTable() {
|
public Table getIncludedTable() {
|
||||||
return includedTable;
|
return includedTable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,6 @@ import jakarta.persistence.FetchType;
|
||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import static jakarta.persistence.FetchType.EAGER;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mapping model object representing a {@link org.hibernate.annotations.FetchProfile}.
|
* A mapping model object representing a {@link org.hibernate.annotations.FetchProfile}.
|
||||||
|
@ -65,20 +62,6 @@ public class FetchProfile {
|
||||||
return fetches;
|
return fetches;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a fetch to this profile.
|
|
||||||
*
|
|
||||||
* @param entity The entity which contains the association to be fetched
|
|
||||||
* @param association The association to fetch
|
|
||||||
* @param style The style of fetch to apply
|
|
||||||
*
|
|
||||||
* @deprecated use {@link #addFetch(Fetch)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public void addFetch(String entity, String association, String style) {
|
|
||||||
addFetch( new Fetch( entity, association, style ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a fetch to this profile.
|
* Adds a fetch to this profile.
|
||||||
*/
|
*/
|
||||||
|
@ -122,26 +105,6 @@ public class FetchProfile {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link FetchProfile.Fetch#Fetch(String,String,FetchMode,FetchType)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public Fetch(String entity, String association, String style) {
|
|
||||||
this.entity = entity;
|
|
||||||
this.association = association;
|
|
||||||
this.method = fetchMode( style );
|
|
||||||
this.type = EAGER;
|
|
||||||
}
|
|
||||||
|
|
||||||
private FetchMode fetchMode(String style) {
|
|
||||||
for ( FetchMode mode: FetchMode.values() ) {
|
|
||||||
if ( mode.name().equalsIgnoreCase( style ) ) {
|
|
||||||
return mode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException( "Unknown FetchMode: " + style );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEntity() {
|
public String getEntity() {
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
@ -150,14 +113,6 @@ public class FetchProfile {
|
||||||
return association;
|
return association;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getMethod()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public String getStyle() {
|
|
||||||
return method.toString().toLowerCase(Locale.ROOT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FetchMode getMethod() {
|
public FetchMode getMethod() {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@ import org.hibernate.Internal;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.annotations.OnDeleteAction;
|
import org.hibernate.annotations.OnDeleteAction;
|
||||||
import org.hibernate.boot.Metadata;
|
import org.hibernate.boot.Metadata;
|
||||||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
|
|
||||||
import static org.hibernate.internal.util.StringHelper.qualify;
|
import static org.hibernate.internal.util.StringHelper.qualify;
|
||||||
|
|
||||||
|
@ -25,6 +23,7 @@ import static org.hibernate.internal.util.StringHelper.qualify;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class ForeignKey extends Constraint {
|
public class ForeignKey extends Constraint {
|
||||||
|
|
||||||
private Table referencedTable;
|
private Table referencedTable;
|
||||||
private String referencedEntityName;
|
private String referencedEntityName;
|
||||||
private String keyDefinition;
|
private String keyDefinition;
|
||||||
|
@ -32,6 +31,10 @@ public class ForeignKey extends Constraint {
|
||||||
private final List<Column> referencedColumns = new ArrayList<>();
|
private final List<Column> referencedColumns = new ArrayList<>();
|
||||||
private boolean creationEnabled = true;
|
private boolean creationEnabled = true;
|
||||||
|
|
||||||
|
public ForeignKey(Table table){
|
||||||
|
setTable( table );
|
||||||
|
}
|
||||||
|
|
||||||
public ForeignKey() {
|
public ForeignKey() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,41 +62,6 @@ public class ForeignKey extends Constraint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Deprecated(since="6.2", forRemoval = true)
|
|
||||||
public String sqlConstraintString(
|
|
||||||
SqlStringGenerationContext context,
|
|
||||||
String constraintName,
|
|
||||||
String defaultCatalog,
|
|
||||||
String defaultSchema) {
|
|
||||||
Dialect dialect = context.getDialect();
|
|
||||||
String[] columnNames = new String[getColumnSpan()];
|
|
||||||
String[] referencedColumnNames = new String[getColumnSpan()];
|
|
||||||
|
|
||||||
final List<Column> referencedColumns = isReferenceToPrimaryKey()
|
|
||||||
? referencedTable.getPrimaryKey().getColumns()
|
|
||||||
: this.referencedColumns;
|
|
||||||
|
|
||||||
List<Column> columns = getColumns();
|
|
||||||
for ( int i=0; i<referencedColumns.size() && i<columns.size(); i++ ) {
|
|
||||||
columnNames[i] = columns.get(i).getQuotedName( dialect );
|
|
||||||
referencedColumnNames[i] = referencedColumns.get(i).getQuotedName( dialect );
|
|
||||||
}
|
|
||||||
|
|
||||||
final String result = keyDefinition != null
|
|
||||||
? dialect.getAddForeignKeyConstraintString( constraintName, keyDefinition )
|
|
||||||
: dialect.getAddForeignKeyConstraintString(
|
|
||||||
constraintName,
|
|
||||||
columnNames,
|
|
||||||
referencedTable.getQualifiedName( context ),
|
|
||||||
referencedColumnNames,
|
|
||||||
isReferenceToPrimaryKey()
|
|
||||||
);
|
|
||||||
|
|
||||||
return onDeleteAction != null && onDeleteAction != OnDeleteAction.NO_ACTION && dialect.supportsCascadeDelete()
|
|
||||||
? result + " on delete " + onDeleteAction.toSqlString()
|
|
||||||
: result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Table getReferencedTable() {
|
public Table getReferencedTable() {
|
||||||
return referencedTable;
|
return referencedTable;
|
||||||
}
|
}
|
||||||
|
@ -172,22 +140,6 @@ public class ForeignKey extends Constraint {
|
||||||
return onDeleteAction;
|
return onDeleteAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getOnDeleteAction()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2")
|
|
||||||
public boolean isCascadeDeleteEnabled() {
|
|
||||||
return onDeleteAction == OnDeleteAction.CASCADE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #setOnDeleteAction(OnDeleteAction)}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2")
|
|
||||||
public void setCascadeDeleteEnabled(boolean cascadeDeleteEnabled) {
|
|
||||||
this.onDeleteAction = cascadeDeleteEnabled ? OnDeleteAction.CASCADE : OnDeleteAction.NO_ACTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPhysicalConstraint() {
|
public boolean isPhysicalConstraint() {
|
||||||
return referencedTable.isPhysicalTable()
|
return referencedTable.isPhysicalTable()
|
||||||
&& getTable().isPhysicalTable()
|
&& getTable().isPhysicalTable()
|
||||||
|
@ -234,11 +186,6 @@ public class ForeignKey extends Constraint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public String generatedConstraintNamePrefix() {
|
|
||||||
return "FK_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
public PersistentClass resolveReferencedClass(Metadata metadata) {
|
public PersistentClass resolveReferencedClass(Metadata metadata) {
|
||||||
final String referencedEntityName = getReferencedEntityName();
|
final String referencedEntityName = getReferencedEntityName();
|
||||||
|
|
|
@ -12,10 +12,8 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.boot.Metadata;
|
|
||||||
import org.hibernate.boot.model.naming.Identifier;
|
import org.hibernate.boot.model.naming.Identifier;
|
||||||
import org.hibernate.boot.model.relational.Exportable;
|
import org.hibernate.boot.model.relational.Exportable;
|
||||||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
|
||||||
import static java.util.Collections.unmodifiableList;
|
import static java.util.Collections.unmodifiableList;
|
||||||
|
@ -24,7 +22,6 @@ import static java.util.stream.Collectors.toUnmodifiableList;
|
||||||
import static java.util.stream.Collectors.toUnmodifiableMap;
|
import static java.util.stream.Collectors.toUnmodifiableMap;
|
||||||
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
|
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
|
||||||
import static org.hibernate.internal.util.StringHelper.qualify;
|
import static org.hibernate.internal.util.StringHelper.qualify;
|
||||||
import static org.hibernate.internal.util.StringHelper.unqualify;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mapping model object representing an {@linkplain jakarta.persistence.Index index} on a relational database table.
|
* A mapping model object representing an {@linkplain jakarta.persistence.Index index} on a relational database table.
|
||||||
|
@ -41,72 +38,6 @@ public class Index implements Exportable, Serializable {
|
||||||
private final java.util.List<Selectable> selectables = new ArrayList<>();
|
private final java.util.List<Selectable> selectables = new ArrayList<>();
|
||||||
private final java.util.Map<Selectable, String> selectableOrderMap = new HashMap<>();
|
private final java.util.Map<Selectable, String> selectableOrderMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated This method will be removed in the next release
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public static String buildSqlDropIndexString(String name, String tableName) {
|
|
||||||
return "drop index " + qualify( tableName, name );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated This method will be removed in the next release
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public static String buildSqlCreateIndexString(
|
|
||||||
Dialect dialect,
|
|
||||||
String name,
|
|
||||||
String tableName,
|
|
||||||
java.util.List<Column> columns,
|
|
||||||
java.util.Map<Column, String> columnOrderMap,
|
|
||||||
boolean unique) {
|
|
||||||
StringBuilder statement = new StringBuilder( dialect.getCreateIndexString( unique ) )
|
|
||||||
.append( " " )
|
|
||||||
.append( dialect.qualifyIndexName() ? name : unqualify( name ) )
|
|
||||||
.append( " on " )
|
|
||||||
.append( tableName )
|
|
||||||
.append( " (" );
|
|
||||||
boolean first = true;
|
|
||||||
for ( Column column : columns ) {
|
|
||||||
if ( first ) {
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
statement.append(", ");
|
|
||||||
}
|
|
||||||
statement.append( column.getQuotedName( dialect ) );
|
|
||||||
if ( columnOrderMap.containsKey( column ) ) {
|
|
||||||
statement.append( " " ).append( columnOrderMap.get( column ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
statement.append( ")" );
|
|
||||||
statement.append( dialect.getCreateIndexTail( unique, columns ) );
|
|
||||||
|
|
||||||
return statement.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated This method will be removed in the next release
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public static String buildSqlCreateIndexString(
|
|
||||||
SqlStringGenerationContext context,
|
|
||||||
String name,
|
|
||||||
Table table,
|
|
||||||
java.util.List<Column> columns,
|
|
||||||
java.util.Map<Column, String> columnOrderMap,
|
|
||||||
boolean unique,
|
|
||||||
Metadata metadata) {
|
|
||||||
return buildSqlCreateIndexString(
|
|
||||||
context.getDialect(),
|
|
||||||
name,
|
|
||||||
context.format( table.getQualifiedTableName() ),
|
|
||||||
columns,
|
|
||||||
columnOrderMap,
|
|
||||||
unique
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Table getTable() {
|
public Table getTable() {
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
@ -166,24 +97,6 @@ public class Index implements Exportable, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getSelectableOrderMap()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.3", forRemoval = true)
|
|
||||||
public void addColumns(java.util.List<Column> extraColumns) {
|
|
||||||
for ( Column column : extraColumns ) {
|
|
||||||
addColumn( column );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getSelectableOrderMap()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.3", forRemoval = true)
|
|
||||||
public boolean containsColumn(Column column) {
|
|
||||||
return selectables.contains( column );
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name == null ? null : name.getText();
|
return name == null ? null : name.getText();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.mapping;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@ -84,11 +83,6 @@ public class Join implements AttributeContainer, Serializable {
|
||||||
return properties.contains( property );
|
return properties.contains( property );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(since = "6.0")
|
|
||||||
public Iterator<Property> getPropertyIterator() {
|
|
||||||
return properties.iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Table getTable() {
|
public Table getTable() {
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
@ -152,14 +146,6 @@ public class Join implements AttributeContainer, Serializable {
|
||||||
return customInsertCallable;
|
return customInsertCallable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getInsertExpectation()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public ExecuteUpdateResultCheckStyle getCustomSQLInsertCheckStyle() {
|
|
||||||
return insertCheckStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
||||||
this.customSQLUpdate = customSQLUpdate;
|
this.customSQLUpdate = customSQLUpdate;
|
||||||
this.customUpdateCallable = callable;
|
this.customUpdateCallable = callable;
|
||||||
|
@ -175,14 +161,6 @@ public class Join implements AttributeContainer, Serializable {
|
||||||
return customUpdateCallable;
|
return customUpdateCallable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getUpdateExpectation()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public ExecuteUpdateResultCheckStyle getCustomSQLUpdateCheckStyle() {
|
|
||||||
return updateCheckStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
||||||
this.customSQLDelete = customSQLDelete;
|
this.customSQLDelete = customSQLDelete;
|
||||||
this.customDeleteCallable = callable;
|
this.customDeleteCallable = callable;
|
||||||
|
@ -198,14 +176,6 @@ public class Join implements AttributeContainer, Serializable {
|
||||||
return customDeleteCallable;
|
return customDeleteCallable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getDeleteExpectation()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public ExecuteUpdateResultCheckStyle getCustomSQLDeleteCheckStyle() {
|
|
||||||
return deleteCheckStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInverse() {
|
public boolean isInverse() {
|
||||||
return inverse;
|
return inverse;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -117,15 +116,6 @@ public class OneToOne extends ToOne {
|
||||||
return columns;
|
return columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #getSelectables()} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.3")
|
|
||||||
@Override
|
|
||||||
public Iterator<Selectable> getConstraintColumnIterator() {
|
|
||||||
return identifier.getSelectables().iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the constrained.
|
* Returns the constrained.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.hibernate.internal.FilterConfiguration;
|
||||||
import org.hibernate.internal.util.collections.JoinedList;
|
import org.hibernate.internal.util.collections.JoinedList;
|
||||||
import org.hibernate.jdbc.Expectation;
|
import org.hibernate.jdbc.Expectation;
|
||||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
|
||||||
import org.hibernate.jpa.event.spi.CallbackDefinition;
|
import org.hibernate.jpa.event.spi.CallbackDefinition;
|
||||||
import org.hibernate.query.sqm.function.SqmFunctionRegistry;
|
import org.hibernate.query.sqm.function.SqmFunctionRegistry;
|
||||||
import org.hibernate.service.ServiceRegistry;
|
import org.hibernate.service.ServiceRegistry;
|
||||||
|
@ -329,22 +328,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
||||||
isCached = cached;
|
isCached = cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #isCached} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public boolean isCachingExplicitlyRequested() {
|
|
||||||
return isCached();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #setCached} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public void setCachingExplicitlyRequested(boolean cached) {
|
|
||||||
setCached( cached );
|
|
||||||
}
|
|
||||||
|
|
||||||
public CacheLayout getQueryCacheLayout() {
|
public CacheLayout getQueryCacheLayout() {
|
||||||
return queryCacheLayout;
|
return queryCacheLayout;
|
||||||
}
|
}
|
||||||
|
@ -580,25 +563,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated This will be removed with no replacement.
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true)
|
|
||||||
public Property getSubclassProperty(String propertyName) throws MappingException {
|
|
||||||
final Property identifierProperty = getIdentifierProperty();
|
|
||||||
if ( identifierProperty != null
|
|
||||||
&& identifierProperty.getName().equals( root( propertyName ) ) ) {
|
|
||||||
return identifierProperty;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
final Component identifierMapper = getIdentifierMapper();
|
|
||||||
final List<Property> closure = identifierMapper != null
|
|
||||||
? new JoinedList<>( identifierMapper.getProperties(), getSubclassPropertyClosure() )
|
|
||||||
: getSubclassPropertyClosure();
|
|
||||||
return getProperty( propertyName, closure );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if this PersistentClass defines a property with the given name.
|
* Check to see if this PersistentClass defines a property with the given name.
|
||||||
*
|
*
|
||||||
|
@ -650,22 +614,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
||||||
|| getSuperclass() != null && getSuperclass().isPropertyDefinedInHierarchy( name );
|
|| getSuperclass() != null && getSuperclass().isPropertyDefinedInHierarchy( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated prefer {@link #getOptimisticLockStyle}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public int getOptimisticLockMode() {
|
|
||||||
return getOptimisticLockStyle().getOldCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated prefer {@link #setOptimisticLockStyle}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public void setOptimisticLockMode(int optimisticLockMode) {
|
|
||||||
setOptimisticLockStyle( OptimisticLockStyle.interpretOldCode( optimisticLockMode ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public OptimisticLockStyle getOptimisticLockStyle() {
|
public OptimisticLockStyle getOptimisticLockStyle() {
|
||||||
return optimisticLockStyle;
|
return optimisticLockStyle;
|
||||||
}
|
}
|
||||||
|
@ -812,14 +760,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
||||||
return customInsertCallable;
|
return customInsertCallable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getInsertExpectation()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public ExecuteUpdateResultCheckStyle getCustomSQLInsertCheckStyle() {
|
|
||||||
return insertCheckStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
||||||
this.customSQLUpdate = customSQLUpdate;
|
this.customSQLUpdate = customSQLUpdate;
|
||||||
this.customUpdateCallable = callable;
|
this.customUpdateCallable = callable;
|
||||||
|
@ -835,14 +775,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
||||||
return customUpdateCallable;
|
return customUpdateCallable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getUpdateExpectation()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public ExecuteUpdateResultCheckStyle getCustomSQLUpdateCheckStyle() {
|
|
||||||
return updateCheckStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) {
|
||||||
this.customSQLDelete = customSQLDelete;
|
this.customSQLDelete = customSQLDelete;
|
||||||
this.customDeleteCallable = callable;
|
this.customDeleteCallable = callable;
|
||||||
|
@ -858,14 +790,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
|
||||||
return customDeleteCallable;
|
return customDeleteCallable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #getDeleteExpectation()}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public ExecuteUpdateResultCheckStyle getCustomSQLDeleteCheckStyle() {
|
|
||||||
return deleteCheckStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addFilter(
|
public void addFilter(
|
||||||
String name,
|
String name,
|
||||||
String condition,
|
String condition,
|
||||||
|
|
|
@ -10,11 +10,8 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.Internal;
|
import org.hibernate.Internal;
|
||||||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
|
||||||
import org.hibernate.dialect.Dialect;
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import static org.hibernate.internal.util.StringHelper.qualify;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mapping model object representing a primary key constraint.
|
* A mapping model object representing a primary key constraint.
|
||||||
|
@ -23,7 +20,6 @@ import org.jboss.logging.Logger;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class PrimaryKey extends Constraint {
|
public class PrimaryKey extends Constraint {
|
||||||
private static final Logger log = Logger.getLogger( PrimaryKey.class );
|
|
||||||
|
|
||||||
private UniqueKey orderingUniqueKey = null;
|
private UniqueKey orderingUniqueKey = null;
|
||||||
private int[] originalOrder;
|
private int[] originalOrder;
|
||||||
|
@ -32,90 +28,30 @@ public class PrimaryKey extends Constraint {
|
||||||
setTable( table );
|
setTable( table );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PrimaryKey() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addColumn(Column column) {
|
public void addColumn(Column column) {
|
||||||
|
// force primary key columns to not-null
|
||||||
for ( Column next : getTable().getColumns() ) {
|
for ( Column next : getTable().getColumns() ) {
|
||||||
if ( next.getCanonicalName().equals( column.getCanonicalName() ) ) {
|
if ( next.getCanonicalName().equals( column.getCanonicalName() ) ) {
|
||||||
next.setNullable( false );
|
next.setNullable( false );
|
||||||
if ( log.isDebugEnabled() ) {
|
|
||||||
log.debugf(
|
|
||||||
"Forcing column [%s] to be non-null as it is part of the primary key for table [%s]",
|
|
||||||
column.getCanonicalName(),
|
|
||||||
getTableNameForLogging( column )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.addColumn( column );
|
super.addColumn( column );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getTableNameForLogging(Column column) {
|
|
||||||
if ( getTable() != null ) {
|
|
||||||
if ( getTable().getNameIdentifier() != null ) {
|
|
||||||
return getTable().getNameIdentifier().getCanonicalName();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return "<unknown>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( column.getValue() != null && column.getValue().getTable() != null ) {
|
|
||||||
return column.getValue().getTable().getNameIdentifier().getCanonicalName();
|
|
||||||
}
|
|
||||||
return "<unknown>";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String sqlConstraintString(Dialect dialect) {
|
|
||||||
StringBuilder buf = new StringBuilder();
|
|
||||||
if ( orderingUniqueKey != null && orderingUniqueKey.isNameExplicit() ) {
|
|
||||||
buf.append( "constraint " ).append( orderingUniqueKey.getName() ).append( ' ' );
|
|
||||||
}
|
|
||||||
buf.append( "primary key (" );
|
|
||||||
boolean first = true;
|
|
||||||
for ( Column column : getColumns() ) {
|
|
||||||
if ( first ) {
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
buf.append(", ");
|
|
||||||
}
|
|
||||||
buf.append( column.getQuotedName( dialect ) );
|
|
||||||
}
|
|
||||||
return buf.append(')').toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override @Deprecated(since="6.2", forRemoval = true)
|
|
||||||
public String sqlConstraintString(SqlStringGenerationContext context, String constraintName, String defaultCatalog, String defaultSchema) {
|
|
||||||
Dialect dialect = context.getDialect();
|
|
||||||
StringBuilder buf = new StringBuilder();
|
|
||||||
buf.append( dialect.getAddPrimaryKeyConstraintString( constraintName ) ).append('(');
|
|
||||||
boolean first = true;
|
|
||||||
for ( Column column : getColumns() ) {
|
|
||||||
if ( first ) {
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
buf.append(", ");
|
|
||||||
}
|
|
||||||
buf.append( column.getQuotedName( dialect ) );
|
|
||||||
}
|
|
||||||
return buf.append(')').toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public String generatedConstraintNamePrefix() {
|
|
||||||
return "PK_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getExportIdentifier() {
|
public String getExportIdentifier() {
|
||||||
return StringHelper.qualify( getTable().getExportIdentifier(), "PK-" + getName() );
|
return qualify( getTable().getExportIdentifier(), "PK-" + getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Column> getColumnsInOriginalOrder() {
|
public List<Column> getColumnsInOriginalOrder() {
|
||||||
if ( originalOrder == null ) {
|
|
||||||
return getColumns();
|
|
||||||
}
|
|
||||||
final List<Column> columns = getColumns();
|
final List<Column> columns = getColumns();
|
||||||
|
if ( originalOrder == null ) {
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
final Column[] columnsInOriginalOrder = new Column[columns.size()];
|
final Column[] columnsInOriginalOrder = new Column[columns.size()];
|
||||||
for ( int i = 0; i < columnsInOriginalOrder.length; i++ ) {
|
for ( int i = 0; i < columnsInOriginalOrder.length; i++ ) {
|
||||||
columnsInOriginalOrder[originalOrder[i]] = columns.get( i );
|
columnsInOriginalOrder[originalOrder[i]] = columns.get( i );
|
||||||
|
@ -124,23 +60,27 @@ public class PrimaryKey extends Constraint {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrderingUniqueKey(UniqueKey uniqueKey) {
|
public void setOrderingUniqueKey(UniqueKey uniqueKey) {
|
||||||
this.orderingUniqueKey = uniqueKey;
|
orderingUniqueKey = uniqueKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UniqueKey getOrderingUniqueKey() {
|
public UniqueKey getOrderingUniqueKey() {
|
||||||
return this.orderingUniqueKey;
|
return orderingUniqueKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
public void reorderColumns(List<Column> reorderedColumns) {
|
public void reorderColumns(List<Column> reorderedColumns) {
|
||||||
|
final List<Column> columns = getColumns();
|
||||||
if ( originalOrder != null ) {
|
if ( originalOrder != null ) {
|
||||||
assert getColumns().equals( reorderedColumns );
|
assert columns.equals( reorderedColumns );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert getColumns().size() == reorderedColumns.size() && getColumns().containsAll( reorderedColumns );
|
assert columns.size() == reorderedColumns.size() && columns.containsAll( reorderedColumns );
|
||||||
final List<Column> columns = getColumns();
|
|
||||||
originalOrder = new int[columns.size()];
|
originalOrder = new int[columns.size()];
|
||||||
List<Column> newColumns = getOrderingUniqueKey() != null ? getOrderingUniqueKey().getColumns() : reorderedColumns;
|
final UniqueKey orderingUniqueKey = getOrderingUniqueKey();
|
||||||
|
final List<Column> newColumns =
|
||||||
|
orderingUniqueKey != null
|
||||||
|
? orderingUniqueKey.getColumns()
|
||||||
|
: reorderedColumns;
|
||||||
for ( int i = 0; i < newColumns.size(); i++ ) {
|
for ( int i = 0; i < newColumns.size(); i++ ) {
|
||||||
final Column reorderedColumn = newColumns.get( i );
|
final Column reorderedColumn = newColumns.get( i );
|
||||||
originalOrder[i] = columns.indexOf( reorderedColumn );
|
originalOrder[i] = columns.indexOf( reorderedColumn );
|
||||||
|
|
|
@ -134,14 +134,6 @@ public class Property implements Serializable, MetaAttributable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated this method is no longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public boolean isPrimitive(Class<?> clazz) {
|
|
||||||
return getGetter( clazz ).getReturnTypeClass().isPrimitive();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CascadeStyle getCascadeStyle() throws MappingException {
|
public CascadeStyle getCascadeStyle() throws MappingException {
|
||||||
final Type type = value.getType();
|
final Type type = value.getType();
|
||||||
if ( type.isComponentType() ) {
|
if ( type.isComponentType() ) {
|
||||||
|
@ -252,15 +244,6 @@ public class Property implements Serializable, MetaAttributable {
|
||||||
this.propertyAccessStrategy = propertyAccessStrategy;
|
this.propertyAccessStrategy = propertyAccessStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Approximate!
|
|
||||||
* @deprecated this method is no longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
boolean isNullable() {
|
|
||||||
return value==null || value.isNullable();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBasicPropertyAccessor() {
|
public boolean isBasicPropertyAccessor() {
|
||||||
return propertyAccessorName==null || "property".equals( propertyAccessorName );
|
return propertyAccessorName==null || "property".equals( propertyAccessorName );
|
||||||
}
|
}
|
||||||
|
@ -371,14 +354,6 @@ public class Property implements Serializable, MetaAttributable {
|
||||||
this.selectable = selectable;
|
this.selectable = selectable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated this method is no longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public String getAccessorPropertyName(RepresentationMode mode) {
|
|
||||||
return getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo : remove
|
// todo : remove
|
||||||
@Internal
|
@Internal
|
||||||
public Getter getGetter(Class clazz) throws MappingException {
|
public Getter getGetter(Class clazz) throws MappingException {
|
||||||
|
|
|
@ -280,14 +280,6 @@ public abstract class SimpleValue implements KeyValue {
|
||||||
return (List) columns;
|
return (List) columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #getSelectables()} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.3")
|
|
||||||
public Iterator<Selectable> getConstraintColumnIterator() {
|
|
||||||
return getSelectables().iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTypeName() {
|
public String getTypeName() {
|
||||||
return typeName;
|
return typeName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,26 +325,10 @@ public class Table implements Serializable, ContributableDatabaseObject {
|
||||||
return unmodifiableMap( indexes );
|
return unmodifiableMap( indexes );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used, should be removed
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.0", forRemoval = true)
|
|
||||||
public Iterator<ForeignKey> getForeignKeyIterator() {
|
|
||||||
return getForeignKeys().values().iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<ForeignKeyKey, ForeignKey> getForeignKeys() {
|
public Map<ForeignKeyKey, ForeignKey> getForeignKeys() {
|
||||||
return unmodifiableMap( foreignKeys );
|
return unmodifiableMap( foreignKeys );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used, should be removed
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.0", forRemoval = true)
|
|
||||||
public Iterator<UniqueKey> getUniqueKeyIterator() {
|
|
||||||
return getUniqueKeys().values().iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, UniqueKey> getUniqueKeys() {
|
public Map<String, UniqueKey> getUniqueKeys() {
|
||||||
cleanseUniqueKeyMapIfNeeded();
|
cleanseUniqueKeyMapIfNeeded();
|
||||||
return unmodifiableMap( uniqueKeys );
|
return unmodifiableMap( uniqueKeys );
|
||||||
|
@ -590,25 +574,6 @@ public class Table implements Serializable, ContributableDatabaseObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If there is one given column, mark it unique, otherwise
|
|
||||||
* create a {@link UniqueKey} comprising the given columns.
|
|
||||||
* @deprecated Use {@link #createUniqueKey(List, MetadataBuildingContext)}
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.5", forRemoval = true)
|
|
||||||
public void createUniqueKey(List<Column> keyColumns) {
|
|
||||||
if ( keyColumns.size() == 1 ) {
|
|
||||||
keyColumns.get(0).setUnique( true );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
String keyName = Constraint.generateName( "UK_", this, keyColumns );
|
|
||||||
UniqueKey uniqueKey = getOrCreateUniqueKey( keyName );
|
|
||||||
for ( Column keyColumn : keyColumns ) {
|
|
||||||
uniqueKey.addColumn( keyColumn );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniqueKey getUniqueKey(String keyName) {
|
public UniqueKey getUniqueKey(String keyName) {
|
||||||
return uniqueKeys.get( keyName );
|
return uniqueKeys.get( keyName );
|
||||||
}
|
}
|
||||||
|
@ -616,9 +581,8 @@ public class Table implements Serializable, ContributableDatabaseObject {
|
||||||
public UniqueKey getOrCreateUniqueKey(String keyName) {
|
public UniqueKey getOrCreateUniqueKey(String keyName) {
|
||||||
UniqueKey uniqueKey = uniqueKeys.get( keyName );
|
UniqueKey uniqueKey = uniqueKeys.get( keyName );
|
||||||
if ( uniqueKey == null ) {
|
if ( uniqueKey == null ) {
|
||||||
uniqueKey = new UniqueKey();
|
uniqueKey = new UniqueKey( this );
|
||||||
uniqueKey.setName( keyName );
|
uniqueKey.setName( keyName );
|
||||||
uniqueKey.setTable( this );
|
|
||||||
uniqueKeys.put( keyName, uniqueKey );
|
uniqueKeys.put( keyName, uniqueKey );
|
||||||
}
|
}
|
||||||
return uniqueKey;
|
return uniqueKey;
|
||||||
|
@ -641,8 +605,7 @@ public class Table implements Serializable, ContributableDatabaseObject {
|
||||||
|
|
||||||
ForeignKey foreignKey = foreignKeys.get( key );
|
ForeignKey foreignKey = foreignKeys.get( key );
|
||||||
if ( foreignKey == null ) {
|
if ( foreignKey == null ) {
|
||||||
foreignKey = new ForeignKey();
|
foreignKey = new ForeignKey( this );
|
||||||
foreignKey.setTable( this );
|
|
||||||
foreignKey.setReferencedEntityName( referencedEntityName );
|
foreignKey.setReferencedEntityName( referencedEntityName );
|
||||||
foreignKey.setKeyDefinition( keyDefinition );
|
foreignKey.setKeyDefinition( keyDefinition );
|
||||||
for ( Column keyColumn : keyColumns ) {
|
for ( Column keyColumn : keyColumns ) {
|
||||||
|
@ -775,22 +738,6 @@ public class Table implements Serializable, ContributableDatabaseObject {
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used, should be removed
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.0", forRemoval = true)
|
|
||||||
public Iterator<String> getCheckConstraintsIterator() {
|
|
||||||
return getCheckConstraints().iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used, should be removed
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.2", forRemoval = true)
|
|
||||||
public List<String> getCheckConstraints() {
|
|
||||||
return checkConstraints.stream().map( CheckConstraint::getConstraint ).collect( toList() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CheckConstraint> getChecks() {
|
public List<CheckConstraint> getChecks() {
|
||||||
return unmodifiableList( checkConstraints );
|
return unmodifiableList( checkConstraints );
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,8 @@ package org.hibernate.mapping;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
|
|
||||||
import org.hibernate.internal.util.StringHelper;
|
|
||||||
|
|
||||||
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
|
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
|
||||||
|
import static org.hibernate.internal.util.StringHelper.qualify;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mapping model object representing a {@linkplain jakarta.persistence.UniqueConstraint unique key}
|
* A mapping model object representing a {@linkplain jakarta.persistence.UniqueConstraint unique key}
|
||||||
|
@ -21,19 +19,16 @@ import static org.hibernate.internal.util.StringHelper.isNotEmpty;
|
||||||
* @author Brett Meyer
|
* @author Brett Meyer
|
||||||
*/
|
*/
|
||||||
public class UniqueKey extends Constraint {
|
public class UniqueKey extends Constraint {
|
||||||
|
|
||||||
private final Map<Column, String> columnOrderMap = new HashMap<>();
|
private final Map<Column, String> columnOrderMap = new HashMap<>();
|
||||||
private boolean nameExplicit; // true when the constraint name was explicitly specified by @UniqueConstraint annotation
|
private boolean nameExplicit; // true when the constraint name was explicitly specified by @UniqueConstraint annotation
|
||||||
private boolean explicit; // true when the constraint was explicitly specified by @UniqueConstraint annotation
|
private boolean explicit; // true when the constraint was explicitly specified by @UniqueConstraint annotation
|
||||||
|
|
||||||
@Override @Deprecated(since="6.2", forRemoval = true)
|
public UniqueKey(Table table){
|
||||||
public String sqlConstraintString(
|
setTable( table );
|
||||||
SqlStringGenerationContext context,
|
}
|
||||||
String constraintName,
|
|
||||||
String defaultCatalog,
|
public UniqueKey() {
|
||||||
String defaultSchema) {
|
|
||||||
// return dialect.getUniqueDelegate().uniqueConstraintSql( this );
|
|
||||||
// Not used.
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addColumn(Column column, String order) {
|
public void addColumn(Column column, String order) {
|
||||||
|
@ -47,14 +42,9 @@ public class UniqueKey extends Constraint {
|
||||||
return columnOrderMap;
|
return columnOrderMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public String generatedConstraintNamePrefix() {
|
|
||||||
return "UK_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getExportIdentifier() {
|
public String getExportIdentifier() {
|
||||||
return StringHelper.qualify( getTable().getExportIdentifier(), "UK-" + getName() );
|
return qualify( getTable().getExportIdentifier(), "UK-" + getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNameExplicit() {
|
public boolean isNameExplicit() {
|
||||||
|
|
|
@ -280,37 +280,6 @@ public interface EntityMappingType
|
||||||
default void pruneForSubclasses(TableGroup tableGroup, Map<String, EntityNameUse> entityNameUses) {
|
default void pruneForSubclasses(TableGroup tableGroup, Map<String, EntityNameUse> entityNameUses) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adapts the table group and its table reference as well as table reference joins
|
|
||||||
* in a way such that unnecessary tables or joins are omitted if possible,
|
|
||||||
* based on the given treated entity names.
|
|
||||||
*
|
|
||||||
* The goal is to e.g. remove join inheritance "branches" or union selects that are impossible.
|
|
||||||
*
|
|
||||||
* Consider the following example:
|
|
||||||
* <code>
|
|
||||||
* class BaseEntity {}
|
|
||||||
* class Sub1 extends BaseEntity {}
|
|
||||||
* class Sub1Sub1 extends Sub1 {}
|
|
||||||
* class Sub1Sub2 extends Sub1 {}
|
|
||||||
* class Sub2 extends BaseEntity {}
|
|
||||||
* class Sub2Sub1 extends Sub2 {}
|
|
||||||
* class Sub2Sub2 extends Sub2 {}
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* If the <code>treatedEntityNames</code> only contains <code>Sub1</code> or any of its subtypes,
|
|
||||||
* this means that <code>Sub2</code> and all subtypes are impossible,
|
|
||||||
* thus the joins/selects for these types shall be omitted in the given table group.
|
|
||||||
*
|
|
||||||
* @param tableGroup The table group to prune subclass tables for
|
|
||||||
* @param treatedEntityNames The entity names for which path usages were registered
|
|
||||||
* @deprecated Use {@link #pruneForSubclasses(TableGroup, Map)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
default void pruneForSubclasses(TableGroup tableGroup, Set<String> treatedEntityNames) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// Special model parts - identifier, discriminator, etc
|
// Special model parts - identifier, discriminator, etc
|
||||||
|
|
||||||
|
|
|
@ -295,9 +295,8 @@ public class ToOneAttributeMapping
|
||||||
&& join.getPropertySpan() == 1
|
&& join.getPropertySpan() == 1
|
||||||
&& join.getTable() == manyToOne.getTable()
|
&& join.getTable() == manyToOne.getTable()
|
||||||
&& equal( join.getKey(), manyToOne ) ) {
|
&& equal( join.getKey(), manyToOne ) ) {
|
||||||
//noinspection deprecation
|
|
||||||
bidirectionalAttributeName = SelectablePath.parse(
|
bidirectionalAttributeName = SelectablePath.parse(
|
||||||
join.getPropertyIterator().next().getName()
|
join.getProperties().get(0).getName()
|
||||||
);
|
);
|
||||||
hasJoinTable = true;
|
hasJoinTable = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -918,19 +918,6 @@ public abstract class AbstractCollectionPersister
|
||||||
return elementClass;
|
return elementClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
@Remove
|
|
||||||
protected Object decrementIndexByBase(Object index) {
|
|
||||||
final int baseIndex = attributeMapping.getIndexMetadata().getListIndexBase();
|
|
||||||
if ( baseIndex > 0 ) {
|
|
||||||
index = (Integer)index - baseIndex;
|
|
||||||
}
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Object incrementIndexByBase(Object index) {
|
protected Object incrementIndexByBase(Object index) {
|
||||||
final int baseIndex = attributeMapping.getIndexMetadata().getListIndexBase();
|
final int baseIndex = attributeMapping.getIndexMetadata().getListIndexBase();
|
||||||
if ( baseIndex > 0 ) {
|
if ( baseIndex > 0 ) {
|
||||||
|
|
|
@ -2859,14 +2859,6 @@ public abstract class AbstractEntityPersister
|
||||||
return tableMappings;
|
return tableMappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated this method is no longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
public int getTableMappingsCount() {
|
|
||||||
return tableMappings.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityTableMapping getTableMapping(int i) {
|
public EntityTableMapping getTableMapping(int i) {
|
||||||
return tableMappings[i];
|
return tableMappings[i];
|
||||||
}
|
}
|
||||||
|
@ -2961,14 +2953,6 @@ public abstract class AbstractEntityPersister
|
||||||
deleteCoordinator.delete( object, id, version, session );
|
deleteCoordinator.delete( object, id, version, session );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated this method is no longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
|
||||||
protected boolean isAllOrDirtyOptLocking() {
|
|
||||||
return entityMetamodel.getOptimisticLockStyle().isAllOrDirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void logStaticSQL() {
|
protected void logStaticSQL() {
|
||||||
if ( LOG.isDebugEnabled() ) {
|
if ( LOG.isDebugEnabled() ) {
|
||||||
LOG.debugf( "Static SQL for entity: %s", getEntityName() );
|
LOG.debugf( "Static SQL for entity: %s", getEntityName() );
|
||||||
|
@ -6365,316 +6349,8 @@ public abstract class AbstractEntityPersister
|
||||||
return hasPartitionedSelectionMapping;
|
return hasPartitionedSelectionMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// Deprecations
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated With no replacement
|
|
||||||
*
|
|
||||||
* @see #getInsertCoordinator()
|
|
||||||
* @see #tableMappings
|
|
||||||
* @see EntityTableMapping#isInsertCallable()
|
|
||||||
*/
|
|
||||||
@Deprecated( since = "6", forRemoval = true )
|
|
||||||
public boolean isInsertCallable(int j) {
|
|
||||||
return tableMappings[j].isInsertCallable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated With no replacement
|
|
||||||
*
|
|
||||||
* @see #getUpdateCoordinator()
|
|
||||||
* @see #tableMappings
|
|
||||||
* @see EntityTableMapping#isUpdateCallable()
|
|
||||||
*/
|
|
||||||
@Deprecated( since = "6", forRemoval = true )
|
|
||||||
public boolean isUpdateCallable(int j) {
|
|
||||||
return tableMappings[j].isUpdateCallable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated With no replacement
|
|
||||||
*
|
|
||||||
* @see #getDeleteCoordinator()
|
|
||||||
* @see #tableMappings
|
|
||||||
* @see EntityTableMapping#isDeleteCallable()
|
|
||||||
*/
|
|
||||||
@Deprecated( since = "6", forRemoval = true )
|
|
||||||
public boolean isDeleteCallable(int j) {
|
|
||||||
return tableMappings[j].isDeleteCallable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated With no replacement
|
|
||||||
*/
|
|
||||||
@Deprecated( since = "6", forRemoval = true )
|
|
||||||
protected boolean isSubclassTableSequentialSelect(int j) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated With no replacement.
|
|
||||||
*/
|
|
||||||
@Deprecated( since = "6", forRemoval = true )
|
|
||||||
public EntityMappingType getElementTypeDescriptor() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used
|
|
||||||
*/
|
|
||||||
@Deprecated( forRemoval = true )
|
|
||||||
@Remove
|
|
||||||
public abstract boolean isTableCascadeDeleteEnabled(int j);
|
public abstract boolean isTableCascadeDeleteEnabled(int j);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
@Remove
|
|
||||||
protected boolean isInverseSubclassTable(int j) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used. See {@link #getDeleteCoordinator()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
@Remove
|
|
||||||
public String[] getSQLDeleteStrings() {
|
|
||||||
return extractSqlStrings( deleteCoordinator.getStaticMutationOperationGroup() );
|
|
||||||
}
|
|
||||||
|
|
||||||
private String[] extractSqlStrings(MutationOperationGroup operationGroup) {
|
|
||||||
final int numberOfOperations = operationGroup.getNumberOfOperations();
|
|
||||||
final String[] strings = new String[numberOfOperations];
|
|
||||||
for ( int i = 0; i < numberOfOperations; i++ ) {
|
|
||||||
final MutationOperation operation = operationGroup.getOperation( i );
|
|
||||||
if ( operation instanceof JdbcOperation ) {
|
|
||||||
strings[i] = ( (JdbcOperation) operation ).getSqlString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return strings;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used. See {@link #getUpdateCoordinator()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
@Remove
|
|
||||||
public String[] getSQLUpdateStrings() {
|
|
||||||
return extractSqlStrings( updateCoordinator.getStaticMutationOperationGroup() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decide which tables need to be updated.
|
|
||||||
* <p>
|
|
||||||
* The return here is an array of boolean values with each index corresponding
|
|
||||||
* to a given table in the scope of this persister.
|
|
||||||
*
|
|
||||||
* @param dirtyProperties The indices of all the entity properties considered dirty.
|
|
||||||
* @param hasDirtyCollection Whether any collections owned by the entity which were considered dirty.
|
|
||||||
*
|
|
||||||
* @return Array of booleans indicating which table require updating.
|
|
||||||
*
|
|
||||||
* @deprecated No longer used. See {@link UpdateCoordinator}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
@Remove
|
|
||||||
public boolean[] getTableUpdateNeeded(final int[] dirtyProperties, boolean hasDirtyCollection) {
|
|
||||||
if ( dirtyProperties == null ) {
|
|
||||||
return getTableHasColumns(); // for objects that came in via update()
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
boolean[] updateability = getPropertyUpdateability();
|
|
||||||
int[] propertyTableNumbers = getPropertyTableNumbers();
|
|
||||||
boolean[] tableUpdateNeeded = new boolean[getTableSpan()];
|
|
||||||
for ( int property : dirtyProperties ) {
|
|
||||||
int table = propertyTableNumbers[property];
|
|
||||||
tableUpdateNeeded[table] = tableUpdateNeeded[table]
|
|
||||||
|| getPropertyColumnSpan( property ) > 0 && updateability[property];
|
|
||||||
if ( getPropertyColumnSpan( property ) > 0 && !updateability[property] ) {
|
|
||||||
LOG.ignoreImmutablePropertyModification( getPropertyNames()[property], getEntityName() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( isVersioned() ) {
|
|
||||||
tableUpdateNeeded[0] = tableUpdateNeeded[0]
|
|
||||||
|| isVersionIncrementRequired( dirtyProperties, hasDirtyCollection, getPropertyVersionability() );
|
|
||||||
}
|
|
||||||
return tableUpdateNeeded;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated No longer used. See {@link MutationExecutorService}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
@Remove
|
|
||||||
public boolean isBatchable() {
|
|
||||||
return optimisticLockStyle().isNone()
|
|
||||||
|| !isVersioned() && optimisticLockStyle().isVersion()
|
|
||||||
|| getFactory().getSessionFactoryOptions().isJdbcBatchVersionedData();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate the SQL that deletes a row by id (and version)
|
|
||||||
*
|
|
||||||
* @deprecated No longer used. See {@link DeleteCoordinatorStandard}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
@Remove
|
|
||||||
public String generateDeleteString(int j) {
|
|
||||||
final Delete delete = new Delete( getFactory() )
|
|
||||||
.setTableName( getTableName( j ) )
|
|
||||||
.addColumnRestriction( getKeyColumns( j ) );
|
|
||||||
if ( j == 0 ) {
|
|
||||||
delete.setVersionColumnName( getVersionColumnName() );
|
|
||||||
}
|
|
||||||
if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) {
|
|
||||||
delete.setComment( "delete " + getEntityName() );
|
|
||||||
}
|
|
||||||
return delete.toStatementString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marshall the fields of a persistent instance to a prepared statement
|
|
||||||
*
|
|
||||||
* @deprecated No longer used.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
@Remove
|
|
||||||
public int dehydrate(
|
|
||||||
final Object id,
|
|
||||||
final Object[] fields,
|
|
||||||
final Object rowId,
|
|
||||||
final boolean[] includeProperty,
|
|
||||||
final boolean[][] includeColumns,
|
|
||||||
final int j,
|
|
||||||
final PreparedStatement ps,
|
|
||||||
final SharedSessionContractImplementor session,
|
|
||||||
int index,
|
|
||||||
boolean isUpdate) throws SQLException, HibernateException {
|
|
||||||
|
|
||||||
if ( LOG.isTraceEnabled() ) {
|
|
||||||
LOG.tracev( "Dehydrating entity: {0}", infoString( this, id, getFactory() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
|
|
||||||
if ( includeProperty[i] && isPropertyOfTable( i, j )
|
|
||||||
&& !lobProperties.contains( i ) ) {
|
|
||||||
getPropertyTypes()[i].nullSafeSet( ps, fields[i], index, includeColumns[i], session );
|
|
||||||
index += ArrayHelper.countTrue( includeColumns[i] ); //TODO: this is kinda slow...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !isUpdate ) {
|
|
||||||
index += dehydrateId( id, rowId, ps, session, index );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HHH-4635
|
|
||||||
// Oracle expects all Lob properties to be last in inserts
|
|
||||||
// and updates. Insert them at the end.
|
|
||||||
for ( int i : lobProperties ) {
|
|
||||||
if ( includeProperty[i] && isPropertyOfTable( i, j ) ) {
|
|
||||||
getPropertyTypes()[i].nullSafeSet( ps, fields[i], index, includeColumns[i], session );
|
|
||||||
index += ArrayHelper.countTrue( includeColumns[i] ); //TODO: this is kinda slow...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isUpdate ) {
|
|
||||||
index += dehydrateId( id, rowId, ps, session, index );
|
|
||||||
}
|
|
||||||
|
|
||||||
return index;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private int dehydrateId(
|
|
||||||
final Object id,
|
|
||||||
final Object rowId,
|
|
||||||
final PreparedStatement ps,
|
|
||||||
final SharedSessionContractImplementor session,
|
|
||||||
int index) throws SQLException {
|
|
||||||
if ( rowId != null ) {
|
|
||||||
if ( LOG.isTraceEnabled() ) {
|
|
||||||
LOG.tracev(
|
|
||||||
String.format(
|
|
||||||
"binding parameter [%s] as ROWID - [%s]",
|
|
||||||
index,
|
|
||||||
rowId
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ps.setObject( index, rowId );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if ( id != null ) {
|
|
||||||
getIdentifierType().nullSafeSet( ps, id, index, session );
|
|
||||||
return getIdentifierColumnSpan();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated( since = "6.2", forRemoval = true )
|
|
||||||
@Remove
|
|
||||||
protected String[] generateSQLDeleteStrings(Object[] loadedState) {
|
|
||||||
int span = getTableSpan();
|
|
||||||
String[] deleteStrings = new String[span];
|
|
||||||
for ( int j = span - 1; j >= 0; j-- ) {
|
|
||||||
final Delete delete = new Delete( getFactory() )
|
|
||||||
.setTableName( getTableName( j ) )
|
|
||||||
.addColumnRestriction( getKeyColumns( j ) );
|
|
||||||
if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) {
|
|
||||||
delete.setComment( "delete " + getEntityName() + " [" + j + "]" );
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean[] versionability = getPropertyVersionability();
|
|
||||||
Type[] types = getPropertyTypes();
|
|
||||||
for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
|
|
||||||
if ( isPropertyOfTable( i, j ) && versionability[i] ) {
|
|
||||||
// this property belongs to the table and it is not specifically
|
|
||||||
// excluded from optimistic locking by optimistic-lock="false"
|
|
||||||
String[] propertyColumnNames = getPropertyColumnNames( i );
|
|
||||||
boolean[] propertyNullness = types[i].toColumnNullness( loadedState[i], getFactory() );
|
|
||||||
for ( int k = 0; k < propertyNullness.length; k++ ) {
|
|
||||||
if ( propertyNullness[k] ) {
|
|
||||||
delete.addColumnRestriction( propertyColumnNames[k] );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
delete.addColumnIsNullRestriction( propertyColumnNames[k] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
deleteStrings[j] = delete.toStatementString();
|
|
||||||
}
|
|
||||||
return deleteStrings;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated( since = "6.2", forRemoval = true )
|
|
||||||
@Remove
|
|
||||||
public final boolean isAllNull(Object[] array, int tableNumber) {
|
|
||||||
for ( int i = 0; i < array.length; i++ ) {
|
|
||||||
if ( isPropertyOfTable( i, tableNumber ) && array[i] != null ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -760,11 +760,6 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
return subclassTableNameClosure[subclassPropertyTableNumberClosure[i]];
|
return subclassTableNameClosure[subclassPropertyTableNumberClosure[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isInverseSubclassTable(int j) {
|
|
||||||
return isInverseSubclassTable[j];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isNullableSubclassTable(int j) {
|
protected boolean isNullableSubclassTable(int j) {
|
||||||
return isNullableSubclassTable[j];
|
return isNullableSubclassTable[j];
|
||||||
|
|
|
@ -395,11 +395,6 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
||||||
return isInverseTable[j];
|
return isInverseTable[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isInverseSubclassTable(int j) {
|
|
||||||
return isInverseSubclassTable[j];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDiscriminatorColumnName() {
|
public String getDiscriminatorColumnName() {
|
||||||
return discriminatorColumnName;
|
return discriminatorColumnName;
|
||||||
|
|
|
@ -46,7 +46,6 @@ import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
||||||
import org.hibernate.metamodel.mapping.SelectableMapping;
|
import org.hibernate.metamodel.mapping.SelectableMapping;
|
||||||
import org.hibernate.metamodel.mapping.TableDetails;
|
import org.hibernate.metamodel.mapping.TableDetails;
|
||||||
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
|
|
||||||
import org.hibernate.metamodel.spi.MappingMetamodelImplementor;
|
import org.hibernate.metamodel.spi.MappingMetamodelImplementor;
|
||||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||||
import org.hibernate.persister.spi.PersisterCreationContext;
|
import org.hibernate.persister.spi.PersisterCreationContext;
|
||||||
|
|
|
@ -34,48 +34,6 @@ public interface FunctionRenderingSupport {
|
||||||
List<? extends SqlAstNode> sqlAstArguments,
|
List<? extends SqlAstNode> sqlAstArguments,
|
||||||
SqlAstTranslator<?> walker);
|
SqlAstTranslator<?> walker);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #render(SqlAppender, List, Predicate, ReturnableType, SqlAstTranslator)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
default void render(
|
|
||||||
SqlAppender sqlAppender,
|
|
||||||
List<? extends SqlAstNode> sqlAstArguments,
|
|
||||||
Predicate filter,
|
|
||||||
SqlAstTranslator<?> walker) {
|
|
||||||
// Ignore the filter by default. Subclasses will override this
|
|
||||||
render( sqlAppender, sqlAstArguments, walker );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #render(SqlAppender, List, Predicate, List, ReturnableType, SqlAstTranslator)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
default void render(
|
|
||||||
SqlAppender sqlAppender,
|
|
||||||
List<? extends SqlAstNode> sqlAstArguments,
|
|
||||||
Predicate filter,
|
|
||||||
List<SortSpecification> withinGroup,
|
|
||||||
SqlAstTranslator<?> walker) {
|
|
||||||
// Ignore the filter by default. Subclasses will override this
|
|
||||||
render( sqlAppender, sqlAstArguments, walker );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #render(SqlAppender, List, Predicate, Boolean, Boolean, ReturnableType, SqlAstTranslator)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
default void render(
|
|
||||||
SqlAppender sqlAppender,
|
|
||||||
List<? extends SqlAstNode> sqlAstArguments,
|
|
||||||
Predicate filter,
|
|
||||||
Boolean respectNulls,
|
|
||||||
Boolean fromFirst,
|
|
||||||
SqlAstTranslator<?> walker) {
|
|
||||||
// Ignore the filter by default. Subclasses will override this
|
|
||||||
render( sqlAppender, sqlAstArguments, walker );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 6.4
|
* @since 6.4
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,21 +28,6 @@ public class SelfRenderingAggregateFunctionSqlAstExpression extends SelfRenderin
|
||||||
|
|
||||||
private final Predicate filter;
|
private final Predicate filter;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SelfRenderingAggregateFunctionSqlAstExpression(String, FunctionRenderer, List, Predicate, ReturnableType, JdbcMappingContainer)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public SelfRenderingAggregateFunctionSqlAstExpression(
|
|
||||||
String functionName,
|
|
||||||
FunctionRenderingSupport renderer,
|
|
||||||
List<? extends SqlAstNode> sqlAstArguments,
|
|
||||||
Predicate filter,
|
|
||||||
ReturnableType<?> type,
|
|
||||||
JdbcMappingContainer expressible) {
|
|
||||||
super( functionName, renderer, sqlAstArguments, type, expressible );
|
|
||||||
this.filter = filter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelfRenderingAggregateFunctionSqlAstExpression(
|
public SelfRenderingAggregateFunctionSqlAstExpression(
|
||||||
String functionName,
|
String functionName,
|
||||||
FunctionRenderer renderer,
|
FunctionRenderer renderer,
|
||||||
|
|
|
@ -49,24 +49,6 @@ public class SelfRenderingFunctionSqlAstExpression
|
||||||
private final @Nullable ReturnableType<?> type;
|
private final @Nullable ReturnableType<?> type;
|
||||||
private final @Nullable JdbcMappingContainer expressible;
|
private final @Nullable JdbcMappingContainer expressible;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SelfRenderingFunctionSqlAstExpression(String, FunctionRenderer, List, ReturnableType, JdbcMappingContainer)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public SelfRenderingFunctionSqlAstExpression(
|
|
||||||
String functionName,
|
|
||||||
FunctionRenderingSupport renderer,
|
|
||||||
List<? extends SqlAstNode> sqlAstArguments,
|
|
||||||
@Nullable ReturnableType<?> type,
|
|
||||||
@Nullable JdbcMappingContainer expressible) {
|
|
||||||
this.functionName = functionName;
|
|
||||||
this.renderer = renderer::render;
|
|
||||||
this.sqlAstArguments = sqlAstArguments;
|
|
||||||
this.type = type;
|
|
||||||
//might be null due to code in SelfRenderingFunctionSqlAstExpression
|
|
||||||
this.expressible = expressible;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelfRenderingFunctionSqlAstExpression(
|
public SelfRenderingFunctionSqlAstExpression(
|
||||||
String functionName,
|
String functionName,
|
||||||
FunctionRenderer renderer,
|
FunctionRenderer renderer,
|
||||||
|
@ -98,14 +80,6 @@ public class SelfRenderingFunctionSqlAstExpression
|
||||||
: expressible;
|
: expressible;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #getFunctionRenderer()} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
protected FunctionRenderingSupport getRenderer() {
|
|
||||||
return renderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected FunctionRenderer getFunctionRenderer() {
|
protected FunctionRenderer getFunctionRenderer() {
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,22 +29,6 @@ public class SelfRenderingOrderedSetAggregateFunctionSqlAstExpression extends Se
|
||||||
|
|
||||||
private final List<SortSpecification> withinGroup;
|
private final List<SortSpecification> withinGroup;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SelfRenderingOrderedSetAggregateFunctionSqlAstExpression(String, FunctionRenderer, List, Predicate, List, ReturnableType, JdbcMappingContainer)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public SelfRenderingOrderedSetAggregateFunctionSqlAstExpression(
|
|
||||||
String functionName,
|
|
||||||
FunctionRenderingSupport renderer,
|
|
||||||
List<? extends SqlAstNode> sqlAstArguments,
|
|
||||||
Predicate filter,
|
|
||||||
List<SortSpecification> withinGroup,
|
|
||||||
ReturnableType<?> type,
|
|
||||||
JdbcMappingContainer expressible) {
|
|
||||||
super( functionName, renderer, sqlAstArguments, filter, type, expressible );
|
|
||||||
this.withinGroup = withinGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelfRenderingOrderedSetAggregateFunctionSqlAstExpression(
|
public SelfRenderingOrderedSetAggregateFunctionSqlAstExpression(
|
||||||
String functionName,
|
String functionName,
|
||||||
FunctionRenderer renderer,
|
FunctionRenderer renderer,
|
||||||
|
|
|
@ -30,24 +30,6 @@ public class SelfRenderingSqmAggregateFunction<T> extends SelfRenderingSqmFuncti
|
||||||
|
|
||||||
private final SqmPredicate filter;
|
private final SqmPredicate filter;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SelfRenderingSqmAggregateFunction(SqmFunctionDescriptor, FunctionRenderer, List, SqmPredicate, ReturnableType, ArgumentsValidator, FunctionReturnTypeResolver, NodeBuilder, String)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public SelfRenderingSqmAggregateFunction(
|
|
||||||
SqmFunctionDescriptor descriptor,
|
|
||||||
FunctionRenderingSupport renderingSupport,
|
|
||||||
List<? extends SqmTypedNode<?>> arguments,
|
|
||||||
SqmPredicate filter,
|
|
||||||
ReturnableType<T> impliedResultType,
|
|
||||||
ArgumentsValidator argumentsValidator,
|
|
||||||
FunctionReturnTypeResolver returnTypeResolver,
|
|
||||||
NodeBuilder nodeBuilder,
|
|
||||||
String name) {
|
|
||||||
super( descriptor, renderingSupport, arguments, impliedResultType, argumentsValidator, returnTypeResolver, nodeBuilder, name );
|
|
||||||
this.filter = filter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelfRenderingSqmAggregateFunction(
|
public SelfRenderingSqmAggregateFunction(
|
||||||
SqmFunctionDescriptor descriptor,
|
SqmFunctionDescriptor descriptor,
|
||||||
FunctionRenderer renderer,
|
FunctionRenderer renderer,
|
||||||
|
|
|
@ -38,31 +38,9 @@ public class SelfRenderingSqmFunction<T> extends SqmFunction<T> {
|
||||||
private final @Nullable ReturnableType<T> impliedResultType;
|
private final @Nullable ReturnableType<T> impliedResultType;
|
||||||
private final @Nullable ArgumentsValidator argumentsValidator;
|
private final @Nullable ArgumentsValidator argumentsValidator;
|
||||||
private final FunctionReturnTypeResolver returnTypeResolver;
|
private final FunctionReturnTypeResolver returnTypeResolver;
|
||||||
private final FunctionRenderingSupport renderingSupport;
|
|
||||||
private final FunctionRenderer renderer;
|
private final FunctionRenderer renderer;
|
||||||
private @Nullable ReturnableType<?> resultType;
|
private @Nullable ReturnableType<?> resultType;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SelfRenderingSqmFunction(SqmFunctionDescriptor, FunctionRenderer, List, ReturnableType, ArgumentsValidator, FunctionReturnTypeResolver, NodeBuilder, String)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public SelfRenderingSqmFunction(
|
|
||||||
SqmFunctionDescriptor descriptor,
|
|
||||||
FunctionRenderingSupport renderingSupport,
|
|
||||||
List<? extends SqmTypedNode<?>> arguments,
|
|
||||||
@Nullable ReturnableType<T> impliedResultType,
|
|
||||||
@Nullable ArgumentsValidator argumentsValidator,
|
|
||||||
FunctionReturnTypeResolver returnTypeResolver,
|
|
||||||
NodeBuilder nodeBuilder,
|
|
||||||
String name) {
|
|
||||||
super( name, descriptor, impliedResultType, arguments, nodeBuilder );
|
|
||||||
this.renderingSupport = renderingSupport;
|
|
||||||
this.renderer = renderingSupport::render;
|
|
||||||
this.impliedResultType = impliedResultType;
|
|
||||||
this.argumentsValidator = argumentsValidator;
|
|
||||||
this.returnTypeResolver = returnTypeResolver;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelfRenderingSqmFunction(
|
public SelfRenderingSqmFunction(
|
||||||
SqmFunctionDescriptor descriptor,
|
SqmFunctionDescriptor descriptor,
|
||||||
FunctionRenderer renderer,
|
FunctionRenderer renderer,
|
||||||
|
@ -73,7 +51,6 @@ public class SelfRenderingSqmFunction<T> extends SqmFunction<T> {
|
||||||
NodeBuilder nodeBuilder,
|
NodeBuilder nodeBuilder,
|
||||||
String name) {
|
String name) {
|
||||||
super( name, descriptor, impliedResultType, arguments, nodeBuilder );
|
super( name, descriptor, impliedResultType, arguments, nodeBuilder );
|
||||||
this.renderingSupport = renderer;
|
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
this.impliedResultType = impliedResultType;
|
this.impliedResultType = impliedResultType;
|
||||||
this.argumentsValidator = argumentsValidator;
|
this.argumentsValidator = argumentsValidator;
|
||||||
|
@ -107,14 +84,6 @@ public class SelfRenderingSqmFunction<T> extends SqmFunction<T> {
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #getFunctionRenderer()} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public FunctionRenderingSupport getRenderingSupport() {
|
|
||||||
return renderingSupport;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FunctionRenderer getFunctionRenderer() {
|
public FunctionRenderer getFunctionRenderer() {
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
@ -195,11 +164,6 @@ public class SelfRenderingSqmFunction<T> extends SqmFunction<T> {
|
||||||
return nodeType;
|
return nodeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
protected @Nullable ReturnableType<?> resolveResultType(TypeConfiguration typeConfiguration) {
|
|
||||||
return resolveResultType( () -> null, typeConfiguration );
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable ReturnableType<?> resolveResultType(SqmToSqlAstConverter walker) {
|
public @Nullable ReturnableType<?> resolveResultType(SqmToSqlAstConverter walker) {
|
||||||
if ( resultType == null ) {
|
if ( resultType == null ) {
|
||||||
resultType = determineResultType(
|
resultType = determineResultType(
|
||||||
|
@ -222,22 +186,6 @@ public class SelfRenderingSqmFunction<T> extends SqmFunction<T> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
protected @Nullable ReturnableType<?> resolveResultType(
|
|
||||||
Supplier<MappingModelExpressible<?>> inferredTypeSupplier,
|
|
||||||
TypeConfiguration typeConfiguration) {
|
|
||||||
if ( resultType == null ) {
|
|
||||||
resultType = returnTypeResolver.resolveFunctionReturnType(
|
|
||||||
impliedResultType,
|
|
||||||
inferredTypeSupplier,
|
|
||||||
getArguments(),
|
|
||||||
typeConfiguration
|
|
||||||
);
|
|
||||||
setExpressibleType( resultType );
|
|
||||||
}
|
|
||||||
return resultType;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected MappingModelExpressible<?> getMappingModelExpressible(
|
protected MappingModelExpressible<?> getMappingModelExpressible(
|
||||||
SqmToSqlAstConverter walker,
|
SqmToSqlAstConverter walker,
|
||||||
ReturnableType<?> resultType,
|
ReturnableType<?> resultType,
|
||||||
|
|
|
@ -35,35 +35,6 @@ public class SelfRenderingSqmOrderedSetAggregateFunction<T> extends SelfRenderin
|
||||||
|
|
||||||
private final SqmOrderByClause withinGroup;
|
private final SqmOrderByClause withinGroup;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SelfRenderingSqmOrderedSetAggregateFunction(SqmFunctionDescriptor, FunctionRenderer, List, SqmPredicate, SqmOrderByClause, ReturnableType, ArgumentsValidator, FunctionReturnTypeResolver, NodeBuilder, String)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public SelfRenderingSqmOrderedSetAggregateFunction(
|
|
||||||
SqmFunctionDescriptor descriptor,
|
|
||||||
FunctionRenderingSupport renderingSupport,
|
|
||||||
List<? extends SqmTypedNode<?>> arguments,
|
|
||||||
SqmPredicate filter,
|
|
||||||
SqmOrderByClause withinGroupClause,
|
|
||||||
ReturnableType<T> impliedResultType,
|
|
||||||
ArgumentsValidator argumentsValidator,
|
|
||||||
FunctionReturnTypeResolver returnTypeResolver,
|
|
||||||
NodeBuilder nodeBuilder,
|
|
||||||
String name) {
|
|
||||||
super(
|
|
||||||
descriptor,
|
|
||||||
renderingSupport,
|
|
||||||
arguments,
|
|
||||||
filter,
|
|
||||||
impliedResultType,
|
|
||||||
argumentsValidator,
|
|
||||||
returnTypeResolver,
|
|
||||||
nodeBuilder,
|
|
||||||
name
|
|
||||||
);
|
|
||||||
this.withinGroup = withinGroupClause;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelfRenderingSqmOrderedSetAggregateFunction(
|
public SelfRenderingSqmOrderedSetAggregateFunction(
|
||||||
SqmFunctionDescriptor descriptor,
|
SqmFunctionDescriptor descriptor,
|
||||||
FunctionRenderer renderer,
|
FunctionRenderer renderer,
|
||||||
|
|
|
@ -32,28 +32,6 @@ public class SelfRenderingSqmWindowFunction<T> extends SelfRenderingSqmFunction<
|
||||||
private final Boolean respectNulls;
|
private final Boolean respectNulls;
|
||||||
private final Boolean fromFirst;
|
private final Boolean fromFirst;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SelfRenderingSqmWindowFunction(SqmFunctionDescriptor, FunctionRenderer, List, SqmPredicate, Boolean, Boolean, ReturnableType, ArgumentsValidator, FunctionReturnTypeResolver, NodeBuilder, String)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public SelfRenderingSqmWindowFunction(
|
|
||||||
SqmFunctionDescriptor descriptor,
|
|
||||||
FunctionRenderingSupport renderingSupport,
|
|
||||||
List<? extends SqmTypedNode<?>> arguments,
|
|
||||||
SqmPredicate filter,
|
|
||||||
Boolean respectNulls,
|
|
||||||
Boolean fromFirst,
|
|
||||||
ReturnableType<T> impliedResultType,
|
|
||||||
ArgumentsValidator argumentsValidator,
|
|
||||||
FunctionReturnTypeResolver returnTypeResolver,
|
|
||||||
NodeBuilder nodeBuilder,
|
|
||||||
String name) {
|
|
||||||
super( descriptor, renderingSupport, arguments, impliedResultType, argumentsValidator, returnTypeResolver, nodeBuilder, name );
|
|
||||||
this.filter = filter;
|
|
||||||
this.respectNulls = respectNulls;
|
|
||||||
this.fromFirst = fromFirst;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelfRenderingSqmWindowFunction(
|
public SelfRenderingSqmWindowFunction(
|
||||||
SqmFunctionDescriptor descriptor,
|
SqmFunctionDescriptor descriptor,
|
||||||
FunctionRenderer renderer,
|
FunctionRenderer renderer,
|
||||||
|
|
|
@ -30,25 +30,6 @@ public class SelfRenderingWindowFunctionSqlAstExpression extends SelfRenderingFu
|
||||||
private final Boolean respectNulls;
|
private final Boolean respectNulls;
|
||||||
private final Boolean fromFirst;
|
private final Boolean fromFirst;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #SelfRenderingWindowFunctionSqlAstExpression(String, FunctionRenderer, List, Predicate, Boolean, Boolean, ReturnableType, JdbcMappingContainer)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
public SelfRenderingWindowFunctionSqlAstExpression(
|
|
||||||
String functionName,
|
|
||||||
FunctionRenderingSupport renderer,
|
|
||||||
List<? extends SqlAstNode> sqlAstArguments,
|
|
||||||
Predicate filter,
|
|
||||||
Boolean respectNulls,
|
|
||||||
Boolean fromFirst,
|
|
||||||
ReturnableType<?> type,
|
|
||||||
JdbcMappingContainer expressible) {
|
|
||||||
super( functionName, renderer, sqlAstArguments, type, expressible );
|
|
||||||
this.filter = filter;
|
|
||||||
this.respectNulls = respectNulls;
|
|
||||||
this.fromFirst = fromFirst;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelfRenderingWindowFunctionSqlAstExpression(
|
public SelfRenderingWindowFunctionSqlAstExpression(
|
||||||
String functionName,
|
String functionName,
|
||||||
FunctionRenderer renderer,
|
FunctionRenderer renderer,
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.hibernate.HibernateException;
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.LockOptions;
|
import org.hibernate.LockOptions;
|
||||||
import org.hibernate.ScrollMode;
|
import org.hibernate.ScrollMode;
|
||||||
import org.hibernate.engine.query.spi.EntityGraphQueryHint;
|
|
||||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.generator.Generator;
|
import org.hibernate.generator.Generator;
|
||||||
|
@ -972,10 +971,6 @@ public class QuerySqmImpl<R>
|
||||||
return (T) getQueryOptions().getAppliedGraph();
|
return (T) getQueryOptions().getAppliedGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( EntityGraphQueryHint.class.isAssignableFrom( cls ) ) {
|
|
||||||
return (T) new EntityGraphQueryHint( getQueryOptions().getAppliedGraph() );
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new PersistenceException( "Unrecognized unwrap type [" + cls.getName() + "]" );
|
throw new PersistenceException( "Unrecognized unwrap type [" + cls.getName() + "]" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -580,7 +580,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
||||||
throw new FunctionArgumentException( "Path '" + path + "' does not refer to a single-valued association" );
|
throw new FunctionArgumentException( "Path '" + path + "' does not refer to a single-valued association" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SqmFkExpression<>( (SqmEntityValuedSimplePath<?>) path, this );
|
return new SqmFkExpression<>( (SqmEntityValuedSimplePath<?>) path );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,25 +26,6 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface FunctionReturnTypeResolver {
|
public interface FunctionReturnTypeResolver {
|
||||||
/**
|
|
||||||
* Resolve the return type for a function given its context-implied type and
|
|
||||||
* the arguments to this call.
|
|
||||||
* <p>
|
|
||||||
* The <em>context-implied</em> type is the type implied by where the function
|
|
||||||
* occurs in the query. E.g., for an equality predicate (`something = some_function`)
|
|
||||||
* the implied type of the return from `some_function` would be defined by the type
|
|
||||||
* of `some_function`.
|
|
||||||
*
|
|
||||||
* @return The resolved type.
|
|
||||||
* @deprecated Use {@link #resolveFunctionReturnType(ReturnableType, SqmToSqlAstConverter, List, TypeConfiguration)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
default @Nullable ReturnableType<?> resolveFunctionReturnType(
|
|
||||||
ReturnableType<?> impliedType,
|
|
||||||
List<? extends SqmTypedNode<?>> arguments,
|
|
||||||
TypeConfiguration typeConfiguration) {
|
|
||||||
throw new UnsupportedOperationException( "Not implemented for " + getClass().getName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve the return type for a function given its context-implied type and
|
* Resolve the return type for a function given its context-implied type and
|
||||||
|
|
|
@ -43,71 +43,4 @@ public interface SqmTranslatorFactory {
|
||||||
QueryParameterBindings domainParameterBindings,
|
QueryParameterBindings domainParameterBindings,
|
||||||
LoadQueryInfluencers loadQueryInfluencers,
|
LoadQueryInfluencers loadQueryInfluencers,
|
||||||
SqlAstCreationContext creationContext);
|
SqlAstCreationContext creationContext);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #createMutationTranslator(SqmDmlStatement, QueryOptions, DomainParameterXref, QueryParameterBindings, LoadQueryInfluencers, SqlAstCreationContext)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
default SqmTranslator<DeleteStatement> createSimpleDeleteTranslator(
|
|
||||||
SqmDeleteStatement<?> sqmDeleteStatement,
|
|
||||||
QueryOptions queryOptions,
|
|
||||||
DomainParameterXref domainParameterXref,
|
|
||||||
QueryParameterBindings domainParameterBindings,
|
|
||||||
LoadQueryInfluencers loadQueryInfluencers,
|
|
||||||
SqlAstCreationContext creationContext) {
|
|
||||||
//noinspection unchecked
|
|
||||||
return (SqmTranslator<DeleteStatement>) createMutationTranslator(
|
|
||||||
sqmDeleteStatement,
|
|
||||||
queryOptions,
|
|
||||||
domainParameterXref,
|
|
||||||
domainParameterBindings,
|
|
||||||
loadQueryInfluencers,
|
|
||||||
creationContext
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #createMutationTranslator(SqmDmlStatement, QueryOptions, DomainParameterXref, QueryParameterBindings, LoadQueryInfluencers, SqlAstCreationContext)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
default SqmTranslator<InsertStatement> createInsertTranslator(
|
|
||||||
SqmInsertStatement<?> sqmInsertStatement,
|
|
||||||
QueryOptions queryOptions,
|
|
||||||
DomainParameterXref domainParameterXref,
|
|
||||||
QueryParameterBindings domainParameterBindings,
|
|
||||||
LoadQueryInfluencers loadQueryInfluencers,
|
|
||||||
SqlAstCreationContext creationContext) {
|
|
||||||
//noinspection unchecked
|
|
||||||
return (SqmTranslator<InsertStatement>) createMutationTranslator(
|
|
||||||
sqmInsertStatement,
|
|
||||||
queryOptions,
|
|
||||||
domainParameterXref,
|
|
||||||
domainParameterBindings,
|
|
||||||
loadQueryInfluencers,
|
|
||||||
creationContext
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #createMutationTranslator(SqmDmlStatement, QueryOptions, DomainParameterXref, QueryParameterBindings, LoadQueryInfluencers, SqlAstCreationContext)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true)
|
|
||||||
default SqmTranslator<UpdateStatement> createSimpleUpdateTranslator(
|
|
||||||
SqmUpdateStatement<?> sqmUpdateStatement,
|
|
||||||
QueryOptions queryOptions,
|
|
||||||
DomainParameterXref domainParameterXref,
|
|
||||||
QueryParameterBindings domainParameterBindings,
|
|
||||||
LoadQueryInfluencers loadQueryInfluencers,
|
|
||||||
SqlAstCreationContext creationContext) {
|
|
||||||
//noinspection unchecked
|
|
||||||
return (SqmTranslator<UpdateStatement>) createMutationTranslator(
|
|
||||||
sqmUpdateStatement,
|
|
||||||
queryOptions,
|
|
||||||
domainParameterXref,
|
|
||||||
domainParameterBindings,
|
|
||||||
loadQueryInfluencers,
|
|
||||||
creationContext
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,16 +12,10 @@ import org.hibernate.query.spi.QueryParameterBindings;
|
||||||
import org.hibernate.query.sqm.internal.DomainParameterXref;
|
import org.hibernate.query.sqm.internal.DomainParameterXref;
|
||||||
import org.hibernate.query.sqm.sql.internal.StandardSqmTranslator;
|
import org.hibernate.query.sqm.sql.internal.StandardSqmTranslator;
|
||||||
import org.hibernate.query.sqm.tree.SqmDmlStatement;
|
import org.hibernate.query.sqm.tree.SqmDmlStatement;
|
||||||
import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement;
|
|
||||||
import org.hibernate.query.sqm.tree.insert.SqmInsertStatement;
|
|
||||||
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
|
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
|
||||||
import org.hibernate.query.sqm.tree.update.SqmUpdateStatement;
|
|
||||||
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
|
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
|
||||||
import org.hibernate.sql.ast.tree.MutationStatement;
|
import org.hibernate.sql.ast.tree.MutationStatement;
|
||||||
import org.hibernate.sql.ast.tree.delete.DeleteStatement;
|
|
||||||
import org.hibernate.sql.ast.tree.insert.InsertStatement;
|
|
||||||
import org.hibernate.sql.ast.tree.select.SelectStatement;
|
import org.hibernate.sql.ast.tree.select.SelectStatement;
|
||||||
import org.hibernate.sql.ast.tree.update.UpdateStatement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard implementation of the SqmTranslatorFactory
|
* Standard implementation of the SqmTranslatorFactory
|
||||||
|
@ -68,61 +62,4 @@ public class StandardSqmTranslatorFactory implements SqmTranslatorFactory {
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SqmTranslator<DeleteStatement> createSimpleDeleteTranslator(
|
|
||||||
SqmDeleteStatement<?> sqmDeleteStatement,
|
|
||||||
QueryOptions queryOptions,
|
|
||||||
DomainParameterXref domainParameterXref,
|
|
||||||
QueryParameterBindings domainParameterBindings,
|
|
||||||
LoadQueryInfluencers loadQueryInfluencers,
|
|
||||||
SqlAstCreationContext creationContext) {
|
|
||||||
return new StandardSqmTranslator<>(
|
|
||||||
sqmDeleteStatement,
|
|
||||||
queryOptions,
|
|
||||||
domainParameterXref,
|
|
||||||
domainParameterBindings,
|
|
||||||
loadQueryInfluencers,
|
|
||||||
creationContext,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SqmTranslator<InsertStatement> createInsertTranslator(
|
|
||||||
SqmInsertStatement<?> sqmInsertStatement,
|
|
||||||
QueryOptions queryOptions,
|
|
||||||
DomainParameterXref domainParameterXref,
|
|
||||||
QueryParameterBindings domainParameterBindings,
|
|
||||||
LoadQueryInfluencers loadQueryInfluencers,
|
|
||||||
SqlAstCreationContext creationContext) {
|
|
||||||
return new StandardSqmTranslator<>(
|
|
||||||
sqmInsertStatement,
|
|
||||||
queryOptions,
|
|
||||||
domainParameterXref,
|
|
||||||
domainParameterBindings,
|
|
||||||
loadQueryInfluencers,
|
|
||||||
creationContext,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SqmTranslator<UpdateStatement> createSimpleUpdateTranslator(
|
|
||||||
SqmUpdateStatement<?> sqmUpdateStatement,
|
|
||||||
QueryOptions queryOptions,
|
|
||||||
DomainParameterXref domainParameterXref,
|
|
||||||
QueryParameterBindings domainParameterBindings,
|
|
||||||
LoadQueryInfluencers loadQueryInfluencers,
|
|
||||||
SqlAstCreationContext creationContext) {
|
|
||||||
return new StandardSqmTranslator<>(
|
|
||||||
sqmUpdateStatement,
|
|
||||||
queryOptions,
|
|
||||||
domainParameterXref,
|
|
||||||
domainParameterBindings,
|
|
||||||
loadQueryInfluencers,
|
|
||||||
creationContext,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue