expressable -> expressible everywhere
This commit is contained in:
parent
23324318fd
commit
3c77ab5f69
|
@ -5,7 +5,7 @@ no references to tables, columns, etc. The base contract for Hibernate's extens
|
||||||
JPA model is `org.hibernate.metamodel.model.domain.DomainType`.
|
JPA model is `org.hibernate.metamodel.model.domain.DomainType`.
|
||||||
|
|
||||||
Hibernate's Semantic Query Model (SQM) is defined in terms of these JPA type extensions,
|
Hibernate's Semantic Query Model (SQM) is defined in terms of these JPA type extensions,
|
||||||
through the `org.hibernate.query.sqm.SqmExpressable` contract, allowing parts of the application's
|
through the `SqmExpressible` contract, allowing parts of the application's
|
||||||
domain model to be used as part of an SQM tree.
|
domain model to be used as part of an SQM tree.
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ interface IdentifiableDomainType
|
||||||
interface EntityDomainType
|
interface EntityDomainType
|
||||||
interface MappedSuperclassDomainType
|
interface MappedSuperclassDomainType
|
||||||
|
|
||||||
interface SqmExpressable
|
interface SqmExpressible
|
||||||
interface SqmPathSource
|
interface SqmPathSource
|
||||||
interface PersistentAttribute
|
interface PersistentAttribute
|
||||||
interface SingularPersistentAttribute
|
interface SingularPersistentAttribute
|
||||||
|
@ -40,8 +40,8 @@ ManagedDomainType <|-- IdentifiableDomainType
|
||||||
IdentifiableDomainType <|-- MappedSuperclassDomainType
|
IdentifiableDomainType <|-- MappedSuperclassDomainType
|
||||||
IdentifiableDomainType <|-- EntityDomainType
|
IdentifiableDomainType <|-- EntityDomainType
|
||||||
|
|
||||||
SqmExpressable <|-- DomainType
|
SqmExpressible <|-- DomainType
|
||||||
SqmExpressable <|-- SqmPathSource
|
SqmExpressible <|-- SqmPathSource
|
||||||
|
|
||||||
SqmPathSource <|-- EntityDomainType
|
SqmPathSource <|-- EntityDomainType
|
||||||
SqmPathSource <|-- PersistentAttribute
|
SqmPathSource <|-- PersistentAttribute
|
||||||
|
|
|
@ -18,7 +18,7 @@ skinparam handwritten true
|
||||||
interface MappingType
|
interface MappingType
|
||||||
interface ManagedMappingType
|
interface ManagedMappingType
|
||||||
|
|
||||||
interface MappingModelExpressable
|
interface MappingModelExpressible
|
||||||
interface ValueMapping
|
interface ValueMapping
|
||||||
interface BasicType
|
interface BasicType
|
||||||
interface ModelPart
|
interface ModelPart
|
||||||
|
@ -32,8 +32,8 @@ MappingType <|-- CollectionMappingType
|
||||||
ManagedMappingType <|-- EmbeddableMappingType
|
ManagedMappingType <|-- EmbeddableMappingType
|
||||||
ManagedMappingType <|-- EntityMappingType
|
ManagedMappingType <|-- EntityMappingType
|
||||||
|
|
||||||
MappingModelExpressable <|-- ValueMapping
|
MappingModelExpressible <|-- ValueMapping
|
||||||
MappingModelExpressable <|-- ModelPart
|
MappingModelExpressible <|-- ModelPart
|
||||||
|
|
||||||
ValueMapping <|-- BasicType
|
ValueMapping <|-- BasicType
|
||||||
|
|
||||||
|
@ -68,5 +68,5 @@ EntityIdentifierMapping::EntityIdentifierDefinition
|
||||||
|
|
||||||
AT some point this needs to be "resolved" to a ValueMapping/Type/Bindable when generating the SQL AST and executing.
|
AT some point this needs to be "resolved" to a ValueMapping/Type/Bindable when generating the SQL AST and executing.
|
||||||
|
|
||||||
One option is to have the `BindableType` be resolved first to a `SqmExpressable`
|
One option is to have the `BindableType` be resolved first to a `SqmExpressible`
|
||||||
`SqmExpressableAllowableParameterType#resolveSqmExpressable`
|
`SqmExpressibleAllowableParameterType#resolveSqmExpressible`
|
|
@ -109,7 +109,7 @@ import org.hibernate.mapping.Index;
|
||||||
import org.hibernate.mapping.Table;
|
import org.hibernate.mapping.Table;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.SqlExpressable;
|
import org.hibernate.metamodel.mapping.SqlExpressible;
|
||||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||||
import org.hibernate.persister.entity.Lockable;
|
import org.hibernate.persister.entity.Lockable;
|
||||||
import org.hibernate.procedure.internal.StandardCallableStatementSupport;
|
import org.hibernate.procedure.internal.StandardCallableStatementSupport;
|
||||||
|
@ -1421,12 +1421,12 @@ public abstract class Dialect implements ConversionContext {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the database type appropriate for casting operations
|
* Get the name of the database type appropriate for casting operations
|
||||||
* (via the CAST() SQL function) for the given {@link SqlExpressable}
|
* (via the CAST() SQL function) for the given {@link SqlExpressible}
|
||||||
* SQL type.
|
* SQL type.
|
||||||
*
|
*
|
||||||
* @return The database type name
|
* @return The database type name
|
||||||
*/
|
*/
|
||||||
public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) {
|
public String getCastTypeName(SqlExpressible type, Long length, Integer precision, Integer scale) {
|
||||||
final JdbcMapping jdbcMapping = type.getJdbcMapping();
|
final JdbcMapping jdbcMapping = type.getJdbcMapping();
|
||||||
final JdbcType jdbcType = jdbcMapping.getJdbcType();
|
final JdbcType jdbcType = jdbcMapping.getJdbcType();
|
||||||
final JavaType<?> javaType = jdbcMapping.getJavaTypeDescriptor();
|
final JavaType<?> javaType = jdbcMapping.getJavaTypeDescriptor();
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.hibernate.exception.spi.ViolatedConstraintNameExtractor;
|
||||||
import org.hibernate.internal.util.JdbcExceptionHelper;
|
import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.SqlExpressable;
|
import org.hibernate.metamodel.mapping.SqlExpressible;
|
||||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||||
import org.hibernate.query.sqm.CastType;
|
import org.hibernate.query.sqm.CastType;
|
||||||
import org.hibernate.query.sqm.IntervalType;
|
import org.hibernate.query.sqm.IntervalType;
|
||||||
|
@ -806,7 +806,7 @@ public class MySQLDialect extends Dialect {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) {
|
public String getCastTypeName(SqlExpressible type, Long length, Integer precision, Integer scale) {
|
||||||
final JdbcMapping jdbcMapping = type.getJdbcMapping();
|
final JdbcMapping jdbcMapping = type.getJdbcMapping();
|
||||||
final JdbcType jdbcType = jdbcMapping.getJdbcType();
|
final JdbcType jdbcType = jdbcMapping.getJdbcType();
|
||||||
final JavaType<?> javaType = jdbcMapping.getJavaTypeDescriptor();
|
final JavaType<?> javaType = jdbcMapping.getJavaTypeDescriptor();
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.hibernate.mapping.Constraint;
|
||||||
import org.hibernate.mapping.ForeignKey;
|
import org.hibernate.mapping.ForeignKey;
|
||||||
import org.hibernate.mapping.Table;
|
import org.hibernate.mapping.Table;
|
||||||
import org.hibernate.mapping.UniqueKey;
|
import org.hibernate.mapping.UniqueKey;
|
||||||
import org.hibernate.metamodel.mapping.SqlExpressable;
|
import org.hibernate.metamodel.mapping.SqlExpressible;
|
||||||
import org.hibernate.persister.entity.Lockable;
|
import org.hibernate.persister.entity.Lockable;
|
||||||
import org.hibernate.query.sqm.IntervalType;
|
import org.hibernate.query.sqm.IntervalType;
|
||||||
import org.hibernate.query.SemanticException;
|
import org.hibernate.query.SemanticException;
|
||||||
|
@ -799,7 +799,7 @@ public class SpannerDialect extends Dialect {
|
||||||
/* Type conversion and casting */
|
/* Type conversion and casting */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCastTypeName(SqlExpressable type, Long length, Integer precision, Integer scale) {
|
public String getCastTypeName(SqlExpressible type, Long length, Integer precision, Integer scale) {
|
||||||
//Spanner doesn't let you specify a length in cast() types
|
//Spanner doesn't let you specify a length in cast() types
|
||||||
return super.getRawTypeName( type.getJdbcMapping().getJdbcType() );
|
return super.getRawTypeName( type.getJdbcMapping().getJdbcType() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class TimestampaddFunction
|
||||||
? BinaryArithmeticOperator.MULTIPLY
|
? BinaryArithmeticOperator.MULTIPLY
|
||||||
: BinaryArithmeticOperator.DIVIDE,
|
: BinaryArithmeticOperator.DIVIDE,
|
||||||
new QueryLiteral<>(
|
new QueryLiteral<>(
|
||||||
expressionType.getExpressableJavaType()
|
expressionType.getExpressibleJavaType()
|
||||||
.fromString( conversionFactor.substring( 1 ) ),
|
.fromString( conversionFactor.substring( 1 ) ),
|
||||||
expressionType
|
expressionType
|
||||||
),
|
),
|
||||||
|
|
|
@ -12,26 +12,26 @@ import java.util.function.Function;
|
||||||
|
|
||||||
import org.hibernate.Incubating;
|
import org.hibernate.Incubating;
|
||||||
import org.hibernate.graph.RootGraph;
|
import org.hibernate.graph.RootGraph;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||||
import org.hibernate.metamodel.model.domain.NavigableRole;
|
import org.hibernate.metamodel.model.domain.NavigableRole;
|
||||||
import org.hibernate.persister.collection.CollectionPersister;
|
import org.hibernate.persister.collection.CollectionPersister;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.query.spi.NavigablePath;
|
import org.hibernate.query.spi.NavigablePath;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access to information about Hibernate's runtime relational mapping model
|
* Access to information about the runtime relational O/R mapping model
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@Incubating
|
@Incubating
|
||||||
public interface MappingMetamodel {
|
public interface MappingMetamodel {
|
||||||
/**
|
/**
|
||||||
* The TypeConfiguration this metamodel is associated with
|
* The {@link TypeConfiguration} this metamodel is associated with
|
||||||
*/
|
*/
|
||||||
TypeConfiguration getTypeConfiguration();
|
TypeConfiguration getTypeConfiguration();
|
||||||
|
|
||||||
|
@ -41,8 +41,14 @@ public interface MappingMetamodel {
|
||||||
/**
|
/**
|
||||||
* todo (6.0) : POC!!! Intended for use in SQM -> SQL translation
|
* todo (6.0) : POC!!! Intended for use in SQM -> SQL translation
|
||||||
*/
|
*/
|
||||||
MappingModelExpressable<?> resolveMappingExpressable(SqmExpressable<?> sqmExpressable, Function<NavigablePath, TableGroup> tableGroupLocator);
|
MappingModelExpressible<?> resolveMappingExpressible(
|
||||||
MappingModelExpressable<?> lenientlyResolveMappingExpressable(SqmExpressable<?> sqmExpressable, Function<NavigablePath, TableGroup> tableGroupLocator);
|
SqmExpressible<?> sqmExpressible,
|
||||||
|
Function<NavigablePath,
|
||||||
|
TableGroup> tableGroupLocator);
|
||||||
|
|
||||||
|
MappingModelExpressible<?> lenientlyResolveMappingExpressible(
|
||||||
|
SqmExpressible<?> sqmExpressible,
|
||||||
|
Function<NavigablePath, TableGroup> tableGroupLocator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a Java type, determine the corresponding BindableType to
|
* Given a Java type, determine the corresponding BindableType to
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface BasicValuedMapping extends ValueMapping, SqlExpressable {
|
public interface BasicValuedMapping extends ValueMapping, SqlExpressible {
|
||||||
@Override
|
@Override
|
||||||
default int getJdbcTypeCount() {
|
default int getJdbcTypeCount() {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
package org.hibernate.metamodel.mapping;
|
package org.hibernate.metamodel.mapping;
|
||||||
|
|
||||||
import org.hibernate.sql.results.graph.Fetchable;
|
import org.hibernate.sql.results.graph.Fetchable;
|
||||||
import org.hibernate.type.descriptor.java.JavaTypedExpressable;
|
import org.hibernate.type.descriptor.java.JavaTypedExpressible;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface CollectionPart extends ModelPart, Fetchable, JavaTypedExpressable {
|
public interface CollectionPart extends ModelPart, Fetchable, JavaTypedExpressible {
|
||||||
enum Nature {
|
enum Nature {
|
||||||
ELEMENT( "{element}" ),
|
ELEMENT( "{element}" ),
|
||||||
INDEX( "{index}" ),
|
INDEX( "{index}" ),
|
||||||
|
|
|
@ -24,13 +24,13 @@ import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||||
public interface JdbcMapping extends MappingType, JdbcMappingContainer {
|
public interface JdbcMapping extends MappingType, JdbcMappingContainer {
|
||||||
/**
|
/**
|
||||||
* The descriptor for the Java type represented by this
|
* The descriptor for the Java type represented by this
|
||||||
* expressable type
|
* expressible type
|
||||||
*/
|
*/
|
||||||
JavaType getJavaTypeDescriptor();
|
JavaType getJavaTypeDescriptor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The descriptor for the SQL type represented by this
|
* The descriptor for the SQL type represented by this
|
||||||
* expressable type
|
* expressible type
|
||||||
*/
|
*/
|
||||||
JdbcType getJdbcType();
|
JdbcType getJdbcType();
|
||||||
|
|
||||||
|
@ -39,19 +39,19 @@ public interface JdbcMapping extends MappingType, JdbcMappingContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The strategy for extracting values of this expressable
|
* The strategy for extracting values of this expressible
|
||||||
* type from JDBC ResultSets, CallableStatements, etc
|
* type from JDBC ResultSets, CallableStatements, etc
|
||||||
*/
|
*/
|
||||||
ValueExtractor getJdbcValueExtractor();
|
ValueExtractor<?> getJdbcValueExtractor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The strategy for binding values of this expressable
|
* The strategy for binding values of this expressible type to
|
||||||
* type to JDBC PreparedStatements, CallableStatements, etc
|
* JDBC {@code PreparedStatement}s and {@code CallableStatement}s.
|
||||||
*/
|
*/
|
||||||
ValueBinder getJdbcValueBinder();
|
ValueBinder getJdbcValueBinder();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default JavaType getMappedJavaType() {
|
default JavaType<?> getMappedJavaType() {
|
||||||
return getJavaTypeDescriptor();
|
return getJavaTypeDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
package org.hibernate.metamodel.mapping;
|
package org.hibernate.metamodel.mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Something that can be expressable at the mapping model level.
|
* Something that can be expressible at the mapping model level.
|
||||||
*
|
*
|
||||||
* Generally this is used generation of SQL AST
|
* Generally this is used generation of SQL AST
|
||||||
*
|
*
|
||||||
|
@ -16,5 +16,5 @@ package org.hibernate.metamodel.mapping;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
* @author Andrea Boriero
|
* @author Andrea Boriero
|
||||||
*/
|
*/
|
||||||
public interface MappingModelExpressable<T> extends Bindable {
|
public interface MappingModelExpressible<T> extends Bindable {
|
||||||
}
|
}
|
|
@ -28,7 +28,7 @@ import org.hibernate.type.descriptor.java.JavaType;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface ModelPart extends MappingModelExpressable {
|
public interface ModelPart extends MappingModelExpressible {
|
||||||
MappingType getPartMappingType();
|
MappingType getPartMappingType();
|
||||||
|
|
||||||
JavaType<?> getJavaType();
|
JavaType<?> getJavaType();
|
||||||
|
|
|
@ -14,9 +14,9 @@ package org.hibernate.metamodel.mapping;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface SqlExpressable extends JdbcMappingContainer {
|
public interface SqlExpressible extends JdbcMappingContainer {
|
||||||
/**
|
/**
|
||||||
* Any thing that is expressable at the SQL AST level
|
* Anything that is expressible at the SQL AST level
|
||||||
* would be of basic type.
|
* would be of basic type.
|
||||||
*/
|
*/
|
||||||
JdbcMapping getJdbcMapping();
|
JdbcMapping getJdbcMapping();
|
|
@ -9,7 +9,7 @@ package org.hibernate.metamodel.mapping;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.descriptor.java.JavaTypedExpressable;
|
import org.hibernate.type.descriptor.java.JavaTypedExpressible;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a mapping related to any part of the app's domain model - e.g.
|
* Describes a mapping related to any part of the app's domain model - e.g.
|
||||||
|
@ -21,14 +21,14 @@ import org.hibernate.type.descriptor.java.JavaTypedExpressable;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface ValueMapping extends MappingModelExpressable, JavaTypedExpressable {
|
public interface ValueMapping extends MappingModelExpressible, JavaTypedExpressible {
|
||||||
/**
|
/**
|
||||||
* Descriptor for the type of this mapping
|
* Descriptor for the type of this mapping
|
||||||
*/
|
*/
|
||||||
MappingType getMappedType();
|
MappingType getMappedType();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default JavaType<?> getExpressableJavaType() {
|
default JavaType<?> getExpressibleJavaType() {
|
||||||
return getMappedType().getMappedJavaType();
|
return getMappedType().getMappedJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ public class BasicEntityIdentifierMappingImpl implements BasicEntityIdentifierMa
|
||||||
|
|
||||||
return expressionResolver.resolveSqlSelection(
|
return expressionResolver.resolveSqlSelection(
|
||||||
expression,
|
expression,
|
||||||
idType.getExpressableJavaType(),
|
idType.getExpressibleJavaType(),
|
||||||
sessionFactory.getTypeConfiguration()
|
sessionFactory.getTypeConfiguration()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class DiscriminatedCollectionPart implements DiscriminatedAssociationMode
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<?> getExpressableJavaType() {
|
public JavaType<?> getExpressibleJavaType() {
|
||||||
return getJavaType();
|
return getJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ public class EmbeddedCollectionPart implements CollectionPart, EmbeddableValuedF
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<?> getExpressableJavaType() {
|
public JavaType<?> getExpressibleJavaType() {
|
||||||
return getJavaType();
|
return getJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,7 @@ public class EntityCollectionPart
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<?> getExpressableJavaType() {
|
public JavaType<?> getExpressibleJavaType() {
|
||||||
return getJavaType();
|
return getJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class IdClassEmbeddable extends AbstractEmbeddableMapping implements Iden
|
||||||
if ( o == null ) {
|
if ( o == null ) {
|
||||||
final AttributeMapping idClassAttributeMapping = idClassAttribute.get( i );
|
final AttributeMapping idClassAttributeMapping = idClassAttribute.get( i );
|
||||||
if ( idClassAttributeMapping.getPropertyAccess().getGetter().getReturnTypeClass().isPrimitive() ) {
|
if ( idClassAttributeMapping.getPropertyAccess().getGetter().getReturnTypeClass().isPrimitive() ) {
|
||||||
propertyValues[i] = idClassAttributeMapping.getExpressableJavaType().getDefaultValue();
|
propertyValues[i] = idClassAttributeMapping.getExpressibleJavaType().getDefaultValue();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
propertyValues[i] = null;
|
propertyValues[i] = null;
|
||||||
|
|
|
@ -216,7 +216,7 @@ public class NonAggregatedIdentifierMappingImpl extends AbstractCompositeIdentif
|
||||||
if ( o == null ) {
|
if ( o == null ) {
|
||||||
final AttributeMapping idClassAttributeMapping = idClassAttributeMappings.get( i );
|
final AttributeMapping idClassAttributeMapping = idClassAttributeMappings.get( i );
|
||||||
if ( idClassAttributeMapping.getPropertyAccess().getGetter().getReturnTypeClass().isPrimitive() ) {
|
if ( idClassAttributeMapping.getPropertyAccess().getGetter().getReturnTypeClass().isPrimitive() ) {
|
||||||
propertyValues[i] = idClassAttributeMapping.getExpressableJavaType().getDefaultValue();
|
propertyValues[i] = idClassAttributeMapping.getExpressibleJavaType().getDefaultValue();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
propertyValues[i] = null;
|
propertyValues[i] = null;
|
||||||
|
|
|
@ -25,13 +25,13 @@ public abstract class AbstractDomainType<J> implements SimpleDomainType<J> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<J> getExpressableJavaType() {
|
public JavaType<J> getExpressibleJavaType() {
|
||||||
return javaType;
|
return javaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<J> getJavaType() {
|
public Class<J> getJavaType() {
|
||||||
return this.getExpressableJavaType().getJavaTypeClass();
|
return this.getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,7 +12,7 @@ import jakarta.persistence.metamodel.BasicType;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.query.ReturnableType;
|
import org.hibernate.query.ReturnableType;
|
||||||
import org.hibernate.query.OutputableType;
|
import org.hibernate.query.OutputableType;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hibernate extension to the JPA {@link BasicType} contract.
|
* Hibernate extension to the JPA {@link BasicType} contract.
|
||||||
|
@ -20,7 +20,7 @@ import org.hibernate.query.sqm.SqmExpressable;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface BasicDomainType<J>
|
public interface BasicDomainType<J>
|
||||||
extends SimpleDomainType<J>, BasicType<J>, SqmExpressable<J>, OutputableType<J>, ReturnableType<J> {
|
extends SimpleDomainType<J>, BasicType<J>, SqmExpressible<J>, OutputableType<J>, ReturnableType<J> {
|
||||||
@Override
|
@Override
|
||||||
default PersistenceType getPersistenceType() {
|
default PersistenceType getPersistenceType() {
|
||||||
return PersistenceType.BASIC;
|
return PersistenceType.BASIC;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.metamodel.model.domain;
|
package org.hibernate.metamodel.model.domain;
|
||||||
|
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +25,7 @@ import org.hibernate.type.descriptor.java.JavaType;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface DomainType<J> extends SqmExpressable<J> {
|
public interface DomainType<J> extends SqmExpressible<J> {
|
||||||
/**
|
/**
|
||||||
* The name of the type.
|
* The name of the type.
|
||||||
*
|
*
|
||||||
|
@ -35,7 +35,7 @@ public interface DomainType<J> extends SqmExpressable<J> {
|
||||||
*/
|
*/
|
||||||
default String getTypeName() {
|
default String getTypeName() {
|
||||||
// default impl to handle the general case returning the Java type name
|
// default impl to handle the general case returning the Java type name
|
||||||
return getExpressableJavaType().getJavaType().getTypeName();
|
return getExpressibleJavaType().getJavaType().getTypeName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,5 +44,5 @@ public interface DomainType<J> extends SqmExpressable<J> {
|
||||||
*
|
*
|
||||||
* @see #getTypeName
|
* @see #getTypeName
|
||||||
*/
|
*/
|
||||||
JavaType<J> getExpressableJavaType();
|
JavaType<J> getExpressibleJavaType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
package org.hibernate.metamodel.model.domain;
|
package org.hibernate.metamodel.model.domain;
|
||||||
|
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
|
|
||||||
import jakarta.persistence.metamodel.EmbeddableType;
|
import jakarta.persistence.metamodel.EmbeddableType;
|
||||||
|
|
||||||
|
@ -20,5 +20,5 @@ import jakarta.persistence.metamodel.EmbeddableType;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface EmbeddableDomainType<J>
|
public interface EmbeddableDomainType<J>
|
||||||
extends ManagedDomainType<J>, EmbeddableType<J>, BindableType<J>, SqmExpressable<J> {
|
extends ManagedDomainType<J>, EmbeddableType<J>, BindableType<J>, SqmExpressible<J> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.function.Consumer;
|
||||||
|
|
||||||
import org.hibernate.graph.spi.SubGraphImplementor;
|
import org.hibernate.graph.spi.SubGraphImplementor;
|
||||||
import org.hibernate.metamodel.RepresentationMode;
|
import org.hibernate.metamodel.RepresentationMode;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
|
|
||||||
import jakarta.persistence.metamodel.ManagedType;
|
import jakarta.persistence.metamodel.ManagedType;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import jakarta.persistence.metamodel.ManagedType;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface ManagedDomainType<J> extends SqmExpressable<J>, DomainType<J>, ManagedType<J> {
|
public interface ManagedDomainType<J> extends SqmExpressible<J>, DomainType<J>, ManagedType<J> {
|
||||||
/**
|
/**
|
||||||
* Get the type name.
|
* Get the type name.
|
||||||
*
|
*
|
||||||
|
|
|
@ -8,19 +8,19 @@ package org.hibernate.metamodel.model.domain;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes any structural type without a direct java type representation.
|
* Describes any structural type without a direct java type representation.
|
||||||
*
|
*
|
||||||
* @author Christian Beikov
|
* @author Christian Beikov
|
||||||
*/
|
*/
|
||||||
public interface TupleType<J> extends SqmExpressable<J> {
|
public interface TupleType<J> extends SqmExpressible<J> {
|
||||||
|
|
||||||
int componentCount();
|
int componentCount();
|
||||||
String getComponentName(int index);
|
String getComponentName(int index);
|
||||||
List<String> getComponentNames();
|
List<String> getComponentNames();
|
||||||
|
|
||||||
SqmExpressable<?> get(int index);
|
SqmExpressible<?> get(int index);
|
||||||
SqmExpressable<?> get(String componentName);
|
SqmExpressible<?> get(String componentName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,8 @@ public abstract class AbstractPluralAttribute<D, C, E>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<E> getExpressableJavaType() {
|
public JavaType<E> getExpressibleJavaType() {
|
||||||
return getElementType().getExpressableJavaType();
|
return getElementType().getExpressibleJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -48,7 +48,7 @@ public abstract class AbstractSqmPathSource<J> implements SqmPathSource<J> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<J> getExpressableJavaType() {
|
public JavaType<J> getExpressibleJavaType() {
|
||||||
return domainType.getExpressableJavaType();
|
return domainType.getExpressibleJavaType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class AnyMappingDomainTypeImpl<T> implements AnyMappingDomainType<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<T> getExpressableJavaType() {
|
public JavaType<T> getExpressibleJavaType() {
|
||||||
return baseJtd;
|
return baseJtd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.mapping.IndexedConsumer;
|
import org.hibernate.mapping.IndexedConsumer;
|
||||||
import org.hibernate.metamodel.UnsupportedMappingException;
|
import org.hibernate.metamodel.UnsupportedMappingException;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.ReturnableType;
|
import org.hibernate.query.ReturnableType;
|
||||||
import org.hibernate.metamodel.model.domain.TupleType;
|
import org.hibernate.metamodel.model.domain.TupleType;
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.sql.ast.Clause;
|
import org.hibernate.sql.ast.Clause;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.descriptor.java.ObjectArrayJavaType;
|
import org.hibernate.type.descriptor.java.ObjectArrayJavaType;
|
||||||
|
@ -29,20 +29,20 @@ import org.hibernate.type.descriptor.java.ObjectArrayJavaType;
|
||||||
public class ArrayTupleType implements TupleType<Object[]>,
|
public class ArrayTupleType implements TupleType<Object[]>,
|
||||||
BindableType<Object[]>,
|
BindableType<Object[]>,
|
||||||
ReturnableType<Object[]>,
|
ReturnableType<Object[]>,
|
||||||
MappingModelExpressable<Object[]> {
|
MappingModelExpressible<Object[]> {
|
||||||
|
|
||||||
private final ObjectArrayJavaType javaType;
|
private final ObjectArrayJavaType javaType;
|
||||||
private final SqmExpressable<?>[] components;
|
private final SqmExpressible<?>[] components;
|
||||||
|
|
||||||
public ArrayTupleType(SqmExpressable<?>[] components) {
|
public ArrayTupleType(SqmExpressible<?>[] components) {
|
||||||
this.components = components;
|
this.components = components;
|
||||||
this.javaType = new ObjectArrayJavaType( getTypeDescriptors( components ) );
|
this.javaType = new ObjectArrayJavaType( getTypeDescriptors( components ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static JavaType<?>[] getTypeDescriptors(SqmExpressable<?>[] components) {
|
private static JavaType<?>[] getTypeDescriptors(SqmExpressible<?>[] components) {
|
||||||
final JavaType<?>[] typeDescriptors = new JavaType<?>[components.length];
|
final JavaType<?>[] typeDescriptors = new JavaType<?>[components.length];
|
||||||
for ( int i = 0; i < components.length; i++ ) {
|
for ( int i = 0; i < components.length; i++ ) {
|
||||||
typeDescriptors[i] = components[i].getExpressableJavaType();
|
typeDescriptors[i] = components[i].getExpressibleJavaType();
|
||||||
}
|
}
|
||||||
return typeDescriptors;
|
return typeDescriptors;
|
||||||
}
|
}
|
||||||
|
@ -63,17 +63,17 @@ public class ArrayTupleType implements TupleType<Object[]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmExpressable<?> get(int index) {
|
public SqmExpressible<?> get(int index) {
|
||||||
return components[index];
|
return components[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmExpressable<?> get(String componentName) {
|
public SqmExpressible<?> get(String componentName) {
|
||||||
throw new UnsupportedMappingException( "Array tuple has no component names" );
|
throw new UnsupportedMappingException( "Array tuple has no component names" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<Object[]> getExpressableJavaType() {
|
public JavaType<Object[]> getExpressibleJavaType() {
|
||||||
return javaType;
|
return javaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class ArrayTupleType implements TupleType<Object[]>,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Object[]> getJavaType() {
|
public Class<Object[]> getJavaType() {
|
||||||
return getExpressableJavaType().getJavaTypeClass();
|
return this.getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class BasicSqmPathSource<J>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<J> getJavaType() {
|
public Class<J> getJavaType() {
|
||||||
return getExpressableJavaType().getJavaTypeClass();
|
return getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,12 +31,12 @@ public class BasicTypeImpl<J> implements BasicDomainType<J>, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<J> getExpressableJavaType() {
|
public JavaType<J> getExpressibleJavaType() {
|
||||||
return javaType;
|
return javaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<J> getJavaType() {
|
public Class<J> getJavaType() {
|
||||||
return getExpressableJavaType().getJavaTypeClass();
|
return this.getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -59,6 +59,6 @@ public class DiscriminatorSqmPathSource<D> extends AbstractSqmPathSource<D>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<D> getJavaType() {
|
public Class<D> getJavaType() {
|
||||||
return getExpressableJavaType().getJavaTypeClass();
|
return getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,7 +505,7 @@ public class JpaMetamodelImpl implements JpaMetamodel, Serializable {
|
||||||
if ( embeddable.getJavaType() != null && embeddable.getJavaType() != Map.class ) {
|
if ( embeddable.getJavaType() != null && embeddable.getJavaType() != Map.class ) {
|
||||||
this.jpaEmbeddables.add( embeddable );
|
this.jpaEmbeddables.add( embeddable );
|
||||||
this.jpaManagedTypes.add( embeddable );
|
this.jpaManagedTypes.add( embeddable );
|
||||||
if ( !( embeddable.getExpressableJavaType() instanceof EntityJavaType<?> ) ) {
|
if ( !( embeddable.getExpressibleJavaType() instanceof EntityJavaType<?> ) ) {
|
||||||
this.jpaManagedTypeMap.put( embeddable.getJavaType(), embeddable );
|
this.jpaManagedTypeMap.put( embeddable.getJavaType(), embeddable );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ public class JpaMetamodelImpl implements JpaMetamodel, Serializable {
|
||||||
this.jpaEmbeddables.add( embeddable );
|
this.jpaEmbeddables.add( embeddable );
|
||||||
this.jpaManagedTypes.add( embeddable );
|
this.jpaManagedTypes.add( embeddable );
|
||||||
if ( embeddable.getJavaType() != null
|
if ( embeddable.getJavaType() != null
|
||||||
&& !( embeddable.getExpressableJavaType() instanceof EntityJavaType<?> ) ) {
|
&& !( embeddable.getExpressibleJavaType() instanceof EntityJavaType<?> ) ) {
|
||||||
this.jpaManagedTypeMap.put( embeddable.getJavaType(), embeddable );
|
this.jpaManagedTypeMap.put( embeddable.getJavaType(), embeddable );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -522,7 +522,7 @@ public class JpaMetamodelImpl implements JpaMetamodel, Serializable {
|
||||||
if ( embeddable.getJavaType() == null ) {
|
if ( embeddable.getJavaType() == null ) {
|
||||||
throw new UnsupportedOperationException( "ANY not supported" );
|
throw new UnsupportedOperationException( "ANY not supported" );
|
||||||
}
|
}
|
||||||
if ( !( embeddable.getExpressableJavaType() instanceof EntityJavaType<?> ) ) {
|
if ( !( embeddable.getExpressibleJavaType() instanceof EntityJavaType<?> ) ) {
|
||||||
this.jpaManagedTypeMap.put( embeddable.getJavaType(), embeddable );
|
this.jpaManagedTypeMap.put( embeddable.getJavaType(), embeddable );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -48,7 +48,7 @@ import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.metamodel.MappingMetamodel;
|
import org.hibernate.metamodel.MappingMetamodel;
|
||||||
import org.hibernate.metamodel.internal.JpaMetaModelPopulationSetting;
|
import org.hibernate.metamodel.internal.JpaMetaModelPopulationSetting;
|
||||||
import org.hibernate.metamodel.internal.JpaStaticMetaModelPopulationSetting;
|
import org.hibernate.metamodel.internal.JpaStaticMetaModelPopulationSetting;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
|
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
|
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
|
||||||
|
@ -65,7 +65,7 @@ import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.persister.entity.Queryable;
|
import org.hibernate.persister.entity.Queryable;
|
||||||
import org.hibernate.persister.spi.PersisterFactory;
|
import org.hibernate.persister.spi.PersisterFactory;
|
||||||
import org.hibernate.query.spi.NavigablePath;
|
import org.hibernate.query.spi.NavigablePath;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmFieldLiteral;
|
import org.hibernate.query.sqm.tree.expression.SqmFieldLiteral;
|
||||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||||
|
@ -155,7 +155,7 @@ public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplemen
|
||||||
private final TypeConfiguration typeConfiguration;
|
private final TypeConfiguration typeConfiguration;
|
||||||
|
|
||||||
private final Map<String, String[]> implementorsCache = new ConcurrentHashMap<>();
|
private final Map<String, String[]> implementorsCache = new ConcurrentHashMap<>();
|
||||||
private final Map<TupleType<?>, MappingModelExpressable<?>> tupleTypeCache = new ConcurrentHashMap<>();
|
private final Map<TupleType<?>, MappingModelExpressible<?>> tupleTypeCache = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public MappingMetamodelImpl(SessionFactoryImplementor sessionFactory, TypeConfiguration typeConfiguration) {
|
public MappingMetamodelImpl(SessionFactoryImplementor sessionFactory, TypeConfiguration typeConfiguration) {
|
||||||
this.sessionFactory = sessionFactory;
|
this.sessionFactory = sessionFactory;
|
||||||
|
@ -745,16 +745,16 @@ public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplemen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingModelExpressable<?> lenientlyResolveMappingExpressable(
|
public MappingModelExpressible<?> lenientlyResolveMappingExpressible(
|
||||||
SqmExpressable<?> sqmExpressable,
|
SqmExpressible<?> sqmExpressible,
|
||||||
Function<NavigablePath, TableGroup> tableGroupLocator) {
|
Function<NavigablePath, TableGroup> tableGroupLocator) {
|
||||||
return resolveMappingExpressable( sqmExpressable, tableGroupLocator );
|
return resolveMappingExpressible(sqmExpressible, tableGroupLocator );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingModelExpressable<?> resolveMappingExpressable(SqmExpressable<?> sqmExpressable, Function<NavigablePath, TableGroup> tableGroupLocator) {
|
public MappingModelExpressible<?> resolveMappingExpressible(SqmExpressible<?> sqmExpressible, Function<NavigablePath, TableGroup> tableGroupLocator) {
|
||||||
if ( sqmExpressable instanceof SqmPath ) {
|
if ( sqmExpressible instanceof SqmPath ) {
|
||||||
final SqmPath<?> sqmPath = (SqmPath<?>) sqmExpressable;
|
final SqmPath<?> sqmPath = (SqmPath<?>) sqmExpressible;
|
||||||
final NavigablePath navigablePath = sqmPath.getNavigablePath();
|
final NavigablePath navigablePath = sqmPath.getNavigablePath();
|
||||||
if ( navigablePath.getParent() != null ) {
|
if ( navigablePath.getParent() != null ) {
|
||||||
final TableGroup parentTableGroup = tableGroupLocator.apply( navigablePath.getParent() );
|
final TableGroup parentTableGroup = tableGroupLocator.apply( navigablePath.getParent() );
|
||||||
|
@ -763,48 +763,48 @@ public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplemen
|
||||||
return tableGroupLocator.apply( navigablePath.getParent() ).getModelPart();
|
return tableGroupLocator.apply( navigablePath.getParent() ).getModelPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sqmExpressable instanceof BasicType<?> ) {
|
if ( sqmExpressible instanceof BasicType<?> ) {
|
||||||
return (BasicType<?>) sqmExpressable;
|
return (BasicType<?>) sqmExpressible;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sqmExpressable instanceof BasicSqmPathSource<?> ) {
|
if ( sqmExpressible instanceof BasicSqmPathSource<?> ) {
|
||||||
return getTypeConfiguration().getBasicTypeForJavaType(((BasicSqmPathSource<?>) sqmExpressable).getJavaType());
|
return getTypeConfiguration().getBasicTypeForJavaType(((BasicSqmPathSource<?>) sqmExpressible).getJavaType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sqmExpressable instanceof SqmFieldLiteral ) {
|
if ( sqmExpressible instanceof SqmFieldLiteral ) {
|
||||||
return getTypeConfiguration().getBasicTypeForJavaType( ( (SqmFieldLiteral<?>) sqmExpressable ).getJavaType() );
|
return getTypeConfiguration().getBasicTypeForJavaType( ( (SqmFieldLiteral<?>) sqmExpressible).getJavaType() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sqmExpressable instanceof CompositeSqmPathSource ) {
|
if ( sqmExpressible instanceof CompositeSqmPathSource ) {
|
||||||
throw new NotYetImplementedFor6Exception( "Resolution of embedded-valued SqmExpressable nodes not yet implemented" );
|
throw new NotYetImplementedFor6Exception( "Resolution of embedded-valued SqmExpressible nodes not yet implemented" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sqmExpressable instanceof EmbeddableTypeImpl ) {
|
if ( sqmExpressible instanceof EmbeddableTypeImpl ) {
|
||||||
return (MappingModelExpressable<?>) sqmExpressable;
|
return (MappingModelExpressible<?>) sqmExpressible;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sqmExpressable instanceof EntityDomainType<?> ) {
|
if ( sqmExpressible instanceof EntityDomainType<?> ) {
|
||||||
return getEntityDescriptor( ( (EntityDomainType<?>) sqmExpressable ).getHibernateEntityName() );
|
return getEntityDescriptor( ( (EntityDomainType<?>) sqmExpressible).getHibernateEntityName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sqmExpressable instanceof TupleType<?> ) {
|
if ( sqmExpressible instanceof TupleType<?> ) {
|
||||||
final MappingModelExpressable<?> mappingModelExpressable = tupleTypeCache.get( sqmExpressable );
|
final MappingModelExpressible<?> mappingModelExpressible = tupleTypeCache.get(sqmExpressible);
|
||||||
if ( mappingModelExpressable != null ) {
|
if ( mappingModelExpressible != null ) {
|
||||||
return mappingModelExpressable;
|
return mappingModelExpressible;
|
||||||
}
|
}
|
||||||
final TupleType<?> tupleType = (TupleType<?>) sqmExpressable;
|
final TupleType<?> tupleType = (TupleType<?>) sqmExpressible;
|
||||||
final MappingModelExpressable<?>[] components = new MappingModelExpressable<?>[tupleType.componentCount()];
|
final MappingModelExpressible<?>[] components = new MappingModelExpressible<?>[tupleType.componentCount()];
|
||||||
for ( int i = 0; i < components.length; i++ ) {
|
for ( int i = 0; i < components.length; i++ ) {
|
||||||
components[i] = resolveMappingExpressable( tupleType.get( i ), tableGroupLocator );
|
components[i] = resolveMappingExpressible( tupleType.get( i ), tableGroupLocator );
|
||||||
}
|
}
|
||||||
final MappingModelExpressable<?> createdMappingModelExpressable = new TupleMappingModelExpressable( components );
|
final MappingModelExpressible<?> createdMappingModelExpressible = new TupleMappingModelExpressible( components );
|
||||||
final MappingModelExpressable<?> existingMappingModelExpressable = tupleTypeCache.putIfAbsent(
|
final MappingModelExpressible<?> existingMappingModelExpressible = tupleTypeCache.putIfAbsent(
|
||||||
tupleType,
|
tupleType,
|
||||||
createdMappingModelExpressable
|
createdMappingModelExpressible
|
||||||
);
|
);
|
||||||
return existingMappingModelExpressable == null
|
return existingMappingModelExpressible == null
|
||||||
? createdMappingModelExpressable
|
? createdMappingModelExpressible
|
||||||
: existingMappingModelExpressable;
|
: existingMappingModelExpressible;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class SingularAttributeImpl<D,J>
|
||||||
super(
|
super(
|
||||||
declaringType,
|
declaringType,
|
||||||
name,
|
name,
|
||||||
attributeType.getExpressableJavaType(),
|
attributeType.getExpressibleJavaType(),
|
||||||
attributeClassification,
|
attributeClassification,
|
||||||
attributeType,
|
attributeType,
|
||||||
member,
|
member,
|
||||||
|
@ -81,8 +81,8 @@ public class SingularAttributeImpl<D,J>
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JavaType<J> getExpressableJavaType() {
|
public JavaType<J> getExpressibleJavaType() {
|
||||||
return sqmPathSource.getExpressableJavaType();
|
return sqmPathSource.getExpressibleJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -108,7 +108,7 @@ public class SingularAttributeImpl<D,J>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<J> getBindableJavaType() {
|
public Class<J> getBindableJavaType() {
|
||||||
return getExpressableJavaType().getJavaTypeClass();
|
return getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,18 +9,18 @@ package org.hibernate.metamodel.model.domain.internal;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.mapping.IndexedConsumer;
|
import org.hibernate.mapping.IndexedConsumer;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.sql.ast.Clause;
|
import org.hibernate.sql.ast.Clause;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Christian Beikov
|
* @author Christian Beikov
|
||||||
*/
|
*/
|
||||||
public class TupleMappingModelExpressable implements MappingModelExpressable {
|
public class TupleMappingModelExpressible implements MappingModelExpressible {
|
||||||
|
|
||||||
private final MappingModelExpressable<Object>[] components;
|
private final MappingModelExpressible<Object>[] components;
|
||||||
|
|
||||||
public TupleMappingModelExpressable(MappingModelExpressable<?>[] components) {
|
public TupleMappingModelExpressible(MappingModelExpressible<?>[] components) {
|
||||||
this.components = (MappingModelExpressable<Object>[]) components;
|
this.components = (MappingModelExpressible<Object>[]) components;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -55,7 +55,7 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getReturnedClass() {
|
public Class<?> getReturnedClass() {
|
||||||
return Class.class;
|
return Class.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
|
||||||
Object value,
|
Object value,
|
||||||
int index,
|
int index,
|
||||||
SharedSessionContractImplementor session) throws HibernateException, SQLException {
|
SharedSessionContractImplementor session) throws HibernateException, SQLException {
|
||||||
String entityName = session.getFactory().getClassMetadata((Class) value).getEntityName();
|
String entityName = session.getFactory().getClassMetadata((Class<?>) value).getEntityName();
|
||||||
Loadable entityPersister = (Loadable) session.getFactory().getMetamodel().entityPersister(entityName);
|
Loadable entityPersister = (Loadable) session.getFactory().getMetamodel().entityPersister(entityName);
|
||||||
underlyingType.nullSafeSet(st, entityPersister.getDiscriminatorValue(), index, session);
|
underlyingType.nullSafeSet(st, entityPersister.getDiscriminatorValue(), index, session);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
|
||||||
@Override
|
@Override
|
||||||
public void bind(PreparedStatement st, T value, int index, WrapperOptions options) throws SQLException {
|
public void bind(PreparedStatement st, T value, int index, WrapperOptions options) throws SQLException {
|
||||||
final SessionFactoryImplementor factory = options.getSession().getFactory();
|
final SessionFactoryImplementor factory = options.getSession().getFactory();
|
||||||
final String entityName = factory.getClassMetadata( (Class) value).getEntityName();
|
final String entityName = factory.getClassMetadata( (Class<?>) value).getEntityName();
|
||||||
final Loadable entityPersister = (Loadable) factory.getMetamodel().entityPersister(entityName);
|
final Loadable entityPersister = (Loadable) factory.getMetamodel().entityPersister(entityName);
|
||||||
underlyingType.getJdbcValueBinder().bind( st, entityPersister.getDiscriminatorValue(), index, options );
|
underlyingType.getJdbcValueBinder().bind( st, entityPersister.getDiscriminatorValue(), index, options );
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
|
||||||
@Override
|
@Override
|
||||||
public void bind(CallableStatement st, T value, String name, WrapperOptions options) throws SQLException {
|
public void bind(CallableStatement st, T value, String name, WrapperOptions options) throws SQLException {
|
||||||
final SessionFactoryImplementor factory = options.getSession().getFactory();
|
final SessionFactoryImplementor factory = options.getSession().getFactory();
|
||||||
final String entityName = factory.getClassMetadata( (Class) value).getEntityName();
|
final String entityName = factory.getClassMetadata( (Class<?>) value).getEntityName();
|
||||||
final Loadable entityPersister = (Loadable) factory.getMetamodel().entityPersister(entityName);
|
final Loadable entityPersister = (Loadable) factory.getMetamodel().entityPersister(entityName);
|
||||||
underlyingType.getJdbcValueBinder().bind( st, entityPersister.getDiscriminatorValue(), name, options );
|
underlyingType.getJdbcValueBinder().bind( st, entityPersister.getDiscriminatorValue(), name, options );
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public JavaType<T> getExpressableJavaType() {
|
public JavaType<T> getExpressibleJavaType() {
|
||||||
return (JavaType<T>) (persister.getRepresentationStrategy().getMode() == RepresentationMode.POJO
|
return (JavaType<T>) (persister.getRepresentationStrategy().getMode() == RepresentationMode.POJO
|
||||||
? ClassJavaType.INSTANCE
|
? ClassJavaType.INSTANCE
|
||||||
: StringJavaType.INSTANCE);
|
: StringJavaType.INSTANCE);
|
||||||
|
@ -212,12 +212,12 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<T> getJavaTypeDescriptor() {
|
public JavaType<T> getJavaTypeDescriptor() {
|
||||||
return getExpressableJavaType();
|
return this.getExpressibleJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<T> getMappedJavaType() {
|
public JavaType<T> getMappedJavaType() {
|
||||||
return getExpressableJavaType();
|
return this.getExpressibleJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -58,7 +58,7 @@ import org.hibernate.query.spi.QueryOptionsAdapter;
|
||||||
import org.hibernate.query.spi.QueryParameterBinding;
|
import org.hibernate.query.spi.QueryParameterBinding;
|
||||||
import org.hibernate.query.spi.QueryParameterBindings;
|
import org.hibernate.query.spi.QueryParameterBindings;
|
||||||
import org.hibernate.query.spi.ScrollableResultsImplementor;
|
import org.hibernate.query.spi.ScrollableResultsImplementor;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.result.NoMoreReturnsException;
|
import org.hibernate.result.NoMoreReturnsException;
|
||||||
import org.hibernate.result.Output;
|
import org.hibernate.result.Output;
|
||||||
import org.hibernate.result.ResultSetOutput;
|
import org.hibernate.result.ResultSetOutput;
|
||||||
|
@ -460,21 +460,21 @@ public class ProcedureCallImpl<R>
|
||||||
.getDomainModel()
|
.getDomainModel()
|
||||||
.resolveQueryParameterType( javaType );
|
.resolveQueryParameterType( javaType );
|
||||||
|
|
||||||
final Class<T> expressableJavaType;
|
final Class<T> expressibleJavaType;
|
||||||
if ( parameterType == null ) {
|
if ( parameterType == null ) {
|
||||||
expressableJavaType = null;
|
expressibleJavaType = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final SqmExpressable<T> sqmExpressable = parameterType.resolveExpressable( getSessionFactory() );
|
final SqmExpressible<T> sqmExpressible = parameterType.resolveExpressible( getSessionFactory() );
|
||||||
assert sqmExpressable != null;
|
assert sqmExpressible != null;
|
||||||
|
|
||||||
expressableJavaType = sqmExpressable.getExpressableJavaType().getJavaTypeClass();
|
expressibleJavaType = sqmExpressible.getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
final ProcedureParameterImpl<T> procedureParameter = new ProcedureParameterImpl<>(
|
final ProcedureParameterImpl<T> procedureParameter = new ProcedureParameterImpl<>(
|
||||||
position,
|
position,
|
||||||
mode,
|
mode,
|
||||||
expressableJavaType,
|
expressibleJavaType,
|
||||||
parameterType
|
parameterType
|
||||||
);
|
);
|
||||||
registerParameter( procedureParameter );
|
registerParameter( procedureParameter );
|
||||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.query;
|
||||||
import org.hibernate.Incubating;
|
import org.hibernate.Incubating;
|
||||||
import org.hibernate.NotYetImplementedFor6Exception;
|
import org.hibernate.NotYetImplementedFor6Exception;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
|
|
||||||
import jakarta.persistence.AttributeConverter;
|
import jakarta.persistence.AttributeConverter;
|
||||||
import jakarta.persistence.metamodel.ManagedType;
|
import jakarta.persistence.metamodel.ManagedType;
|
||||||
|
@ -54,9 +54,9 @@ public interface BindableType<J> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve this parameter type to the corresponding SqmExpressable
|
* Resolve this parameter type to the corresponding SqmExpressible
|
||||||
*
|
*
|
||||||
* @todo (6.0) - use SessionFactory (API) here instead - we'll just cast "below"
|
* @todo (6.0) - use SessionFactory (API) here instead - we'll just cast "below"
|
||||||
*/
|
*/
|
||||||
SqmExpressable<J> resolveExpressable(SessionFactoryImplementor sessionFactory);
|
SqmExpressible<J> resolveExpressible(SessionFactoryImplementor sessionFactory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||||
import org.hibernate.query.criteria.JpaSelection;
|
import org.hibernate.query.criteria.JpaSelection;
|
||||||
import org.hibernate.query.hql.HqlInterpretationException;
|
import org.hibernate.query.hql.HqlInterpretationException;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmEnumLiteral;
|
import org.hibernate.query.sqm.tree.expression.SqmEnumLiteral;
|
||||||
|
@ -37,7 +37,7 @@ import org.hibernate.type.descriptor.java.JavaType;
|
||||||
public class FullyQualifiedReflectivePathTerminal
|
public class FullyQualifiedReflectivePathTerminal
|
||||||
extends FullyQualifiedReflectivePath
|
extends FullyQualifiedReflectivePath
|
||||||
implements SqmExpression {
|
implements SqmExpression {
|
||||||
private final SqmExpressable expressableType;
|
private final SqmExpressible expressibleType;
|
||||||
private final SqmCreationState creationState;
|
private final SqmCreationState creationState;
|
||||||
|
|
||||||
private final Function<SemanticQueryWalker,?> handler;
|
private final Function<SemanticQueryWalker,?> handler;
|
||||||
|
@ -52,7 +52,7 @@ public class FullyQualifiedReflectivePathTerminal
|
||||||
this.handler = resolveTerminalSemantic();
|
this.handler = resolveTerminalSemantic();
|
||||||
|
|
||||||
// todo (6.0) : how to calculate this?
|
// todo (6.0) : how to calculate this?
|
||||||
this.expressableType = null;
|
this.expressibleType = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -124,8 +124,8 @@ public class FullyQualifiedReflectivePathTerminal
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmExpressable getNodeType() {
|
public SqmExpressible getNodeType() {
|
||||||
return expressableType;
|
return expressibleType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -135,12 +135,12 @@ public class FullyQualifiedReflectivePathTerminal
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType getJavaTypeDescriptor() {
|
public JavaType getJavaTypeDescriptor() {
|
||||||
return expressableType.getExpressableJavaType();
|
return expressibleType.getExpressibleJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyInferableType(SqmExpressable type) {
|
public void applyInferableType(SqmExpressible type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -76,7 +76,7 @@ import org.hibernate.query.hql.spi.SqmPathRegistry;
|
||||||
import org.hibernate.query.sqm.LiteralNumberFormatException;
|
import org.hibernate.query.sqm.LiteralNumberFormatException;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
import org.hibernate.query.sqm.ParsingException;
|
import org.hibernate.query.sqm.ParsingException;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SqmPathSource;
|
import org.hibernate.query.sqm.SqmPathSource;
|
||||||
import org.hibernate.query.sqm.SqmQuerySource;
|
import org.hibernate.query.sqm.SqmQuerySource;
|
||||||
import org.hibernate.query.sqm.SqmTreeCreationLogger;
|
import org.hibernate.query.sqm.SqmTreeCreationLogger;
|
||||||
|
@ -2317,7 +2317,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
return new SqmToDuration<>(
|
return new SqmToDuration<>(
|
||||||
(SqmExpression<?>) ctx.getChild( 0 ).accept( this ),
|
(SqmExpression<?>) ctx.getChild( 0 ).accept( this ),
|
||||||
toDurationUnit( (SqmExtractUnit<?>) ctx.getChild( 1 ).accept( this ) ),
|
toDurationUnit( (SqmExtractUnit<?>) ctx.getChild( 1 ).accept( this ) ),
|
||||||
resolveExpressableTypeBasic( Duration.class ),
|
resolveExpressibleTypeBasic( Duration.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2325,7 +2325,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
private SqmDurationUnit<Long> toDurationUnit(SqmExtractUnit<?> extractUnit) {
|
private SqmDurationUnit<Long> toDurationUnit(SqmExtractUnit<?> extractUnit) {
|
||||||
return new SqmDurationUnit<>(
|
return new SqmDurationUnit<>(
|
||||||
extractUnit.getUnit(),
|
extractUnit.getUnit(),
|
||||||
resolveExpressableTypeBasic( Long.class ),
|
resolveExpressibleTypeBasic( Long.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2335,7 +2335,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
return new SqmByUnit(
|
return new SqmByUnit(
|
||||||
toDurationUnit( (SqmExtractUnit<?>) ctx.getChild( 2 ).accept( this ) ),
|
toDurationUnit( (SqmExtractUnit<?>) ctx.getChild( 2 ).accept( this ) ),
|
||||||
(SqmExpression<?>) ctx.getChild( 0 ).accept( this ),
|
(SqmExpression<?>) ctx.getChild( 0 ).accept( this ),
|
||||||
resolveExpressableTypeBasic( Long.class ),
|
resolveExpressibleTypeBasic( Long.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2474,7 +2474,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public SqmExpression<?> visitCurrentDateFunction(HqlParser.CurrentDateFunctionContext ctx) {
|
public SqmExpression<?> visitCurrentDateFunction(HqlParser.CurrentDateFunctionContext ctx) {
|
||||||
return getFunctionDescriptor("current_date")
|
return getFunctionDescriptor("current_date")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
resolveExpressableTypeBasic( Date.class ),
|
resolveExpressibleTypeBasic( Date.class ),
|
||||||
creationContext.getQueryEngine(),
|
creationContext.getQueryEngine(),
|
||||||
creationContext.getJpaMetamodel().getTypeConfiguration()
|
creationContext.getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -2484,7 +2484,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public SqmExpression<?> visitCurrentTimeFunction(HqlParser.CurrentTimeFunctionContext ctx) {
|
public SqmExpression<?> visitCurrentTimeFunction(HqlParser.CurrentTimeFunctionContext ctx) {
|
||||||
return getFunctionDescriptor("current_time")
|
return getFunctionDescriptor("current_time")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
resolveExpressableTypeBasic( Time.class ),
|
resolveExpressibleTypeBasic( Time.class ),
|
||||||
creationContext.getQueryEngine(),
|
creationContext.getQueryEngine(),
|
||||||
creationContext.getJpaMetamodel().getTypeConfiguration()
|
creationContext.getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -2494,7 +2494,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public SqmExpression<?> visitCurrentTimestampFunction(HqlParser.CurrentTimestampFunctionContext ctx) {
|
public SqmExpression<?> visitCurrentTimestampFunction(HqlParser.CurrentTimestampFunctionContext ctx) {
|
||||||
return getFunctionDescriptor("current_timestamp")
|
return getFunctionDescriptor("current_timestamp")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
resolveExpressableTypeBasic( Timestamp.class ),
|
resolveExpressibleTypeBasic( Timestamp.class ),
|
||||||
creationContext.getQueryEngine(),
|
creationContext.getQueryEngine(),
|
||||||
creationContext.getJpaMetamodel().getTypeConfiguration()
|
creationContext.getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -2504,7 +2504,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public SqmExpression<?> visitInstantFunction(HqlParser.InstantFunctionContext ctx) {
|
public SqmExpression<?> visitInstantFunction(HqlParser.InstantFunctionContext ctx) {
|
||||||
return getFunctionDescriptor("instant")
|
return getFunctionDescriptor("instant")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
resolveExpressableTypeBasic( Instant.class ),
|
resolveExpressibleTypeBasic( Instant.class ),
|
||||||
creationContext.getQueryEngine(),
|
creationContext.getQueryEngine(),
|
||||||
creationContext.getJpaMetamodel().getTypeConfiguration()
|
creationContext.getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -2514,7 +2514,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public SqmExpression<?> visitLocalDateFunction(HqlParser.LocalDateFunctionContext ctx) {
|
public SqmExpression<?> visitLocalDateFunction(HqlParser.LocalDateFunctionContext ctx) {
|
||||||
return getFunctionDescriptor("local_date")
|
return getFunctionDescriptor("local_date")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
resolveExpressableTypeBasic( LocalDate.class ),
|
resolveExpressibleTypeBasic( LocalDate.class ),
|
||||||
creationContext.getQueryEngine(),
|
creationContext.getQueryEngine(),
|
||||||
creationContext.getJpaMetamodel().getTypeConfiguration()
|
creationContext.getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -2524,7 +2524,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public SqmExpression<?> visitLocalTimeFunction(HqlParser.LocalTimeFunctionContext ctx) {
|
public SqmExpression<?> visitLocalTimeFunction(HqlParser.LocalTimeFunctionContext ctx) {
|
||||||
return getFunctionDescriptor("local_time")
|
return getFunctionDescriptor("local_time")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
resolveExpressableTypeBasic( LocalTime.class ),
|
resolveExpressibleTypeBasic( LocalTime.class ),
|
||||||
creationContext.getQueryEngine(),
|
creationContext.getQueryEngine(),
|
||||||
creationContext.getJpaMetamodel().getTypeConfiguration()
|
creationContext.getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -2534,7 +2534,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public SqmExpression<?> visitLocalDateTimeFunction(HqlParser.LocalDateTimeFunctionContext ctx) {
|
public SqmExpression<?> visitLocalDateTimeFunction(HqlParser.LocalDateTimeFunctionContext ctx) {
|
||||||
return getFunctionDescriptor("local_datetime")
|
return getFunctionDescriptor("local_datetime")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
resolveExpressableTypeBasic( LocalDateTime.class ),
|
resolveExpressibleTypeBasic( LocalDateTime.class ),
|
||||||
creationContext.getQueryEngine(),
|
creationContext.getQueryEngine(),
|
||||||
creationContext.getJpaMetamodel().getTypeConfiguration()
|
creationContext.getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -2544,7 +2544,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public SqmExpression<?> visitOffsetDateTimeFunction(HqlParser.OffsetDateTimeFunctionContext ctx) {
|
public SqmExpression<?> visitOffsetDateTimeFunction(HqlParser.OffsetDateTimeFunctionContext ctx) {
|
||||||
return getFunctionDescriptor("offset_datetime")
|
return getFunctionDescriptor("offset_datetime")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
resolveExpressableTypeBasic( OffsetDateTime.class ),
|
resolveExpressibleTypeBasic( OffsetDateTime.class ),
|
||||||
creationContext.getQueryEngine(),
|
creationContext.getQueryEngine(),
|
||||||
creationContext.getJpaMetamodel().getTypeConfiguration()
|
creationContext.getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -2722,7 +2722,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
if ( timezone == null ) {
|
if ( timezone == null ) {
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
LocalDateTime.of( localDate( date ), localTime( time ) ),
|
LocalDateTime.of( localDate( date ), localTime( time ) ),
|
||||||
resolveExpressableTypeBasic( LocalDateTime.class ),
|
resolveExpressibleTypeBasic( LocalDateTime.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2730,7 +2730,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final ZoneId zoneId = visitZoneId( timezone );
|
final ZoneId zoneId = visitZoneId( timezone );
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
ZonedDateTime.of( localDate( date ), localTime( time ), zoneId ),
|
ZonedDateTime.of( localDate( date ), localTime( time ), zoneId ),
|
||||||
resolveExpressableTypeBasic( ZonedDateTime.class ),
|
resolveExpressibleTypeBasic( ZonedDateTime.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2761,7 +2761,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
HqlParser.OffsetContext offset) {
|
HqlParser.OffsetContext offset) {
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
OffsetDateTime.of( localDate( date ), localTime( time ), zoneOffset( offset ) ),
|
OffsetDateTime.of( localDate( date ), localTime( time ), zoneOffset( offset ) ),
|
||||||
resolveExpressableTypeBasic( OffsetDateTime.class ),
|
resolveExpressibleTypeBasic( OffsetDateTime.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2770,7 +2770,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public Object visitDate(HqlParser.DateContext ctx) {
|
public Object visitDate(HqlParser.DateContext ctx) {
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
localDate( ctx ),
|
localDate( ctx ),
|
||||||
resolveExpressableTypeBasic( LocalDate.class ),
|
resolveExpressibleTypeBasic( LocalDate.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2779,7 +2779,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public Object visitTime(HqlParser.TimeContext ctx) {
|
public Object visitTime(HqlParser.TimeContext ctx) {
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
localTime( ctx ),
|
localTime( ctx ),
|
||||||
resolveExpressableTypeBasic( LocalTime.class ),
|
resolveExpressibleTypeBasic( LocalTime.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2835,7 +2835,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
// TemporalAccessor parsed = OFFSET_DATE_TIME.parse( literalText );
|
// TemporalAccessor parsed = OFFSET_DATE_TIME.parse( literalText );
|
||||||
// return new SqmLiteral<>(
|
// return new SqmLiteral<>(
|
||||||
// OffsetDateTime.from( parsed ),
|
// OffsetDateTime.from( parsed ),
|
||||||
// resolveExpressableTypeBasic( OffsetDateTime.class ),
|
// resolveExpressibleTypeBasic( OffsetDateTime.class ),
|
||||||
// creationContext.getNodeBuilder()
|
// creationContext.getNodeBuilder()
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
@ -2846,14 +2846,14 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
// try {
|
// try {
|
||||||
// return new SqmLiteral<>(
|
// return new SqmLiteral<>(
|
||||||
// ZonedDateTime.from( parsed ),
|
// ZonedDateTime.from( parsed ),
|
||||||
// resolveExpressableTypeBasic( ZonedDateTime.class ),
|
// resolveExpressibleTypeBasic( ZonedDateTime.class ),
|
||||||
// creationContext.getNodeBuilder()
|
// creationContext.getNodeBuilder()
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
// catch (DateTimeException dte) {
|
// catch (DateTimeException dte) {
|
||||||
// return new SqmLiteral<>(
|
// return new SqmLiteral<>(
|
||||||
// LocalDateTime.from( parsed ),
|
// LocalDateTime.from( parsed ),
|
||||||
// resolveExpressableTypeBasic( LocalDateTime.class ),
|
// resolveExpressibleTypeBasic( LocalDateTime.class ),
|
||||||
// creationContext.getNodeBuilder()
|
// creationContext.getNodeBuilder()
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
@ -2862,7 +2862,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
// private SqmLiteral<LocalDate> localDateLiteralFrom(String literalText) {
|
// private SqmLiteral<LocalDate> localDateLiteralFrom(String literalText) {
|
||||||
// return new SqmLiteral<>(
|
// return new SqmLiteral<>(
|
||||||
// LocalDate.from( ISO_LOCAL_DATE.parse( literalText ) ),
|
// LocalDate.from( ISO_LOCAL_DATE.parse( literalText ) ),
|
||||||
// resolveExpressableTypeBasic( LocalDate.class ),
|
// resolveExpressibleTypeBasic( LocalDate.class ),
|
||||||
// creationContext.getNodeBuilder()
|
// creationContext.getNodeBuilder()
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
@ -2870,7 +2870,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
// private SqmLiteral<LocalTime> localTimeLiteralFrom(String literalText) {
|
// private SqmLiteral<LocalTime> localTimeLiteralFrom(String literalText) {
|
||||||
// return new SqmLiteral<>(
|
// return new SqmLiteral<>(
|
||||||
// LocalTime.from( ISO_LOCAL_TIME.parse( literalText ) ),
|
// LocalTime.from( ISO_LOCAL_TIME.parse( literalText ) ),
|
||||||
// resolveExpressableTypeBasic( LocalTime.class ),
|
// resolveExpressibleTypeBasic( LocalTime.class ),
|
||||||
// creationContext.getNodeBuilder()
|
// creationContext.getNodeBuilder()
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
@ -2882,7 +2882,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final Calendar literal = GregorianCalendar.from( zonedDateTime );
|
final Calendar literal = GregorianCalendar.from( zonedDateTime );
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
literal,
|
literal,
|
||||||
resolveExpressableTypeBasic( Calendar.class ),
|
resolveExpressibleTypeBasic( Calendar.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2891,7 +2891,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final Timestamp literal = Timestamp.valueOf( localDateTime );
|
final Timestamp literal = Timestamp.valueOf( localDateTime );
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
literal,
|
literal,
|
||||||
resolveExpressableTypeBasic( Timestamp.class ),
|
resolveExpressibleTypeBasic( Timestamp.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2902,7 +2902,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final Date literal = Date.valueOf( localDate );
|
final Date literal = Date.valueOf( localDate );
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
literal,
|
literal,
|
||||||
resolveExpressableTypeBasic( Date.class ),
|
resolveExpressibleTypeBasic( Date.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2912,7 +2912,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final Time literal = Time.valueOf( localTime );
|
final Time literal = Time.valueOf( localTime );
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
literal,
|
literal,
|
||||||
resolveExpressableTypeBasic( Time.class ),
|
resolveExpressibleTypeBasic( Time.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2920,7 +2920,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
private SqmLiteral<Boolean> booleanLiteral(boolean value) {
|
private SqmLiteral<Boolean> booleanLiteral(boolean value) {
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
value,
|
value,
|
||||||
resolveExpressableTypeBasic( Boolean.class ),
|
resolveExpressibleTypeBasic( Boolean.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2928,7 +2928,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
private SqmLiteral<String> stringLiteral(String text) {
|
private SqmLiteral<String> stringLiteral(String text) {
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
QuotingHelper.unquoteStringLiteral( text ),
|
QuotingHelper.unquoteStringLiteral( text ),
|
||||||
resolveExpressableTypeBasic( String.class ),
|
resolveExpressibleTypeBasic( String.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2938,7 +2938,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
PrimitiveByteArrayJavaType.INSTANCE.fromString(
|
PrimitiveByteArrayJavaType.INSTANCE.fromString(
|
||||||
CharSequenceHelper.subSequence( text, 2, text.length() - 1 )
|
CharSequenceHelper.subSequence( text, 2, text.length() - 1 )
|
||||||
),
|
),
|
||||||
resolveExpressableTypeBasic( byte[].class ),
|
resolveExpressibleTypeBasic( byte[].class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2948,7 +2948,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final Integer value = Integer.valueOf( text );
|
final Integer value = Integer.valueOf( text );
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
value,
|
value,
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2958,7 +2958,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final Long value = Long.valueOf( text );
|
final Long value = Long.valueOf( text );
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
value,
|
value,
|
||||||
resolveExpressableTypeBasic( Long.class ),
|
resolveExpressibleTypeBasic( Long.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2977,7 +2977,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final Integer value = Integer.valueOf( text );
|
final Integer value = Integer.valueOf( text );
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
value,
|
value,
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2998,7 +2998,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final Long value = Long.valueOf( text );
|
final Long value = Long.valueOf( text );
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
value,
|
value,
|
||||||
resolveExpressableTypeBasic( Long.class ),
|
resolveExpressibleTypeBasic( Long.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3019,16 +3019,16 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
if ( text.endsWith( "l" ) || text.endsWith( "L" ) ) {
|
if ( text.endsWith( "l" ) || text.endsWith( "L" ) ) {
|
||||||
text = text.substring( 0, text.length() - 1 );
|
text = text.substring( 0, text.length() - 1 );
|
||||||
value = Long.parseUnsignedLong( text, 16 );
|
value = Long.parseUnsignedLong( text, 16 );
|
||||||
type = resolveExpressableTypeBasic( Long.class );
|
type = resolveExpressibleTypeBasic( Long.class );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
value = Integer.parseUnsignedInt( text, 16 );
|
value = Integer.parseUnsignedInt( text, 16 );
|
||||||
type = resolveExpressableTypeBasic( Integer.class );
|
type = resolveExpressibleTypeBasic( Integer.class );
|
||||||
}
|
}
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
value,
|
value,
|
||||||
(SqmExpressable<Number>) type,
|
(SqmExpressible<Number>) type,
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3048,7 +3048,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
}
|
}
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
new BigInteger( text ),
|
new BigInteger( text ),
|
||||||
resolveExpressableTypeBasic( BigInteger.class ),
|
resolveExpressibleTypeBasic( BigInteger.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3064,7 +3064,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
try {
|
try {
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
Float.valueOf( text ),
|
Float.valueOf( text ),
|
||||||
resolveExpressableTypeBasic( Float.class ),
|
resolveExpressibleTypeBasic( Float.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3080,7 +3080,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
try {
|
try {
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
Double.valueOf( text ),
|
Double.valueOf( text ),
|
||||||
resolveExpressableTypeBasic( Double.class ),
|
resolveExpressibleTypeBasic( Double.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3100,7 +3100,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
}
|
}
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
new BigDecimal( text ),
|
new BigDecimal( text ),
|
||||||
resolveExpressableTypeBasic( BigDecimal.class ),
|
resolveExpressibleTypeBasic( BigDecimal.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3112,7 +3112,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private <J> BasicType<J> resolveExpressableTypeBasic(Class<J> javaType) {
|
private <J> BasicType<J> resolveExpressibleTypeBasic(Class<J> javaType) {
|
||||||
return creationContext.getJpaMetamodel().getTypeConfiguration().standardBasicTypeForJavaType( javaType );
|
return creationContext.getJpaMetamodel().getTypeConfiguration().standardBasicTypeForJavaType( javaType );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3171,7 +3171,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
true,
|
true,
|
||||||
null,
|
null,
|
||||||
StandardFunctionReturnTypeResolvers.invariant(
|
StandardFunctionReturnTypeResolvers.invariant(
|
||||||
resolveExpressableTypeBasic( Object.class )
|
resolveExpressibleTypeBasic( Object.class )
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3227,7 +3227,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
true,
|
true,
|
||||||
null,
|
null,
|
||||||
StandardFunctionReturnTypeResolvers.invariant(
|
StandardFunctionReturnTypeResolvers.invariant(
|
||||||
resolveExpressableTypeBasic( Object.class )
|
resolveExpressibleTypeBasic( Object.class )
|
||||||
),
|
),
|
||||||
functionName,
|
functionName,
|
||||||
filterExpression != null ? FunctionKind.AGGREGATE : FunctionKind.NORMAL,
|
filterExpression != null ? FunctionKind.AGGREGATE : FunctionKind.NORMAL,
|
||||||
|
@ -3330,55 +3330,55 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
case HqlParser.DAY:
|
case HqlParser.DAY:
|
||||||
return new SqmExtractUnit<>(
|
return new SqmExtractUnit<>(
|
||||||
TemporalUnit.DAY,
|
TemporalUnit.DAY,
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
nodeBuilder
|
nodeBuilder
|
||||||
);
|
);
|
||||||
case HqlParser.MONTH:
|
case HqlParser.MONTH:
|
||||||
return new SqmExtractUnit<>(
|
return new SqmExtractUnit<>(
|
||||||
TemporalUnit.MONTH,
|
TemporalUnit.MONTH,
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
nodeBuilder
|
nodeBuilder
|
||||||
);
|
);
|
||||||
case HqlParser.YEAR:
|
case HqlParser.YEAR:
|
||||||
return new SqmExtractUnit<>(
|
return new SqmExtractUnit<>(
|
||||||
TemporalUnit.YEAR,
|
TemporalUnit.YEAR,
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
nodeBuilder
|
nodeBuilder
|
||||||
);
|
);
|
||||||
case HqlParser.HOUR:
|
case HqlParser.HOUR:
|
||||||
return new SqmExtractUnit<>(
|
return new SqmExtractUnit<>(
|
||||||
TemporalUnit.HOUR,
|
TemporalUnit.HOUR,
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
nodeBuilder
|
nodeBuilder
|
||||||
);
|
);
|
||||||
case HqlParser.MINUTE:
|
case HqlParser.MINUTE:
|
||||||
return new SqmExtractUnit<>(
|
return new SqmExtractUnit<>(
|
||||||
TemporalUnit.MINUTE,
|
TemporalUnit.MINUTE,
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
nodeBuilder
|
nodeBuilder
|
||||||
);
|
);
|
||||||
case HqlParser.SECOND:
|
case HqlParser.SECOND:
|
||||||
return new SqmExtractUnit<>(
|
return new SqmExtractUnit<>(
|
||||||
TemporalUnit.SECOND,
|
TemporalUnit.SECOND,
|
||||||
resolveExpressableTypeBasic( Float.class ),
|
resolveExpressibleTypeBasic( Float.class ),
|
||||||
nodeBuilder
|
nodeBuilder
|
||||||
);
|
);
|
||||||
case HqlParser.NANOSECOND:
|
case HqlParser.NANOSECOND:
|
||||||
return new SqmExtractUnit<>(
|
return new SqmExtractUnit<>(
|
||||||
NANOSECOND,
|
NANOSECOND,
|
||||||
resolveExpressableTypeBasic( Long.class ),
|
resolveExpressibleTypeBasic( Long.class ),
|
||||||
nodeBuilder
|
nodeBuilder
|
||||||
);
|
);
|
||||||
case HqlParser.WEEK:
|
case HqlParser.WEEK:
|
||||||
return new SqmExtractUnit<>(
|
return new SqmExtractUnit<>(
|
||||||
TemporalUnit.WEEK,
|
TemporalUnit.WEEK,
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
nodeBuilder
|
nodeBuilder
|
||||||
);
|
);
|
||||||
case HqlParser.QUARTER:
|
case HqlParser.QUARTER:
|
||||||
return new SqmExtractUnit<>(
|
return new SqmExtractUnit<>(
|
||||||
TemporalUnit.QUARTER,
|
TemporalUnit.QUARTER,
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
nodeBuilder
|
nodeBuilder
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3390,11 +3390,11 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final NodeBuilder nodeBuilder = creationContext.getNodeBuilder();
|
final NodeBuilder nodeBuilder = creationContext.getNodeBuilder();
|
||||||
switch ( ( (TerminalNode) ctx.getChild( 2 ) ).getSymbol().getType() ) {
|
switch ( ( (TerminalNode) ctx.getChild( 2 ) ).getSymbol().getType() ) {
|
||||||
case HqlParser.MONTH:
|
case HqlParser.MONTH:
|
||||||
return new SqmExtractUnit<>( DAY_OF_MONTH, resolveExpressableTypeBasic( Integer.class ), nodeBuilder );
|
return new SqmExtractUnit<>( DAY_OF_MONTH, resolveExpressibleTypeBasic( Integer.class ), nodeBuilder );
|
||||||
case HqlParser.WEEK:
|
case HqlParser.WEEK:
|
||||||
return new SqmExtractUnit<>( DAY_OF_WEEK, resolveExpressableTypeBasic( Integer.class ), nodeBuilder );
|
return new SqmExtractUnit<>( DAY_OF_WEEK, resolveExpressibleTypeBasic( Integer.class ), nodeBuilder );
|
||||||
case HqlParser.YEAR:
|
case HqlParser.YEAR:
|
||||||
return new SqmExtractUnit<>( DAY_OF_YEAR, resolveExpressableTypeBasic( Integer.class ), nodeBuilder );
|
return new SqmExtractUnit<>( DAY_OF_YEAR, resolveExpressibleTypeBasic( Integer.class ), nodeBuilder );
|
||||||
}
|
}
|
||||||
throw new ParsingException("Unsupported day field [" + ctx.getText() + "]");
|
throw new ParsingException("Unsupported day field [" + ctx.getText() + "]");
|
||||||
}
|
}
|
||||||
|
@ -3405,10 +3405,10 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
switch ( ( (TerminalNode) ctx.getChild( 2 ) ).getSymbol().getType() ) {
|
switch ( ( (TerminalNode) ctx.getChild( 2 ) ).getSymbol().getType() ) {
|
||||||
case HqlParser.MONTH:
|
case HqlParser.MONTH:
|
||||||
//this is computed from DAY_OF_MONTH/7
|
//this is computed from DAY_OF_MONTH/7
|
||||||
return new SqmExtractUnit<>( WEEK_OF_MONTH, resolveExpressableTypeBasic( Integer.class ), nodeBuilder );
|
return new SqmExtractUnit<>( WEEK_OF_MONTH, resolveExpressibleTypeBasic( Integer.class ), nodeBuilder );
|
||||||
case HqlParser.YEAR:
|
case HqlParser.YEAR:
|
||||||
//this is computed from DAY_OF_YEAR/7
|
//this is computed from DAY_OF_YEAR/7
|
||||||
return new SqmExtractUnit<>( WEEK_OF_YEAR, resolveExpressableTypeBasic( Integer.class ), nodeBuilder );
|
return new SqmExtractUnit<>( WEEK_OF_YEAR, resolveExpressibleTypeBasic( Integer.class ), nodeBuilder );
|
||||||
}
|
}
|
||||||
throw new ParsingException("Unsupported week field [" + ctx.getText() + "]");
|
throw new ParsingException("Unsupported week field [" + ctx.getText() + "]");
|
||||||
}
|
}
|
||||||
|
@ -3419,12 +3419,12 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
switch ( ( (TerminalNode) ctx.getChild( 0 ) ).getSymbol().getType() ) {
|
switch ( ( (TerminalNode) ctx.getChild( 0 ) ).getSymbol().getType() ) {
|
||||||
case HqlParser.DATE:
|
case HqlParser.DATE:
|
||||||
return isExtractingJdbcTemporalType
|
return isExtractingJdbcTemporalType
|
||||||
? new SqmExtractUnit<>( DATE, resolveExpressableTypeBasic( Date.class ), nodeBuilder )
|
? new SqmExtractUnit<>( DATE, resolveExpressibleTypeBasic( Date.class ), nodeBuilder )
|
||||||
: new SqmExtractUnit<>( DATE, resolveExpressableTypeBasic( LocalDate.class ), nodeBuilder );
|
: new SqmExtractUnit<>( DATE, resolveExpressibleTypeBasic( LocalDate.class ), nodeBuilder );
|
||||||
case HqlParser.TIME:
|
case HqlParser.TIME:
|
||||||
return isExtractingJdbcTemporalType
|
return isExtractingJdbcTemporalType
|
||||||
? new SqmExtractUnit<>( TIME, resolveExpressableTypeBasic( Time.class ), nodeBuilder )
|
? new SqmExtractUnit<>( TIME, resolveExpressibleTypeBasic( Time.class ), nodeBuilder )
|
||||||
: new SqmExtractUnit<>( TIME, resolveExpressableTypeBasic( LocalTime.class ), nodeBuilder );
|
: new SqmExtractUnit<>( TIME, resolveExpressibleTypeBasic( LocalTime.class ), nodeBuilder );
|
||||||
}
|
}
|
||||||
throw new ParsingException("Unsupported date or time field [" + ctx.getText() + "]");
|
throw new ParsingException("Unsupported date or time field [" + ctx.getText() + "]");
|
||||||
}
|
}
|
||||||
|
@ -3434,15 +3434,15 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final NodeBuilder nodeBuilder = creationContext.getNodeBuilder();
|
final NodeBuilder nodeBuilder = creationContext.getNodeBuilder();
|
||||||
switch ( ( (TerminalNode) ctx.getChild( ctx.getChildCount() - 1 ) ).getSymbol().getType() ) {
|
switch ( ( (TerminalNode) ctx.getChild( ctx.getChildCount() - 1 ) ).getSymbol().getType() ) {
|
||||||
case HqlParser.TIMEZONE_HOUR:
|
case HqlParser.TIMEZONE_HOUR:
|
||||||
return new SqmExtractUnit<>( TIMEZONE_HOUR, resolveExpressableTypeBasic( Integer.class ), nodeBuilder );
|
return new SqmExtractUnit<>( TIMEZONE_HOUR, resolveExpressibleTypeBasic( Integer.class ), nodeBuilder );
|
||||||
case HqlParser.TIMEZONE_MINUTE:
|
case HqlParser.TIMEZONE_MINUTE:
|
||||||
return new SqmExtractUnit<>(
|
return new SqmExtractUnit<>(
|
||||||
TIMEZONE_MINUTE,
|
TIMEZONE_MINUTE,
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
nodeBuilder
|
nodeBuilder
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return new SqmExtractUnit<>( OFFSET, resolveExpressableTypeBasic( ZoneOffset.class ), nodeBuilder );
|
return new SqmExtractUnit<>( OFFSET, resolveExpressibleTypeBasic( ZoneOffset.class ), nodeBuilder );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3480,7 +3480,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
final String format = QuotingHelper.unquoteStringLiteral( ctx.getChild( 0 ).getText() );
|
final String format = QuotingHelper.unquoteStringLiteral( ctx.getChild( 0 ).getText() );
|
||||||
return new SqmFormat(
|
return new SqmFormat(
|
||||||
format,
|
format,
|
||||||
resolveExpressableTypeBasic( String.class ),
|
resolveExpressibleTypeBasic( String.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3593,7 +3593,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
return getFunctionDescriptor( "every" ).generateAggregateSqmExpression(
|
return getFunctionDescriptor( "every" ).generateAggregateSqmExpression(
|
||||||
singletonList( argument ),
|
singletonList( argument ),
|
||||||
filterExpression,
|
filterExpression,
|
||||||
resolveExpressableTypeBasic( Boolean.class ),
|
resolveExpressibleTypeBasic( Boolean.class ),
|
||||||
creationContext.getQueryEngine(),
|
creationContext.getQueryEngine(),
|
||||||
creationContext.getJpaMetamodel().getTypeConfiguration()
|
creationContext.getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -3629,7 +3629,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
return getFunctionDescriptor( "any" ).generateAggregateSqmExpression(
|
return getFunctionDescriptor( "any" ).generateAggregateSqmExpression(
|
||||||
singletonList( argument ),
|
singletonList( argument ),
|
||||||
filterExpression,
|
filterExpression,
|
||||||
resolveExpressableTypeBasic( Boolean.class ),
|
resolveExpressibleTypeBasic( Boolean.class ),
|
||||||
creationContext.getQueryEngine(),
|
creationContext.getQueryEngine(),
|
||||||
creationContext.getJpaMetamodel().getTypeConfiguration()
|
creationContext.getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -3789,7 +3789,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
|
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
padCharText.charAt( 1 ),
|
padCharText.charAt( 1 ),
|
||||||
resolveExpressableTypeBasic( Character.class ),
|
resolveExpressibleTypeBasic( Character.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3858,7 +3858,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
|
|
||||||
return new SqmLiteral<>(
|
return new SqmLiteral<>(
|
||||||
trimCharText.charAt( 0 ),
|
trimCharText.charAt( 0 ),
|
||||||
resolveExpressableTypeBasic( Character.class ),
|
resolveExpressibleTypeBasic( Character.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3867,7 +3867,7 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
|
||||||
public SqmCollectionSize visitCollectionSizeFunction(HqlParser.CollectionSizeFunctionContext ctx) {
|
public SqmCollectionSize visitCollectionSizeFunction(HqlParser.CollectionSizeFunctionContext ctx) {
|
||||||
return new SqmCollectionSize(
|
return new SqmCollectionSize(
|
||||||
consumeDomainPath( (HqlParser.PathContext) ctx.getChild( 2 ) ),
|
consumeDomainPath( (HqlParser.PathContext) ctx.getChild( 2 ) ),
|
||||||
resolveExpressableTypeBasic( Integer.class ),
|
resolveExpressibleTypeBasic( Integer.class ),
|
||||||
creationContext.getNodeBuilder()
|
creationContext.getNodeBuilder()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.Calendar;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.type.StandardBasicTypes;
|
import org.hibernate.type.StandardBasicTypes;
|
||||||
import org.hibernate.type.descriptor.java.TemporalJavaType;
|
import org.hibernate.type.descriptor.java.TemporalJavaType;
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
@ -39,14 +39,14 @@ public class BindingTypeHelper {
|
||||||
BindableType<T> declaredParameterType,
|
BindableType<T> declaredParameterType,
|
||||||
SessionFactoryImplementor sessionFactory) {
|
SessionFactoryImplementor sessionFactory) {
|
||||||
if ( precision != null ) {
|
if ( precision != null ) {
|
||||||
final SqmExpressable<T> sqmExpressable = declaredParameterType.resolveExpressable( sessionFactory );
|
final SqmExpressible<T> sqmExpressible = declaredParameterType.resolveExpressible( sessionFactory );
|
||||||
if ( !( sqmExpressable.getExpressableJavaType() instanceof TemporalJavaType ) ) {
|
if ( !( sqmExpressible.getExpressibleJavaType() instanceof TemporalJavaType ) ) {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
"Cannot treat non-temporal parameter type with temporal precision"
|
"Cannot treat non-temporal parameter type with temporal precision"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final TemporalJavaType<T> temporalJtd = (TemporalJavaType<T>) sqmExpressable.getExpressableJavaType();
|
final TemporalJavaType<T> temporalJtd = (TemporalJavaType<T>) sqmExpressible.getExpressibleJavaType();
|
||||||
if ( temporalJtd.getPrecision() != precision ) {
|
if ( temporalJtd.getPrecision() != precision ) {
|
||||||
final TypeConfiguration typeConfiguration = sessionFactory.getTypeConfiguration();
|
final TypeConfiguration typeConfiguration = sessionFactory.getTypeConfiguration();
|
||||||
return typeConfiguration.getBasicTypeRegistry().resolve(
|
return typeConfiguration.getBasicTypeRegistry().resolve(
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.internal;
|
package org.hibernate.query.internal;
|
||||||
|
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SqmPathSource;
|
import org.hibernate.query.sqm.SqmPathSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,7 @@ public class QueryHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public static <T> SqmExpressable<? extends T> highestPrecedenceType(SqmExpressable<? extends T>... types) {
|
public static <T> SqmExpressible<? extends T> highestPrecedenceType(SqmExpressible<? extends T>... types) {
|
||||||
if ( types == null || types.length == 0 ) {
|
if ( types == null || types.length == 0 ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class QueryHelper {
|
||||||
return types[0];
|
return types[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
SqmExpressable<? extends T> highest = highestPrecedenceType2( types[0], types[1] );
|
SqmExpressible<? extends T> highest = highestPrecedenceType2( types[0], types[1] );
|
||||||
for ( int i = 2; i < types.length; i++ ) {
|
for ( int i = 2; i < types.length; i++ ) {
|
||||||
highest = highestPrecedenceType2( highest, types[i] );
|
highest = highestPrecedenceType2( highest, types[i] );
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,9 @@ public class QueryHelper {
|
||||||
return highest;
|
return highest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <X> SqmExpressable<? extends X> highestPrecedenceType2(
|
public static <X> SqmExpressible<? extends X> highestPrecedenceType2(
|
||||||
SqmExpressable<? extends X> type1,
|
SqmExpressible<? extends X> type1,
|
||||||
SqmExpressable<? extends X> type2) {
|
SqmExpressible<? extends X> type2) {
|
||||||
if ( type1 == null && type2 == null ) {
|
if ( type1 == null && type2 == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class QueryHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
// any other precedence rules?
|
// any other precedence rules?
|
||||||
if ( type2.getExpressableJavaType().isWider( type1.getExpressableJavaType() ) ) {
|
if ( type2.getExpressibleJavaType().isWider( type1.getExpressibleJavaType() ) ) {
|
||||||
return type2;
|
return type2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,12 @@ import java.util.Iterator;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.query.QueryParameter;
|
import org.hibernate.query.QueryParameter;
|
||||||
import org.hibernate.query.spi.QueryParameterBinding;
|
import org.hibernate.query.spi.QueryParameterBinding;
|
||||||
import org.hibernate.query.spi.QueryParameterBindingValidator;
|
import org.hibernate.query.spi.QueryParameterBindingValidator;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.type.descriptor.java.CoercionException;
|
import org.hibernate.type.descriptor.java.CoercionException;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.descriptor.java.TemporalJavaType;
|
import org.hibernate.type.descriptor.java.TemporalJavaType;
|
||||||
|
@ -38,7 +38,7 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
||||||
private boolean isMultiValued;
|
private boolean isMultiValued;
|
||||||
|
|
||||||
private BindableType<? extends T> bindType;
|
private BindableType<? extends T> bindType;
|
||||||
private MappingModelExpressable<T> type;
|
private MappingModelExpressible<T> type;
|
||||||
private TemporalType explicitTemporalPrecision;
|
private TemporalType explicitTemporalPrecision;
|
||||||
|
|
||||||
private T bindValue;
|
private T bindValue;
|
||||||
|
@ -140,10 +140,10 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final SqmExpressable<? extends T> sqmExpressable = parameterType.resolveExpressable( sessionFactory );
|
final SqmExpressible<? extends T> sqmExpressible = parameterType.resolveExpressible( sessionFactory );
|
||||||
assert sqmExpressable != null;
|
assert sqmExpressible != null;
|
||||||
|
|
||||||
return sqmExpressable.getExpressableJavaType().coerce( value, this );
|
return sqmExpressible.getExpressibleJavaType().coerce( value, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleAsMultiValue(T value) {
|
private boolean handleAsMultiValue(T value) {
|
||||||
|
@ -302,19 +302,19 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
||||||
}
|
}
|
||||||
|
|
||||||
private JavaType<? extends T> determineJavaType(BindableType<? extends T> bindType) {
|
private JavaType<? extends T> determineJavaType(BindableType<? extends T> bindType) {
|
||||||
final SqmExpressable<? extends T> sqmExpressable = bindType.resolveExpressable( sessionFactory );
|
final SqmExpressible<? extends T> sqmExpressible = bindType.resolveExpressible( sessionFactory );
|
||||||
assert sqmExpressable != null;
|
assert sqmExpressible != null;
|
||||||
|
|
||||||
return sqmExpressable.getExpressableJavaType();
|
return sqmExpressible.getExpressibleJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingModelExpressable<T> getType() {
|
public MappingModelExpressible<T> getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public boolean setType(MappingModelExpressable<T> type) {
|
public boolean setType(MappingModelExpressible<T> type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
if ( bindType == null || bindType.getBindableJavaType() == Object.class ) {
|
if ( bindType == null || bindType.getBindableJavaType() == Object.class ) {
|
||||||
if ( type instanceof BindableType<?> ) {
|
if ( type instanceof BindableType<?> ) {
|
||||||
|
|
|
@ -21,14 +21,14 @@ import org.hibernate.QueryParameterException;
|
||||||
import org.hibernate.cache.spi.QueryKey;
|
import org.hibernate.cache.spi.QueryKey;
|
||||||
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.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.QueryParameter;
|
import org.hibernate.query.QueryParameter;
|
||||||
import org.hibernate.query.spi.ParameterMetadataImplementor;
|
import org.hibernate.query.spi.ParameterMetadataImplementor;
|
||||||
import org.hibernate.query.spi.QueryParameterBinding;
|
import org.hibernate.query.spi.QueryParameterBinding;
|
||||||
import org.hibernate.query.spi.QueryParameterBindings;
|
import org.hibernate.query.spi.QueryParameterBindings;
|
||||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
import org.hibernate.type.descriptor.java.JavaTypedExpressable;
|
import org.hibernate.type.descriptor.java.JavaTypedExpressible;
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,10 +170,10 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings {
|
||||||
int hashCode = 0;
|
int hashCode = 0;
|
||||||
|
|
||||||
for ( QueryParameterBinding<?> binding : parameterBindingMap.values() ) {
|
for ( QueryParameterBinding<?> binding : parameterBindingMap.values() ) {
|
||||||
final MappingModelExpressable<?> mappingType = determineMappingType( binding, persistenceContext );
|
final MappingModelExpressible<?> mappingType = determineMappingType( binding, persistenceContext );
|
||||||
assert mappingType instanceof JavaTypedExpressable;
|
assert mappingType instanceof JavaTypedExpressible;
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
final JavaType<Object> javaType = ( (JavaTypedExpressable<Object>) mappingType ).getExpressableJavaType();
|
final JavaType<Object> javaType = ( (JavaTypedExpressible<Object>) mappingType ).getExpressibleJavaType();
|
||||||
|
|
||||||
if ( binding.isMultiValued() ) {
|
if ( binding.isMultiValued() ) {
|
||||||
for ( Object bindValue : binding.getBindValues() ) {
|
for ( Object bindValue : binding.getBindValues() ) {
|
||||||
|
@ -206,11 +206,11 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings {
|
||||||
return new ParameterBindingsMementoImpl( allBindValues.toArray( new Object[0] ), hashCode );
|
return new ParameterBindingsMementoImpl( allBindValues.toArray( new Object[0] ), hashCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
private MappingModelExpressable<?> determineMappingType(QueryParameterBinding<?> binding, SharedSessionContractImplementor session) {
|
private MappingModelExpressible<?> determineMappingType(QueryParameterBinding<?> binding, SharedSessionContractImplementor session) {
|
||||||
if ( binding.getBindType() != null ) {
|
if ( binding.getBindType() != null ) {
|
||||||
if ( binding.getBindType() instanceof MappingModelExpressable ) {
|
if ( binding.getBindType() instanceof MappingModelExpressible) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return (MappingModelExpressable<Object>) binding.getBindType();
|
return (MappingModelExpressible<Object>) binding.getBindType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,9 +220,9 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings {
|
||||||
|
|
||||||
final TypeConfiguration typeConfiguration = session.getFactory().getTypeConfiguration();
|
final TypeConfiguration typeConfiguration = session.getFactory().getTypeConfiguration();
|
||||||
|
|
||||||
if ( binding.getBindType() instanceof JavaTypedExpressable ) {
|
if ( binding.getBindType() instanceof JavaTypedExpressible) {
|
||||||
final JavaTypedExpressable<?> javaTypedExpressable = (JavaTypedExpressable<?>) binding.getBindType();
|
final JavaTypedExpressible<?> javaTypedExpressible = (JavaTypedExpressible<?>) binding.getBindType();
|
||||||
final JavaType<?> jtd = javaTypedExpressable.getExpressableJavaType();
|
final JavaType<?> jtd = javaTypedExpressible.getExpressibleJavaType();
|
||||||
if ( jtd.getJavaTypeClass() != null ) {
|
if ( jtd.getJavaTypeClass() != null ) {
|
||||||
// avoid dynamic models
|
// avoid dynamic models
|
||||||
return typeConfiguration.getBasicTypeForJavaType( jtd.getJavaTypeClass() );
|
return typeConfiguration.getBasicTypeForJavaType( jtd.getJavaTypeClass() );
|
||||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.query.results;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.sql.ast.SqlAstWalker;
|
import org.hibernate.sql.ast.SqlAstWalker;
|
||||||
import org.hibernate.sql.ast.spi.SqlExpressionAccess;
|
import org.hibernate.sql.ast.spi.SqlExpressionAccess;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
|
@ -77,7 +77,7 @@ public class ResultSetMappingSqlSelection implements SqlSelection, Expression, S
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingModelExpressable getExpressionType() {
|
public MappingModelExpressible getExpressionType() {
|
||||||
return valueMapping;
|
return valueMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class CompleteResultBuilderBasicModelPart
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getJavaType() {
|
public Class<?> getJavaType() {
|
||||||
return modelPart.getExpressableJavaType().getJavaTypeClass();
|
return modelPart.getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class CompleteResultBuilderBasicValuedConverted<O,R> implements CompleteR
|
||||||
// return new SqlSelectionImpl( valuesArrayPosition, basicType );
|
// return new SqlSelectionImpl( valuesArrayPosition, basicType );
|
||||||
// }
|
// }
|
||||||
// ),
|
// ),
|
||||||
// basicType.getExpressableJavaType(),
|
// basicType.getExpressibleJavaType(),
|
||||||
// sessionFactory.getTypeConfiguration()
|
// sessionFactory.getTypeConfiguration()
|
||||||
// );
|
// );
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class CompleteResultBuilderBasicValuedStandard implements CompleteResultB
|
||||||
// return new SqlSelectionImpl( valuesArrayPosition, basicType );
|
// return new SqlSelectionImpl( valuesArrayPosition, basicType );
|
||||||
// }
|
// }
|
||||||
// ),
|
// ),
|
||||||
// basicType.getExpressableJavaType(),
|
// basicType.getExpressibleJavaType(),
|
||||||
// sessionFactory.getTypeConfiguration()
|
// sessionFactory.getTypeConfiguration()
|
||||||
// );
|
// );
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class CompleteResultBuilderCollectionStandard implements CompleteResultBu
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getJavaType() {
|
public Class<?> getJavaType() {
|
||||||
return pluralAttributeDescriptor.getExpressableJavaType().getJavaTypeClass();
|
return pluralAttributeDescriptor.getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class DynamicResultBuilderAttribute implements DynamicResultBuilder, Nati
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getJavaType() {
|
public Class<?> getJavaType() {
|
||||||
return attributeMapping.getExpressableJavaType().getJavaTypeClass();
|
return attributeMapping.getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class ImplicitModelPartResultBuilderBasic
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getJavaType() {
|
public Class<?> getJavaType() {
|
||||||
return modelPart.getExpressableJavaType().getJavaTypeClass();
|
return modelPart.getExpressibleJavaType().getJavaTypeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.hibernate.query.TupleTransformer;
|
||||||
import org.hibernate.query.TypedParameterValue;
|
import org.hibernate.query.TypedParameterValue;
|
||||||
import org.hibernate.query.criteria.JpaExpression;
|
import org.hibernate.query.criteria.JpaExpression;
|
||||||
import org.hibernate.query.internal.QueryOptionsImpl;
|
import org.hibernate.query.internal.QueryOptionsImpl;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmLiteral;
|
import org.hibernate.query.sqm.tree.expression.SqmLiteral;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||||
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
|
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
|
||||||
|
@ -862,10 +862,10 @@ public abstract class AbstractCommonQueryContract implements CommonQueryContract
|
||||||
|
|
||||||
|
|
||||||
private boolean isInstance(BindableType<?> parameterType, Object value) {
|
private boolean isInstance(BindableType<?> parameterType, Object value) {
|
||||||
final SqmExpressable<?> sqmExpressable = parameterType.resolveExpressable( getSession().getFactory() );
|
final SqmExpressible<?> sqmExpressible = parameterType.resolveExpressible( getSession().getFactory() );
|
||||||
assert sqmExpressable != null;
|
assert sqmExpressible != null;
|
||||||
|
|
||||||
return sqmExpressable.getExpressableJavaType().isInstance( value );
|
return sqmExpressible.getExpressibleJavaType().isInstance( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -49,7 +49,7 @@ import org.hibernate.query.TupleTransformer;
|
||||||
import org.hibernate.query.TypedParameterValue;
|
import org.hibernate.query.TypedParameterValue;
|
||||||
import org.hibernate.query.internal.ScrollableResultsIterator;
|
import org.hibernate.query.internal.ScrollableResultsIterator;
|
||||||
import org.hibernate.query.named.NamedQueryMemento;
|
import org.hibernate.query.named.NamedQueryMemento;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.type.BasicType;
|
import org.hibernate.type.BasicType;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
|
@ -635,10 +635,10 @@ public abstract class AbstractQuery<R>
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInstance(BindableType<?> parameterType, Object value) {
|
private boolean isInstance(BindableType<?> parameterType, Object value) {
|
||||||
final SqmExpressable<?> sqmExpressable = parameterType.resolveExpressable( getSession().getFactory() );
|
final SqmExpressible<?> sqmExpressible = parameterType.resolveExpressible( getSession().getFactory() );
|
||||||
assert sqmExpressable != null;
|
assert sqmExpressible != null;
|
||||||
|
|
||||||
return sqmExpressable.getExpressableJavaType().isInstance( value );
|
return sqmExpressible.getExpressibleJavaType().isInstance( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Collection;
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
import org.hibernate.Incubating;
|
import org.hibernate.Incubating;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
||||||
|
@ -111,17 +111,17 @@ public interface QueryParameterBinding<T> {
|
||||||
Collection<? extends T> getBindValues();
|
Collection<? extends T> getBindValues();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the inferred mapping model expressable i.e. the model reference against which this parameter is compared.
|
* Returns the inferred mapping model expressible i.e. the model reference against which this parameter is compared.
|
||||||
*
|
*
|
||||||
* @return the inferred mapping model expressable or <code>null</code>
|
* @return the inferred mapping model expressible or <code>null</code>
|
||||||
*/
|
*/
|
||||||
MappingModelExpressable<T> getType();
|
MappingModelExpressible<T> getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the mapping model expressable for this parameter.
|
* Sets the mapping model expressible for this parameter.
|
||||||
*
|
*
|
||||||
* @param type The mapping model expressable
|
* @param type The mapping model expressible
|
||||||
* @return Whether the bind type was changed
|
* @return Whether the bind type was changed
|
||||||
*/
|
*/
|
||||||
boolean setType(MappingModelExpressable<T> type);
|
boolean setType(MappingModelExpressible<T> type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Date;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter;
|
import org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ public class QueryParameterBindingValidator {
|
||||||
parameterJavaType = paramType.getBindableJavaType();
|
parameterJavaType = paramType.getBindableJavaType();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final SqmExpressable<?> sqmExpressable = paramType.resolveExpressable( sessionFactory );
|
final SqmExpressible<?> sqmExpressible = paramType.resolveExpressible( sessionFactory );
|
||||||
parameterJavaType = sqmExpressable.getBindableJavaType();
|
parameterJavaType = sqmExpressible.getBindableJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( parameterJavaType == null ) {
|
if ( parameterJavaType == null ) {
|
||||||
|
|
|
@ -91,11 +91,11 @@ public interface NodeBuilder extends HibernateCriteriaBuilder {
|
||||||
List<? extends SqmExpression<?>> expressions);
|
List<? extends SqmExpression<?>> expressions);
|
||||||
|
|
||||||
<R> SqmTuple<R> tuple(
|
<R> SqmTuple<R> tuple(
|
||||||
SqmExpressable<R> tupleType,
|
SqmExpressible<R> tupleType,
|
||||||
SqmExpression<?>... expressions);
|
SqmExpression<?>... expressions);
|
||||||
|
|
||||||
<R> SqmTuple<R> tuple(
|
<R> SqmTuple<R> tuple(
|
||||||
SqmExpressable<R> tupleType,
|
SqmExpressible<R> tupleType,
|
||||||
List<? extends SqmExpression<?>> expressions);
|
List<? extends SqmExpression<?>> expressions);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,14 +19,14 @@ import org.hibernate.type.descriptor.java.JavaType;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface SqmExpressable<J> extends BindableType<J> {
|
public interface SqmExpressible<J> extends BindableType<J> {
|
||||||
/**
|
/**
|
||||||
* The Java type descriptor for this expressable
|
* The Java type descriptor for this expressible
|
||||||
*/
|
*/
|
||||||
JavaType<J> getExpressableJavaType();
|
JavaType<J> getExpressibleJavaType();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default SqmExpressable<J> resolveExpressable(SessionFactoryImplementor sessionFactory) {
|
default SqmExpressible<J> resolveExpressible(SessionFactoryImplementor sessionFactory) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ import jakarta.persistence.metamodel.Bindable;
|
||||||
import org.hibernate.metamodel.model.domain.DomainType;
|
import org.hibernate.metamodel.model.domain.DomainType;
|
||||||
import org.hibernate.query.SemanticException;
|
import org.hibernate.query.SemanticException;
|
||||||
import org.hibernate.query.spi.NavigablePath;
|
import org.hibernate.query.spi.NavigablePath;
|
||||||
import org.hibernate.query.sqm.tree.SqmExpressableAccessor;
|
import org.hibernate.query.sqm.tree.SqmExpressibleAccessor;
|
||||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +25,7 @@ import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface SqmPathSource<J> extends SqmExpressable<J>, Bindable<J>, SqmExpressableAccessor<J> {
|
public interface SqmPathSource<J> extends SqmExpressible<J>, Bindable<J>, SqmExpressibleAccessor<J> {
|
||||||
/**
|
/**
|
||||||
* The name of this thing. Mainly used in logging and when creating a
|
* The name of this thing. Mainly used in logging and when creating a
|
||||||
* {@link NavigablePath}
|
* {@link NavigablePath}
|
||||||
|
@ -62,7 +62,7 @@ public interface SqmPathSource<J> extends SqmExpressable<J>, Bindable<J>, SqmExp
|
||||||
Locale.ROOT,
|
Locale.ROOT,
|
||||||
"Could not resolve attribute '%s' of '%s'",
|
"Could not resolve attribute '%s' of '%s'",
|
||||||
name,
|
name,
|
||||||
getExpressable().getExpressableJavaType().getJavaType().getTypeName()
|
getExpressible().getExpressibleJavaType().getJavaType().getTypeName()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -83,7 +83,7 @@ public interface SqmPathSource<J> extends SqmExpressable<J>, Bindable<J>, SqmExp
|
||||||
SqmPath<J> createSqmPath(SqmPath<?> lhs, SqmPathSource<?> intermediatePathSource);
|
SqmPath<J> createSqmPath(SqmPath<?> lhs, SqmPathSource<?> intermediatePathSource);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default SqmExpressable<J> getExpressable() {
|
default SqmExpressible<J> getExpressible() {
|
||||||
return (SqmExpressable<J>) getSqmPathType();
|
return (SqmExpressible<J>) getSqmPathType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ public class SelfRenderingAggregateFunctionSqlAstExpression extends SelfRenderin
|
||||||
List<? extends SqlAstNode> sqlAstArguments,
|
List<? extends SqlAstNode> sqlAstArguments,
|
||||||
Predicate filter,
|
Predicate filter,
|
||||||
ReturnableType<?> type,
|
ReturnableType<?> type,
|
||||||
JdbcMappingContainer expressable) {
|
JdbcMappingContainer expressible) {
|
||||||
super( functionName, renderer, sqlAstArguments, type, expressable );
|
super( functionName, renderer, sqlAstArguments, type, expressible );
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.hibernate.mapping.Selectable;
|
||||||
import org.hibernate.mapping.Table;
|
import org.hibernate.mapping.Table;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
||||||
import org.hibernate.metamodel.mapping.SqlExpressable;
|
import org.hibernate.metamodel.mapping.SqlExpressible;
|
||||||
import org.hibernate.query.ReturnableType;
|
import org.hibernate.query.ReturnableType;
|
||||||
import org.hibernate.query.sqm.sql.internal.DomainResultProducer;
|
import org.hibernate.query.sqm.sql.internal.DomainResultProducer;
|
||||||
import org.hibernate.sql.ast.SqlAstTranslator;
|
import org.hibernate.sql.ast.SqlAstTranslator;
|
||||||
|
@ -41,25 +41,25 @@ import org.hibernate.type.spi.TypeConfiguration;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class SelfRenderingFunctionSqlAstExpression
|
public class SelfRenderingFunctionSqlAstExpression
|
||||||
implements SelfRenderingExpression, Selectable, SqlExpressable, DomainResultProducer, FunctionExpression {
|
implements SelfRenderingExpression, Selectable, SqlExpressible, DomainResultProducer, FunctionExpression {
|
||||||
private final String functionName;
|
private final String functionName;
|
||||||
private final FunctionRenderingSupport renderer;
|
private final FunctionRenderingSupport renderer;
|
||||||
private final List<? extends SqlAstNode> sqlAstArguments;
|
private final List<? extends SqlAstNode> sqlAstArguments;
|
||||||
private final ReturnableType<?> type;
|
private final ReturnableType<?> type;
|
||||||
private final JdbcMappingContainer expressable;
|
private final JdbcMappingContainer expressible;
|
||||||
|
|
||||||
public SelfRenderingFunctionSqlAstExpression(
|
public SelfRenderingFunctionSqlAstExpression(
|
||||||
String functionName,
|
String functionName,
|
||||||
FunctionRenderingSupport renderer,
|
FunctionRenderingSupport renderer,
|
||||||
List<? extends SqlAstNode> sqlAstArguments,
|
List<? extends SqlAstNode> sqlAstArguments,
|
||||||
ReturnableType<?> type,
|
ReturnableType<?> type,
|
||||||
JdbcMappingContainer expressable) {
|
JdbcMappingContainer expressible) {
|
||||||
this.functionName = functionName;
|
this.functionName = functionName;
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
this.sqlAstArguments = sqlAstArguments;
|
this.sqlAstArguments = sqlAstArguments;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
//might be null due to code in SelfRenderingFunctionSqlAstExpression
|
//might be null due to code in SelfRenderingFunctionSqlAstExpression
|
||||||
this.expressable = expressable;
|
this.expressible = expressible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -74,10 +74,10 @@ public class SelfRenderingFunctionSqlAstExpression
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JdbcMappingContainer getExpressionType() {
|
public JdbcMappingContainer getExpressionType() {
|
||||||
if ( type instanceof SqlExpressable ) {
|
if ( type instanceof SqlExpressible) {
|
||||||
return (JdbcMappingContainer) type;
|
return (JdbcMappingContainer) type;
|
||||||
}
|
}
|
||||||
return expressable;
|
return expressible;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FunctionRenderingSupport getRenderer() {
|
protected FunctionRenderingSupport getRenderer() {
|
||||||
|
@ -105,13 +105,13 @@ public class SelfRenderingFunctionSqlAstExpression
|
||||||
creationState.getSqlAstCreationState().getSqlExpressionResolver()
|
creationState.getSqlAstCreationState().getSqlExpressionResolver()
|
||||||
.resolveSqlSelection(
|
.resolveSqlSelection(
|
||||||
this,
|
this,
|
||||||
type.getExpressableJavaType(),
|
type.getExpressibleJavaType(),
|
||||||
creationState.getSqlAstCreationState().getCreationContext()
|
creationState.getSqlAstCreationState().getCreationContext()
|
||||||
.getDomainModel().getTypeConfiguration()
|
.getDomainModel().getTypeConfiguration()
|
||||||
)
|
)
|
||||||
.getValuesArrayPosition(),
|
.getValuesArrayPosition(),
|
||||||
resultVariable,
|
resultVariable,
|
||||||
type.getExpressableJavaType()
|
type.getExpressibleJavaType()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,11 +165,11 @@ public class SelfRenderingFunctionSqlAstExpression
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JdbcMapping getJdbcMapping() {
|
public JdbcMapping getJdbcMapping() {
|
||||||
if ( type instanceof SqlExpressable ) {
|
if ( type instanceof SqlExpressible) {
|
||||||
return ( (SqlExpressable) type ).getJdbcMapping();
|
return ( (SqlExpressible) type ).getJdbcMapping();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return ( (SqlExpressable) expressable ).getJdbcMapping();
|
return ( (SqlExpressible) expressible).getJdbcMapping();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ public class SelfRenderingFunctionSqlAstExpression
|
||||||
|
|
||||||
sqlExpressionResolver.resolveSqlSelection(
|
sqlExpressionResolver.resolveSqlSelection(
|
||||||
this,
|
this,
|
||||||
type.getExpressableJavaType(),
|
type.getExpressibleJavaType(),
|
||||||
sqlAstCreationState.getCreationContext().getDomainModel().getTypeConfiguration()
|
sqlAstCreationState.getCreationContext().getDomainModel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class SelfRenderingSqmAggregateFunction<T> extends SelfRenderingSqmFuncti
|
||||||
resolveSqlAstArguments( getArguments(), walker ),
|
resolveSqlAstArguments( getArguments(), walker ),
|
||||||
filter == null ? null : (Predicate) filter.accept( walker ),
|
filter == null ? null : (Predicate) filter.accept( walker ),
|
||||||
resultType,
|
resultType,
|
||||||
getMappingModelExpressable( walker, resultType )
|
getMappingModelExpressible( walker, resultType )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,10 @@ import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.metamodel.MappingMetamodel;
|
import org.hibernate.metamodel.MappingMetamodel;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.ReturnableType;
|
import org.hibernate.query.ReturnableType;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||||
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
||||||
import org.hibernate.query.sqm.sql.SqmToSqlAstConverter;
|
import org.hibernate.query.sqm.sql.SqmToSqlAstConverter;
|
||||||
|
@ -87,14 +87,14 @@ public class SelfRenderingSqmFunction<T> extends SqmFunction<T> {
|
||||||
getRenderingSupport(),
|
getRenderingSupport(),
|
||||||
arguments,
|
arguments,
|
||||||
resultType,
|
resultType,
|
||||||
resultType == null ? null : getMappingModelExpressable( walker, resultType )
|
resultType == null ? null : getMappingModelExpressible( walker, resultType )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqmExpressable<T> getNodeType() {
|
public SqmExpressible<T> getNodeType() {
|
||||||
SqmExpressable<T> nodeType = super.getNodeType();
|
SqmExpressible<T> nodeType = super.getNodeType();
|
||||||
if ( nodeType == null ) {
|
if ( nodeType == null ) {
|
||||||
nodeType = (SqmExpressable<T>) resolveResultType( nodeBuilder().getTypeConfiguration() );
|
nodeType = (SqmExpressible<T>) resolveResultType( nodeBuilder().getTypeConfiguration() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodeType;
|
return nodeType;
|
||||||
|
@ -107,19 +107,19 @@ public class SelfRenderingSqmFunction<T> extends SqmFunction<T> {
|
||||||
getArguments(),
|
getArguments(),
|
||||||
typeConfiguration
|
typeConfiguration
|
||||||
);
|
);
|
||||||
setExpressableType( resultType );
|
setExpressibleType( resultType );
|
||||||
}
|
}
|
||||||
return resultType;
|
return resultType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MappingModelExpressable<?> getMappingModelExpressable(
|
protected MappingModelExpressible<?> getMappingModelExpressible(
|
||||||
SqmToSqlAstConverter walker,
|
SqmToSqlAstConverter walker,
|
||||||
ReturnableType<?> resultType) {
|
ReturnableType<?> resultType) {
|
||||||
MappingModelExpressable<?> mapping;
|
MappingModelExpressible<?> mapping;
|
||||||
if ( resultType instanceof MappingModelExpressable ) {
|
if ( resultType instanceof MappingModelExpressible) {
|
||||||
// here we have a BasicType, which can be cast
|
// here we have a BasicType, which can be cast
|
||||||
// directly to BasicValuedMapping
|
// directly to BasicValuedMapping
|
||||||
mapping = (MappingModelExpressable<?>) resultType;
|
mapping = (MappingModelExpressible<?>) resultType;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// here we have something that is not a BasicType,
|
// here we have something that is not a BasicType,
|
||||||
|
@ -129,7 +129,7 @@ public class SelfRenderingSqmFunction<T> extends SqmFunction<T> {
|
||||||
() -> {
|
() -> {
|
||||||
try {
|
try {
|
||||||
final MappingMetamodel domainModel = walker.getCreationContext().getDomainModel();
|
final MappingMetamodel domainModel = walker.getCreationContext().getDomainModel();
|
||||||
return (BasicValuedMapping) domainModel.resolveMappingExpressable(
|
return (BasicValuedMapping) domainModel.resolveMappingExpressible(
|
||||||
getNodeType(),
|
getNodeType(),
|
||||||
walker.getFromClauseAccess()::getTableGroup
|
walker.getFromClauseAccess()::getTableGroup
|
||||||
);
|
);
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.engine.spi.SubselectFetch;
|
import org.hibernate.engine.spi.SubselectFetch;
|
||||||
import org.hibernate.internal.EmptyScrollableResults;
|
import org.hibernate.internal.EmptyScrollableResults;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.IllegalQueryOperationException;
|
import org.hibernate.query.IllegalQueryOperationException;
|
||||||
import org.hibernate.query.TupleTransformer;
|
import org.hibernate.query.TupleTransformer;
|
||||||
import org.hibernate.query.criteria.JpaSelection;
|
import org.hibernate.query.criteria.JpaSelection;
|
||||||
|
@ -339,8 +339,8 @@ public class ConcreteSqmSelectQueryPlan<R> implements SelectQueryPlan<R> {
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
//this is pretty ugly!
|
//this is pretty ugly!
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) sqmInterpretation.getSqmParameterMappingModelTypes().get(parameter);
|
return (MappingModelExpressible<T>) sqmInterpretation.getSqmParameterMappingModelTypes().get(parameter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
session
|
session
|
||||||
|
@ -390,8 +390,8 @@ public class ConcreteSqmSelectQueryPlan<R> implements SelectQueryPlan<R> {
|
||||||
tableGroupAccess::findTableGroup,
|
tableGroupAccess::findTableGroup,
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) sqmInterpretation.getSqmParameterMappingModelTypeResolutions().get(parameter);
|
return (MappingModelExpressible<T>) sqmInterpretation.getSqmParameterMappingModelTypeResolutions().get(parameter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
session
|
session
|
||||||
|
@ -421,7 +421,7 @@ public class ConcreteSqmSelectQueryPlan<R> implements SelectQueryPlan<R> {
|
||||||
private final JdbcSelect jdbcSelect;
|
private final JdbcSelect jdbcSelect;
|
||||||
private final FromClauseAccess tableGroupAccess;
|
private final FromClauseAccess tableGroupAccess;
|
||||||
private final Map<QueryParameterImplementor<?>, Map<SqmParameter<?>, List<List<JdbcParameter>>>> jdbcParamsXref;
|
private final Map<QueryParameterImplementor<?>, Map<SqmParameter<?>, List<List<JdbcParameter>>>> jdbcParamsXref;
|
||||||
private final Map<SqmParameter<?>, MappingModelExpressable<?>> sqmParameterMappingModelTypes;
|
private final Map<SqmParameter<?>, MappingModelExpressible<?>> sqmParameterMappingModelTypes;
|
||||||
private transient JdbcParameterBindings firstParameterBindings;
|
private transient JdbcParameterBindings firstParameterBindings;
|
||||||
|
|
||||||
CacheableSqmInterpretation(
|
CacheableSqmInterpretation(
|
||||||
|
@ -429,7 +429,7 @@ public class ConcreteSqmSelectQueryPlan<R> implements SelectQueryPlan<R> {
|
||||||
JdbcSelect jdbcSelect,
|
JdbcSelect jdbcSelect,
|
||||||
FromClauseAccess tableGroupAccess,
|
FromClauseAccess tableGroupAccess,
|
||||||
Map<QueryParameterImplementor<?>, Map<SqmParameter<?>, List<List<JdbcParameter>>>> jdbcParamsXref,
|
Map<QueryParameterImplementor<?>, Map<SqmParameter<?>, List<List<JdbcParameter>>>> jdbcParamsXref,
|
||||||
Map<SqmParameter<?>,MappingModelExpressable<?>> sqmParameterMappingModelTypes,
|
Map<SqmParameter<?>, MappingModelExpressible<?>> sqmParameterMappingModelTypes,
|
||||||
JdbcParameterBindings firstParameterBindings) {
|
JdbcParameterBindings firstParameterBindings) {
|
||||||
this.selectStatement = selectStatement;
|
this.selectStatement = selectStatement;
|
||||||
this.jdbcSelect = jdbcSelect;
|
this.jdbcSelect = jdbcSelect;
|
||||||
|
@ -455,7 +455,7 @@ public class ConcreteSqmSelectQueryPlan<R> implements SelectQueryPlan<R> {
|
||||||
return jdbcParamsXref;
|
return jdbcParamsXref;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<SqmParameter<?>, MappingModelExpressable<?>> getSqmParameterMappingModelTypes() {
|
public Map<SqmParameter<?>, MappingModelExpressible<?>> getSqmParameterMappingModelTypes() {
|
||||||
return sqmParameterMappingModelTypes;
|
return sqmParameterMappingModelTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ import org.hibernate.query.spi.QueryParameterBindings;
|
||||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||||
import org.hibernate.query.spi.ScrollableResultsImplementor;
|
import org.hibernate.query.spi.ScrollableResultsImplementor;
|
||||||
import org.hibernate.query.spi.SelectQueryPlan;
|
import org.hibernate.query.spi.SelectQueryPlan;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SqmPathSource;
|
import org.hibernate.query.sqm.SqmPathSource;
|
||||||
import org.hibernate.query.sqm.internal.SqmInterpretationsKey.InterpretationsKeySource;
|
import org.hibernate.query.sqm.internal.SqmInterpretationsKey.InterpretationsKeySource;
|
||||||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
|
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
|
||||||
|
@ -372,7 +372,7 @@ public class QuerySqmImpl<R>
|
||||||
final SqmParameter<?> sqmParameter = (SqmParameter<?>) sqmSelection.getSelectableNode();
|
final SqmParameter<?> sqmParameter = (SqmParameter<?>) sqmSelection.getSelectableNode();
|
||||||
|
|
||||||
// we may not yet know a selection type
|
// we may not yet know a selection type
|
||||||
if ( sqmParameter.getNodeType() == null || sqmParameter.getNodeType().getExpressableJavaType() == null ) {
|
if ( sqmParameter.getNodeType() == null || sqmParameter.getNodeType().getExpressibleJavaType() == null ) {
|
||||||
// we can't verify the result type up front
|
// we can't verify the result type up front
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -384,22 +384,22 @@ public class QuerySqmImpl<R>
|
||||||
|
|
||||||
private static <T> void verifyResultType(
|
private static <T> void verifyResultType(
|
||||||
Class<T> resultClass,
|
Class<T> resultClass,
|
||||||
SqmExpressable<?> sqmExpressable,
|
SqmExpressible<?> sqmExpressible,
|
||||||
SessionFactoryImplementor sessionFactory) {
|
SessionFactoryImplementor sessionFactory) {
|
||||||
assert sqmExpressable != null;
|
assert sqmExpressible != null;
|
||||||
assert sqmExpressable.getExpressableJavaType() != null;
|
assert sqmExpressible.getExpressibleJavaType() != null;
|
||||||
|
|
||||||
final Class<?> javaTypeClass = sqmExpressable.getExpressableJavaType().getJavaTypeClass();
|
final Class<?> javaTypeClass = sqmExpressible.getExpressibleJavaType().getJavaTypeClass();
|
||||||
if ( ! resultClass.isAssignableFrom( javaTypeClass ) ) {
|
if ( ! resultClass.isAssignableFrom( javaTypeClass ) ) {
|
||||||
// Special case for date because we always report java.util.Date as expression type
|
// Special case for date because we always report java.util.Date as expression type
|
||||||
// But the expected resultClass could be a subtype of that, so we need to check the JdbcType
|
// But the expected resultClass could be a subtype of that, so we need to check the JdbcType
|
||||||
if ( javaTypeClass == Date.class ) {
|
if ( javaTypeClass == Date.class ) {
|
||||||
JdbcType jdbcType = null;
|
JdbcType jdbcType = null;
|
||||||
if ( sqmExpressable instanceof BasicDomainType<?> ) {
|
if ( sqmExpressible instanceof BasicDomainType<?> ) {
|
||||||
jdbcType = ( (BasicDomainType<?>) sqmExpressable ).getJdbcType();
|
jdbcType = ( (BasicDomainType<?>) sqmExpressible).getJdbcType();
|
||||||
}
|
}
|
||||||
else if ( sqmExpressable instanceof SqmPathSource<?> ) {
|
else if ( sqmExpressible instanceof SqmPathSource<?> ) {
|
||||||
final DomainType<?> domainType = ( (SqmPathSource<?>) sqmExpressable ).getSqmPathType();
|
final DomainType<?> domainType = ( (SqmPathSource<?>) sqmExpressible).getSqmPathType();
|
||||||
if ( domainType instanceof BasicDomainType<?> ) {
|
if ( domainType instanceof BasicDomainType<?> ) {
|
||||||
jdbcType = ( (BasicDomainType<?>) domainType ).getJdbcType();
|
jdbcType = ( (BasicDomainType<?>) domainType ).getJdbcType();
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ public class QuerySqmImpl<R>
|
||||||
final String errorMessage = String.format(
|
final String errorMessage = String.format(
|
||||||
"Specified result type [%s] did not match Query selection type [%s] - multiple selections: use Tuple or array",
|
"Specified result type [%s] did not match Query selection type [%s] - multiple selections: use Tuple or array",
|
||||||
resultClass.getName(),
|
resultClass.getName(),
|
||||||
sqmExpressable.getExpressableJavaType().getJavaType().getTypeName()
|
sqmExpressible.getExpressibleJavaType().getJavaType().getTypeName()
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( sessionFactory.getSessionFactoryOptions().getJpaCompliance().isJpaQueryComplianceEnabled() ) {
|
if ( sessionFactory.getSessionFactoryOptions().getJpaCompliance().isJpaQueryComplianceEnabled() ) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelHelper;
|
import org.hibernate.metamodel.mapping.MappingModelHelper;
|
||||||
import org.hibernate.query.spi.NavigablePath;
|
import org.hibernate.query.spi.NavigablePath;
|
||||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||||
|
@ -107,8 +107,8 @@ public class SimpleDeleteQueryPlan implements NonSelectQueryPlan {
|
||||||
sqmInterpretation.getFromClauseAccess()::findTableGroup,
|
sqmInterpretation.getFromClauseAccess()::findTableGroup,
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) sqmInterpretation.getSqmParameterMappingModelTypeResolutions().get(parameter);
|
return (MappingModelExpressible<T>) sqmInterpretation.getSqmParameterMappingModelTypeResolutions().get(parameter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
session
|
session
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.hibernate.action.internal.BulkOperationCleanupAction;
|
||||||
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;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||||
import org.hibernate.query.spi.NonSelectQueryPlan;
|
import org.hibernate.query.spi.NonSelectQueryPlan;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
|
@ -37,7 +37,7 @@ import org.hibernate.sql.exec.spi.JdbcParameterBindings;
|
||||||
public class SimpleInsertQueryPlan implements NonSelectQueryPlan {
|
public class SimpleInsertQueryPlan implements NonSelectQueryPlan {
|
||||||
private final SqmInsertStatement<?> sqmInsert;
|
private final SqmInsertStatement<?> sqmInsert;
|
||||||
private final DomainParameterXref domainParameterXref;
|
private final DomainParameterXref domainParameterXref;
|
||||||
private Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions;
|
private Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions;
|
||||||
|
|
||||||
private JdbcInsert jdbcInsert;
|
private JdbcInsert jdbcInsert;
|
||||||
private FromClauseAccess tableGroupAccess;
|
private FromClauseAccess tableGroupAccess;
|
||||||
|
@ -100,8 +100,8 @@ public class SimpleInsertQueryPlan implements NonSelectQueryPlan {
|
||||||
tableGroupAccess::findTableGroup,
|
tableGroupAccess::findTableGroup,
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) paramTypeResolutions.get(parameter);
|
return (MappingModelExpressible<T>) paramTypeResolutions.get(parameter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
session
|
session
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.hibernate.action.internal.BulkOperationCleanupAction;
|
||||||
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;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||||
import org.hibernate.query.spi.NonSelectQueryPlan;
|
import org.hibernate.query.spi.NonSelectQueryPlan;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
|
@ -41,7 +41,7 @@ public class SimpleUpdateQueryPlan implements NonSelectQueryPlan {
|
||||||
private JdbcUpdate jdbcUpdate;
|
private JdbcUpdate jdbcUpdate;
|
||||||
private FromClauseAccess tableGroupAccess;
|
private FromClauseAccess tableGroupAccess;
|
||||||
private Map<QueryParameterImplementor<?>, Map<SqmParameter<?>, List<List<JdbcParameter>>>> jdbcParamsXref;
|
private Map<QueryParameterImplementor<?>, Map<SqmParameter<?>, List<List<JdbcParameter>>>> jdbcParamsXref;
|
||||||
private Map<SqmParameter<?>,MappingModelExpressable<?>> sqmParamMappingTypeResolutions;
|
private Map<SqmParameter<?>, MappingModelExpressible<?>> sqmParamMappingTypeResolutions;
|
||||||
|
|
||||||
public SimpleUpdateQueryPlan(
|
public SimpleUpdateQueryPlan(
|
||||||
SqmUpdateStatement<?> sqmUpdate,
|
SqmUpdateStatement<?> sqmUpdate,
|
||||||
|
@ -69,8 +69,8 @@ public class SimpleUpdateQueryPlan implements NonSelectQueryPlan {
|
||||||
tableGroupAccess::findTableGroup,
|
tableGroupAccess::findTableGroup,
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) sqmParamMappingTypeResolutions.get(parameter);
|
return (MappingModelExpressible<T>) sqmParamMappingTypeResolutions.get(parameter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
session
|
session
|
||||||
|
|
|
@ -55,7 +55,7 @@ import org.hibernate.query.criteria.JpaSelection;
|
||||||
import org.hibernate.query.criteria.ValueHandlingMode;
|
import org.hibernate.query.criteria.ValueHandlingMode;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SqmQuerySource;
|
import org.hibernate.query.sqm.SqmQuerySource;
|
||||||
import org.hibernate.query.sqm.function.NamedSqmFunctionDescriptor;
|
import org.hibernate.query.sqm.function.NamedSqmFunctionDescriptor;
|
||||||
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
||||||
|
@ -449,24 +449,24 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
||||||
final TypeConfiguration typeConfiguration = getTypeConfiguration();
|
final TypeConfiguration typeConfiguration = getTypeConfiguration();
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final List<SqmExpression<?>> sqmExpressions = (List<SqmExpression<?>>) expressions;
|
final List<SqmExpression<?>> sqmExpressions = (List<SqmExpression<?>>) expressions;
|
||||||
final SqmExpressable<R> expressableType;
|
final SqmExpressible<R> expressibleType;
|
||||||
if ( tupleType == null || tupleType == Object[].class ) {
|
if ( tupleType == null || tupleType == Object[].class ) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
expressableType = (DomainType<R>) typeConfiguration.resolveTupleType( sqmExpressions );
|
expressibleType = (DomainType<R>) typeConfiguration.resolveTupleType( sqmExpressions );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
expressableType = typeConfiguration.getSessionFactory().getMetamodel().embeddable( tupleType );
|
expressibleType = typeConfiguration.getSessionFactory().getMetamodel().embeddable( tupleType );
|
||||||
}
|
}
|
||||||
return tuple( expressableType, sqmExpressions );
|
return tuple( expressibleType, sqmExpressions );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R> SqmTuple<R> tuple(SqmExpressable<R> tupleType, SqmExpression<?>... expressions) {
|
public <R> SqmTuple<R> tuple(SqmExpressible<R> tupleType, SqmExpression<?>... expressions) {
|
||||||
return tuple( tupleType, asList( expressions ) );
|
return tuple( tupleType, asList( expressions ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R> SqmTuple<R> tuple(SqmExpressable<R> tupleType, List<? extends SqmExpression<?>> sqmExpressions) {
|
public <R> SqmTuple<R> tuple(SqmExpressible<R> tupleType, List<? extends SqmExpression<?>> sqmExpressions) {
|
||||||
if ( tupleType == null ) {
|
if ( tupleType == null ) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
tupleType = (DomainType<R>) getTypeConfiguration().resolveTupleType( sqmExpressions );
|
tupleType = (DomainType<R>) getTypeConfiguration().resolveTupleType( sqmExpressions );
|
||||||
|
@ -704,7 +704,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
||||||
operator,
|
operator,
|
||||||
leftHandExpression,
|
leftHandExpression,
|
||||||
rightHandExpression,
|
rightHandExpression,
|
||||||
(SqmExpressable<N>) getDomainModel().getTypeConfiguration().resolveArithmeticType(
|
(SqmExpressible<N>) getDomainModel().getTypeConfiguration().resolveArithmeticType(
|
||||||
leftHandExpression.getNodeType(),
|
leftHandExpression.getNodeType(),
|
||||||
rightHandExpression.getNodeType(),
|
rightHandExpression.getNodeType(),
|
||||||
operator
|
operator
|
||||||
|
@ -891,17 +891,17 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
||||||
return new SqmLiteralNull<>( this );
|
return new SqmLiteralNull<>( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
final SqmExpressable<T> expressible = resolveInferredType( value, typeInferenceSource, getTypeConfiguration() );
|
final SqmExpressible<T> expressible = resolveInferredType( value, typeInferenceSource, getTypeConfiguration() );
|
||||||
return new SqmLiteral<>( value, expressible, this );
|
return new SqmLiteral<>( value, expressible, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> SqmExpressable<T> resolveInferredType(
|
private static <T> SqmExpressible<T> resolveInferredType(
|
||||||
T value,
|
T value,
|
||||||
SqmExpression<? extends T> typeInferenceSource,
|
SqmExpression<? extends T> typeInferenceSource,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
if ( typeInferenceSource != null ) {
|
if ( typeInferenceSource != null ) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return (SqmExpressable<T>) typeInferenceSource.getNodeType();
|
return (SqmExpressible<T>) typeInferenceSource.getNodeType();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
|
@ -924,11 +924,11 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
||||||
final BindableType<? extends T> valueParamType = queryEngine.getTypeConfiguration()
|
final BindableType<? extends T> valueParamType = queryEngine.getTypeConfiguration()
|
||||||
.getSessionFactory()
|
.getSessionFactory()
|
||||||
.resolveParameterBindType( value );
|
.resolveParameterBindType( value );
|
||||||
final SqmExpressable<? extends T> sqmExpressable = valueParamType == null
|
final SqmExpressible<? extends T> sqmExpressible = valueParamType == null
|
||||||
? null
|
? null
|
||||||
: valueParamType.resolveExpressable( getTypeConfiguration().getSessionFactory() );
|
: valueParamType.resolveExpressible( getTypeConfiguration().getSessionFactory() );
|
||||||
|
|
||||||
return new SqmLiteral<>( value, sqmExpressable, this );
|
return new SqmLiteral<>( value, sqmExpressible, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -961,19 +961,19 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
||||||
public <T> SqmExpression<T> nullLiteral(Class<T> resultClass) {
|
public <T> SqmExpression<T> nullLiteral(Class<T> resultClass) {
|
||||||
final TypeConfiguration typeConfiguration = getTypeConfiguration();
|
final TypeConfiguration typeConfiguration = getTypeConfiguration();
|
||||||
final BasicType<T> basicTypeForJavaType = typeConfiguration.getBasicTypeForJavaType( resultClass );
|
final BasicType<T> basicTypeForJavaType = typeConfiguration.getBasicTypeForJavaType( resultClass );
|
||||||
final SqmExpressable<T> sqmExpressable;
|
final SqmExpressible<T> sqmExpressible;
|
||||||
if ( basicTypeForJavaType == null ) {
|
if ( basicTypeForJavaType == null ) {
|
||||||
sqmExpressable = typeConfiguration.getSessionFactory()
|
sqmExpressible = typeConfiguration.getSessionFactory()
|
||||||
.getMetamodel()
|
.getMetamodel()
|
||||||
.managedType( resultClass );
|
.managedType( resultClass );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sqmExpressable = basicTypeForJavaType;
|
sqmExpressible = basicTypeForJavaType;
|
||||||
}
|
}
|
||||||
return new SqmLiteralNull<>( sqmExpressable, this );
|
return new SqmLiteralNull<>(sqmExpressible, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
class MultiValueParameterType<T> implements SqmExpressable<T> {
|
class MultiValueParameterType<T> implements SqmExpressible<T> {
|
||||||
private final JavaType<T> javaType;
|
private final JavaType<T> javaType;
|
||||||
|
|
||||||
public MultiValueParameterType(Class<T> type) {
|
public MultiValueParameterType(Class<T> type) {
|
||||||
|
@ -984,7 +984,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<T> getExpressableJavaType() {
|
public JavaType<T> getExpressibleJavaType() {
|
||||||
return javaType;
|
return javaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1501,12 +1501,12 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
||||||
@Override
|
@Override
|
||||||
public <Y> JpaCoalesce<Y> coalesce(Expression<? extends Y> x, Expression<? extends Y> y) {
|
public <Y> JpaCoalesce<Y> coalesce(Expression<? extends Y> x, Expression<? extends Y> y) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final SqmExpressable<Y> sqmExpressable = (SqmExpressable<Y>) highestPrecedenceType(
|
final SqmExpressible<Y> sqmExpressible = (SqmExpressible<Y>) highestPrecedenceType(
|
||||||
( (SqmExpression<? extends Y>) x ).getNodeType(),
|
( (SqmExpression<? extends Y>) x ).getNodeType(),
|
||||||
( (SqmExpression<? extends Y>) y ).getNodeType()
|
( (SqmExpression<? extends Y>) y ).getNodeType()
|
||||||
);
|
);
|
||||||
return new SqmCoalesce<>(
|
return new SqmCoalesce<>(
|
||||||
sqmExpressable,
|
sqmExpressible,
|
||||||
2,
|
2,
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import jakarta.persistence.metamodel.Bindable;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.CollectionPart;
|
import org.hibernate.metamodel.mapping.CollectionPart;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.ModelPart;
|
import org.hibernate.metamodel.mapping.ModelPart;
|
||||||
import org.hibernate.metamodel.mapping.ModelPartContainer;
|
import org.hibernate.metamodel.mapping.ModelPartContainer;
|
||||||
import org.hibernate.metamodel.model.domain.AnyMappingDomainType;
|
import org.hibernate.metamodel.model.domain.AnyMappingDomainType;
|
||||||
|
@ -27,7 +27,7 @@ import org.hibernate.metamodel.model.domain.internal.EntitySqmPathSource;
|
||||||
import org.hibernate.metamodel.MappingMetamodel;
|
import org.hibernate.metamodel.MappingMetamodel;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.query.spi.NavigablePath;
|
import org.hibernate.query.spi.NavigablePath;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SqmPathSource;
|
import org.hibernate.query.sqm.SqmPathSource;
|
||||||
import org.hibernate.query.sqm.sql.SqmToSqlAstConverter;
|
import org.hibernate.query.sqm.sql.SqmToSqlAstConverter;
|
||||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||||
|
@ -112,17 +112,17 @@ public class SqmMappingModelHelper {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MappingModelExpressable resolveMappingModelExpressable(
|
public static MappingModelExpressible<?> resolveMappingModelExpressible(
|
||||||
SqmTypedNode<?> sqmNode,
|
SqmTypedNode<?> sqmNode,
|
||||||
MappingMetamodel domainModel,
|
MappingMetamodel domainModel,
|
||||||
Function<NavigablePath,TableGroup> tableGroupLocator) {
|
Function<NavigablePath,TableGroup> tableGroupLocator) {
|
||||||
if ( sqmNode instanceof SqmPath ) {
|
if ( sqmNode instanceof SqmPath ) {
|
||||||
return resolveSqmPath( (SqmPath) sqmNode, domainModel, tableGroupLocator );
|
return resolveSqmPath( (SqmPath<?>) sqmNode, domainModel, tableGroupLocator );
|
||||||
}
|
}
|
||||||
|
|
||||||
final SqmExpressable<?> nodeType = sqmNode.getNodeType();
|
final SqmExpressible<?> nodeType = sqmNode.getNodeType();
|
||||||
if ( nodeType instanceof BasicType ) {
|
if ( nodeType instanceof BasicType ) {
|
||||||
return ( (BasicType) nodeType );
|
return (BasicType<?>) nodeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.hibernate.metamodel.mapping.ConvertibleModelPart;
|
||||||
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||||
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
||||||
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
|
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
|
||||||
|
@ -221,14 +221,14 @@ public class SqmUtil {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( !domainParamBinding.isBound() ) {
|
if ( !domainParamBinding.isBound() ) {
|
||||||
final MappingModelExpressable<?> mappingExpressable = SqmMappingModelHelper.resolveMappingModelExpressable(
|
final MappingModelExpressible<?> mappingExpressible = SqmMappingModelHelper.resolveMappingModelExpressible(
|
||||||
sqmParameter,
|
sqmParameter,
|
||||||
domainModel,
|
domainModel,
|
||||||
tableGroupLocator
|
tableGroupLocator
|
||||||
);
|
);
|
||||||
for ( int i = 0; i < jdbcParamsBinds.size(); i++ ) {
|
for ( int i = 0; i < jdbcParamsBinds.size(); i++ ) {
|
||||||
final List<JdbcParameter> jdbcParams = jdbcParamsBinds.get( i );
|
final List<JdbcParameter> jdbcParams = jdbcParamsBinds.get( i );
|
||||||
mappingExpressable.forEachJdbcType(
|
mappingExpressible.forEachJdbcType(
|
||||||
(position, jdbcType) -> {
|
(position, jdbcType) -> {
|
||||||
jdbcParameterBindings.addBinding(
|
jdbcParameterBindings.addBinding(
|
||||||
jdbcParams.get( position ),
|
jdbcParams.get( position ),
|
||||||
|
@ -420,7 +420,7 @@ public class SqmUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( int i = 0; i < sqmParameters.size(); i++ ) {
|
for ( int i = 0; i < sqmParameters.size(); i++ ) {
|
||||||
final MappingModelExpressable<?> mappingModelType = mappingModelResolutionAccess
|
final MappingModelExpressible<?> mappingModelType = mappingModelResolutionAccess
|
||||||
.getResolvedMappingModelType( sqmParameters.get( i ) );
|
.getResolvedMappingModelType( sqmParameters.get( i ) );
|
||||||
if ( mappingModelType != null ) {
|
if ( mappingModelType != null ) {
|
||||||
return mappingModelType;
|
return mappingModelType;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||||
|
@ -288,8 +288,8 @@ public class MatchingIdSelectionHelper {
|
||||||
navigablePath -> sqmConverter.getMutatingTableGroup(),
|
navigablePath -> sqmConverter.getMutatingTableGroup(),
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) sqmConverter.getSqmParameterMappingModelExpressableResolutions().get(parameter);
|
return (MappingModelExpressible<T>) sqmConverter.getSqmParameterMappingModelExpressibleResolutions().get(parameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.util.function.Function;
|
||||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
import org.hibernate.internal.util.collections.Stack;
|
import org.hibernate.internal.util.collections.Stack;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.query.spi.QueryOptions;
|
import org.hibernate.query.spi.QueryOptions;
|
||||||
import org.hibernate.query.spi.QueryParameterBindings;
|
import org.hibernate.query.spi.QueryParameterBindings;
|
||||||
|
@ -57,7 +57,7 @@ import org.hibernate.sql.ast.tree.update.Assignment;
|
||||||
*/
|
*/
|
||||||
public class MultiTableSqmMutationConverter extends BaseSqmToSqlAstConverter<Statement> {
|
public class MultiTableSqmMutationConverter extends BaseSqmToSqlAstConverter<Statement> {
|
||||||
public interface SqmParameterResolutionConsumer {
|
public interface SqmParameterResolutionConsumer {
|
||||||
void accept(SqmParameter<?> sqmParam, MappingModelExpressable<?> mappingType, List<JdbcParameter> jdbcParameters);
|
void accept(SqmParameter<?> sqmParam, MappingModelExpressible<?> mappingType, List<JdbcParameter> jdbcParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final EntityMappingType mutatingEntityDescriptor;
|
private final EntityMappingType mutatingEntityDescriptor;
|
||||||
|
@ -237,7 +237,7 @@ public class MultiTableSqmMutationConverter extends BaseSqmToSqlAstConverter<Sta
|
||||||
final Expression expression = super.consumeSingleSqmParameter( sqmParameter );
|
final Expression expression = super.consumeSingleSqmParameter( sqmParameter );
|
||||||
|
|
||||||
final List<List<JdbcParameter>> jdbcParameters = getJdbcParamsBySqmParam().get( sqmParameter );
|
final List<List<JdbcParameter>> jdbcParameters = getJdbcParamsBySqmParam().get( sqmParameter );
|
||||||
final MappingModelExpressable<?> mappingType = getSqmParameterMappingModelExpressableResolutions().get( sqmParameter );
|
final MappingModelExpressible<?> mappingType = getSqmParameterMappingModelExpressibleResolutions().get( sqmParameter );
|
||||||
parameterResolutionConsumer.accept(
|
parameterResolutionConsumer.accept(
|
||||||
sqmParameter,
|
sqmParameter,
|
||||||
mappingType,
|
mappingType,
|
||||||
|
|
|
@ -19,9 +19,9 @@ import org.hibernate.boot.model.naming.Identifier;
|
||||||
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;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.ModelPart;
|
import org.hibernate.metamodel.mapping.ModelPart;
|
||||||
import org.hibernate.metamodel.mapping.SqlExpressable;
|
import org.hibernate.metamodel.mapping.SqlExpressible;
|
||||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||||
import org.hibernate.query.sqm.internal.DomainParameterXref;
|
import org.hibernate.query.sqm.internal.DomainParameterXref;
|
||||||
import org.hibernate.query.sqm.internal.SqmJdbcExecutionContextAdapter;
|
import org.hibernate.query.sqm.internal.SqmJdbcExecutionContextAdapter;
|
||||||
|
@ -134,7 +134,7 @@ public abstract class AbstractCteMutationHandler extends AbstractMutationHandler
|
||||||
parameterResolutions = new IdentityHashMap<>();
|
parameterResolutions = new IdentityHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<SqmParameter, MappingModelExpressable> paramTypeResolutions = new LinkedHashMap<>();
|
final Map<SqmParameter, MappingModelExpressible> paramTypeResolutions = new LinkedHashMap<>();
|
||||||
|
|
||||||
final Predicate restriction = sqmConverter.visitWhereClause(
|
final Predicate restriction = sqmConverter.visitWhereClause(
|
||||||
sqmMutationStatement.getWhereClause(),
|
sqmMutationStatement.getWhereClause(),
|
||||||
|
@ -172,7 +172,7 @@ public abstract class AbstractCteMutationHandler extends AbstractMutationHandler
|
||||||
new BasicResult<>(
|
new BasicResult<>(
|
||||||
0,
|
0,
|
||||||
null,
|
null,
|
||||||
( (SqlExpressable) count).getJdbcMapping().getJavaTypeDescriptor()
|
( (SqlExpressible) count).getJdbcMapping().getJavaTypeDescriptor()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
querySpec.getSelectClause().addSqlSelection( new SqlSelectionImpl( 1, 0, count ) );
|
querySpec.getSelectClause().addSqlSelection( new SqlSelectionImpl( 1, 0, count ) );
|
||||||
|
|
|
@ -31,8 +31,8 @@ import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.SqlExpressable;
|
import org.hibernate.metamodel.mapping.SqlExpressible;
|
||||||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.persister.entity.Joinable;
|
import org.hibernate.persister.entity.Joinable;
|
||||||
|
@ -188,7 +188,7 @@ public class CteInsertHandler implements InsertHandler {
|
||||||
final int size = sqmStatement.getInsertionTargetPaths().size();
|
final int size = sqmStatement.getInsertionTargetPaths().size();
|
||||||
final List<Map.Entry<SqmCteTableColumn, Assignment>> targetPathColumns = new ArrayList<>( size );
|
final List<Map.Entry<SqmCteTableColumn, Assignment>> targetPathColumns = new ArrayList<>( size );
|
||||||
final List<SqmCteTableColumn> targetPathSqmCteColumns = new ArrayList<>( size );
|
final List<SqmCteTableColumn> targetPathSqmCteColumns = new ArrayList<>( size );
|
||||||
final Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions = new LinkedHashMap<>();
|
final Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions = new LinkedHashMap<>();
|
||||||
final NamedTableReference entityTableReference = new NamedTableReference(
|
final NamedTableReference entityTableReference = new NamedTableReference(
|
||||||
cteTable.getCteName(),
|
cteTable.getCteName(),
|
||||||
TemporaryTable.DEFAULT_ALIAS,
|
TemporaryTable.DEFAULT_ALIAS,
|
||||||
|
@ -632,7 +632,7 @@ public class CteInsertHandler implements InsertHandler {
|
||||||
new BasicResult(
|
new BasicResult(
|
||||||
0,
|
0,
|
||||||
null,
|
null,
|
||||||
( (SqlExpressable) count).getJdbcMapping().getJavaTypeDescriptor()
|
( (SqlExpressible) count).getJdbcMapping().getJavaTypeDescriptor()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
querySpec.getSelectClause().addSqlSelection( new SqlSelectionImpl( 1, 0, count ) );
|
querySpec.getSelectClause().addSqlSelection( new SqlSelectionImpl( 1, 0, count ) );
|
||||||
|
@ -661,8 +661,8 @@ public class CteInsertHandler implements InsertHandler {
|
||||||
navigablePath -> sqmConverter.getMutatingTableGroup(),
|
navigablePath -> sqmConverter.getMutatingTableGroup(),
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) paramTypeResolutions.get(parameter);
|
return (MappingModelExpressible<T>) paramTypeResolutions.get(parameter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
executionContext.getSession()
|
executionContext.getSession()
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.function.BiConsumer;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.persister.entity.Joinable;
|
import org.hibernate.persister.entity.Joinable;
|
||||||
import org.hibernate.query.SemanticException;
|
import org.hibernate.query.SemanticException;
|
||||||
|
@ -81,7 +81,7 @@ public class CteUpdateHandler extends AbstractCteMutationHandler implements Upda
|
||||||
// information about the assignments
|
// information about the assignments
|
||||||
final SqmSetClause setClause = updateStatement.getSetClause();
|
final SqmSetClause setClause = updateStatement.getSetClause();
|
||||||
final List<Assignment> assignments = new ArrayList<>( setClause.getAssignments().size() );
|
final List<Assignment> assignments = new ArrayList<>( setClause.getAssignments().size() );
|
||||||
final Map<SqmParameter, MappingModelExpressable> paramTypeResolutions = new LinkedHashMap<>();
|
final Map<SqmParameter, MappingModelExpressible> paramTypeResolutions = new LinkedHashMap<>();
|
||||||
|
|
||||||
sqmConverter.visitSetClause(
|
sqmConverter.visitSetClause(
|
||||||
setClause,
|
setClause,
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate;
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping;
|
import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.ModelPartContainer;
|
import org.hibernate.metamodel.mapping.ModelPartContainer;
|
||||||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||||
import org.hibernate.query.sqm.ComparisonOperator;
|
import org.hibernate.query.sqm.ComparisonOperator;
|
||||||
|
@ -90,7 +90,7 @@ public class InsertExecutionDelegate implements TableBasedInsertHandler.Executio
|
||||||
private final JdbcParameterBindings jdbcParameterBindings;
|
private final JdbcParameterBindings jdbcParameterBindings;
|
||||||
|
|
||||||
private final Map<TableReference, List<Assignment>> assignmentsByTable;
|
private final Map<TableReference, List<Assignment>> assignmentsByTable;
|
||||||
private final Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions;
|
private final Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions;
|
||||||
private final SessionFactoryImplementor sessionFactory;
|
private final SessionFactoryImplementor sessionFactory;
|
||||||
|
|
||||||
public InsertExecutionDelegate(
|
public InsertExecutionDelegate(
|
||||||
|
@ -105,7 +105,7 @@ public class InsertExecutionDelegate implements TableBasedInsertHandler.Executio
|
||||||
List<Assignment> assignments,
|
List<Assignment> assignments,
|
||||||
InsertStatement insertStatement,
|
InsertStatement insertStatement,
|
||||||
Map<SqmParameter<?>, List<List<JdbcParameter>>> parameterResolutions,
|
Map<SqmParameter<?>, List<List<JdbcParameter>>> parameterResolutions,
|
||||||
Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions,
|
Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions,
|
||||||
DomainQueryExecutionContext executionContext) {
|
DomainQueryExecutionContext executionContext) {
|
||||||
this.sqmInsert = sqmInsert;
|
this.sqmInsert = sqmInsert;
|
||||||
this.sqmConverter = sqmConverter;
|
this.sqmConverter = sqmConverter;
|
||||||
|
@ -137,8 +137,8 @@ public class InsertExecutionDelegate implements TableBasedInsertHandler.Executio
|
||||||
navigablePath -> insertingTableGroup,
|
navigablePath -> insertingTableGroup,
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) paramTypeResolutions.get(parameter);
|
return (MappingModelExpressible<T>) paramTypeResolutions.get(parameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.hibernate.internal.util.MutableInteger;
|
||||||
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelHelper;
|
import org.hibernate.metamodel.mapping.MappingModelHelper;
|
||||||
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
@ -122,7 +122,7 @@ public class RestrictedDeleteExecutionDelegate implements TableBasedDeleteHandle
|
||||||
assert hierarchyRootTableReference != null;
|
assert hierarchyRootTableReference != null;
|
||||||
|
|
||||||
final Map<SqmParameter<?>, List<List<JdbcParameter>>> parameterResolutions;
|
final Map<SqmParameter<?>, List<List<JdbcParameter>>> parameterResolutions;
|
||||||
final Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions;
|
final Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions;
|
||||||
|
|
||||||
if ( domainParameterXref.getSqmParameterCount() == 0 ) {
|
if ( domainParameterXref.getSqmParameterCount() == 0 ) {
|
||||||
parameterResolutions = Collections.emptyMap();
|
parameterResolutions = Collections.emptyMap();
|
||||||
|
@ -204,7 +204,7 @@ public class RestrictedDeleteExecutionDelegate implements TableBasedDeleteHandle
|
||||||
Predicate suppliedPredicate,
|
Predicate suppliedPredicate,
|
||||||
TableGroup tableGroup,
|
TableGroup tableGroup,
|
||||||
Map<SqmParameter<?>, List<List<JdbcParameter>>> restrictionSqmParameterResolutions,
|
Map<SqmParameter<?>, List<List<JdbcParameter>>> restrictionSqmParameterResolutions,
|
||||||
Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions,
|
Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions,
|
||||||
SqlExpressionResolver sqlExpressionResolver,
|
SqlExpressionResolver sqlExpressionResolver,
|
||||||
ExecutionContext executionContext) {
|
ExecutionContext executionContext) {
|
||||||
assert entityDescriptor == entityDescriptor.getRootEntityDescriptor();
|
assert entityDescriptor == entityDescriptor.getRootEntityDescriptor();
|
||||||
|
@ -236,8 +236,8 @@ public class RestrictedDeleteExecutionDelegate implements TableBasedDeleteHandle
|
||||||
navigablePath -> tableGroup,
|
navigablePath -> tableGroup,
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) paramTypeResolutions.get(parameter);
|
return (MappingModelExpressible<T>) paramTypeResolutions.get(parameter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
executionContext.getSession()
|
executionContext.getSession()
|
||||||
|
@ -472,7 +472,7 @@ public class RestrictedDeleteExecutionDelegate implements TableBasedDeleteHandle
|
||||||
Predicate predicate,
|
Predicate predicate,
|
||||||
TableGroup deletingTableGroup,
|
TableGroup deletingTableGroup,
|
||||||
Map<SqmParameter<?>, List<List<JdbcParameter>>> restrictionSqmParameterResolutions,
|
Map<SqmParameter<?>, List<List<JdbcParameter>>> restrictionSqmParameterResolutions,
|
||||||
Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions,
|
Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions,
|
||||||
ExecutionContext executionContext) {
|
ExecutionContext executionContext) {
|
||||||
final JdbcParameterBindings jdbcParameterBindings = SqmUtil.createJdbcParameterBindings(
|
final JdbcParameterBindings jdbcParameterBindings = SqmUtil.createJdbcParameterBindings(
|
||||||
executionContext.getQueryParameterBindings(),
|
executionContext.getQueryParameterBindings(),
|
||||||
|
@ -485,8 +485,8 @@ public class RestrictedDeleteExecutionDelegate implements TableBasedDeleteHandle
|
||||||
navigablePath -> deletingTableGroup,
|
navigablePath -> deletingTableGroup,
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) paramTypeResolutions.get(parameter);
|
return (MappingModelExpressible<T>) paramTypeResolutions.get(parameter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
executionContext.getSession()
|
executionContext.getSession()
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.hibernate.id.OptimizableGenerator;
|
||||||
import org.hibernate.id.enhanced.Optimizer;
|
import org.hibernate.id.enhanced.Optimizer;
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
import org.hibernate.metamodel.MappingMetamodel;
|
import org.hibernate.metamodel.MappingMetamodel;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||||
import org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression;
|
import org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression;
|
||||||
|
@ -142,7 +142,7 @@ public class TableBasedInsertHandler implements InsertHandler {
|
||||||
// information about the target paths
|
// information about the target paths
|
||||||
|
|
||||||
final List<Assignment> targetPathColumns = new ArrayList<>();
|
final List<Assignment> targetPathColumns = new ArrayList<>();
|
||||||
final Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions = new LinkedHashMap<>();
|
final Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions = new LinkedHashMap<>();
|
||||||
final NamedTableReference entityTableReference = new NamedTableReference(
|
final NamedTableReference entityTableReference = new NamedTableReference(
|
||||||
entityTable.getTableExpression(),
|
entityTable.getTableExpression(),
|
||||||
TemporaryTable.DEFAULT_ALIAS,
|
TemporaryTable.DEFAULT_ALIAS,
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
import org.hibernate.metamodel.MappingMetamodel;
|
import org.hibernate.metamodel.MappingMetamodel;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.persister.entity.Joinable;
|
import org.hibernate.persister.entity.Joinable;
|
||||||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||||
|
@ -144,7 +144,7 @@ public class TableBasedUpdateHandler
|
||||||
// information about the assignments
|
// information about the assignments
|
||||||
|
|
||||||
final List<Assignment> assignments = new ArrayList<>();
|
final List<Assignment> assignments = new ArrayList<>();
|
||||||
final Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions = new LinkedHashMap<>();
|
final Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions = new LinkedHashMap<>();
|
||||||
|
|
||||||
converterDelegate.visitSetClause(
|
converterDelegate.visitSetClause(
|
||||||
getSqmDeleteOrUpdateStatement().getSetClause(),
|
getSqmDeleteOrUpdateStatement().getSetClause(),
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.ModelPartContainer;
|
import org.hibernate.metamodel.mapping.ModelPartContainer;
|
||||||
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
||||||
import org.hibernate.query.SemanticException;
|
import org.hibernate.query.SemanticException;
|
||||||
|
@ -63,7 +63,7 @@ public class UpdateExecutionDelegate implements TableBasedUpdateHandler.Executio
|
||||||
private final JdbcParameterBindings jdbcParameterBindings;
|
private final JdbcParameterBindings jdbcParameterBindings;
|
||||||
|
|
||||||
private final Map<TableReference, List<Assignment>> assignmentsByTable;
|
private final Map<TableReference, List<Assignment>> assignmentsByTable;
|
||||||
private final Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions;
|
private final Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions;
|
||||||
private final SessionFactoryImplementor sessionFactory;
|
private final SessionFactoryImplementor sessionFactory;
|
||||||
|
|
||||||
public UpdateExecutionDelegate(
|
public UpdateExecutionDelegate(
|
||||||
|
@ -79,7 +79,7 @@ public class UpdateExecutionDelegate implements TableBasedUpdateHandler.Executio
|
||||||
List<Assignment> assignments,
|
List<Assignment> assignments,
|
||||||
Predicate suppliedPredicate,
|
Predicate suppliedPredicate,
|
||||||
Map<SqmParameter<?>, List<List<JdbcParameter>>> parameterResolutions,
|
Map<SqmParameter<?>, List<List<JdbcParameter>>> parameterResolutions,
|
||||||
Map<SqmParameter<?>, MappingModelExpressable<?>> paramTypeResolutions,
|
Map<SqmParameter<?>, MappingModelExpressible<?>> paramTypeResolutions,
|
||||||
DomainQueryExecutionContext executionContext) {
|
DomainQueryExecutionContext executionContext) {
|
||||||
this.sqmUpdate = sqmUpdate;
|
this.sqmUpdate = sqmUpdate;
|
||||||
this.sqmConverter = sqmConverter;
|
this.sqmConverter = sqmConverter;
|
||||||
|
@ -111,8 +111,8 @@ public class UpdateExecutionDelegate implements TableBasedUpdateHandler.Executio
|
||||||
navigablePath -> updatingTableGroup,
|
navigablePath -> updatingTableGroup,
|
||||||
new SqmParameterMappingModelResolutionAccess() {
|
new SqmParameterMappingModelResolutionAccess() {
|
||||||
@Override @SuppressWarnings("unchecked")
|
@Override @SuppressWarnings("unchecked")
|
||||||
public <T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
public <T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter) {
|
||||||
return (MappingModelExpressable<T>) paramTypeResolutions.get(parameter);
|
return (MappingModelExpressible<T>) paramTypeResolutions.get(parameter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
executionContext.getSession()
|
executionContext.getSession()
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.QueryException;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmCollation;
|
import org.hibernate.query.sqm.tree.expression.SqmCollation;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmDurationUnit;
|
import org.hibernate.query.sqm.tree.expression.SqmDurationUnit;
|
||||||
|
@ -62,10 +62,10 @@ public class ArgumentTypesValidator implements ArgumentsValidator {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (SqmTypedNode<?> argument : arguments) {
|
for (SqmTypedNode<?> argument : arguments) {
|
||||||
JdbcTypeIndicators indicators = queryEngine.getTypeConfiguration().getCurrentBaseSqlTypeIndicators();
|
JdbcTypeIndicators indicators = queryEngine.getTypeConfiguration().getCurrentBaseSqlTypeIndicators();
|
||||||
SqmExpressable<?> nodeType = argument.getNodeType();
|
SqmExpressible<?> nodeType = argument.getNodeType();
|
||||||
FunctionParameterType type = count < types.length ? types[count++] : types[types.length - 1];
|
FunctionParameterType type = count < types.length ? types[count++] : types[types.length - 1];
|
||||||
if ( nodeType!=null ) {
|
if ( nodeType!=null ) {
|
||||||
JavaType<?> javaType = nodeType.getExpressableJavaType();
|
JavaType<?> javaType = nodeType.getExpressibleJavaType();
|
||||||
if (javaType != null) {
|
if (javaType != null) {
|
||||||
try {
|
try {
|
||||||
JdbcType jdbcType = javaType.getRecommendedJdbcType(indicators);
|
JdbcType jdbcType = javaType.getRecommendedJdbcType(indicators);
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
||||||
import org.hibernate.query.ReturnableType;
|
import org.hibernate.query.ReturnableType;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||||
import org.hibernate.sql.ast.tree.SqlAstNode;
|
import org.hibernate.sql.ast.tree.SqlAstNode;
|
||||||
import org.hibernate.sql.ast.tree.expression.Expression;
|
import org.hibernate.sql.ast.tree.expression.Expression;
|
||||||
|
@ -205,7 +205,7 @@ public class StandardFunctionReturnTypeResolvers {
|
||||||
List<? extends SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
int position) {
|
int position) {
|
||||||
final SqmTypedNode<?> specifiedArgument = arguments.get( position - 1 );
|
final SqmTypedNode<?> specifiedArgument = arguments.get( position - 1 );
|
||||||
final SqmExpressable<?> specifiedArgType = specifiedArgument.getNodeType();
|
final SqmExpressible<?> specifiedArgType = specifiedArgument.getNodeType();
|
||||||
if ( !(specifiedArgType instanceof ReturnableType ) ) {
|
if ( !(specifiedArgType instanceof ReturnableType ) ) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
String.format(
|
String.format(
|
||||||
|
@ -226,13 +226,13 @@ public class StandardFunctionReturnTypeResolvers {
|
||||||
List<? extends SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
int position) {
|
int position) {
|
||||||
final SqmTypedNode<?> specifiedArgument = arguments.get( position - 1 );
|
final SqmTypedNode<?> specifiedArgument = arguments.get( position - 1 );
|
||||||
final SqmExpressable<?> specifiedArgType = specifiedArgument.getNodeType();
|
final SqmExpressible<?> specifiedArgType = specifiedArgument.getNodeType();
|
||||||
if ( specifiedArgType instanceof BasicType<?> ) {
|
if ( specifiedArgType instanceof BasicType<?> ) {
|
||||||
return ( (BasicType<?>) specifiedArgType ).getJdbcMapping();
|
return ( (BasicType<?>) specifiedArgType ).getJdbcMapping();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final BasicType<?> basicType = typeConfiguration.getBasicTypeForJavaType(
|
final BasicType<?> basicType = typeConfiguration.getBasicTypeForJavaType(
|
||||||
specifiedArgType.getExpressableJavaType().getJavaTypeClass()
|
specifiedArgType.getExpressibleJavaType().getJavaTypeClass()
|
||||||
);
|
);
|
||||||
if ( basicType == null ) {
|
if ( basicType == null ) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.spi;
|
package org.hibernate.query.sqm.spi;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,5 +14,5 @@ import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||||
*/
|
*/
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface SqmParameterMappingModelResolutionAccess {
|
public interface SqmParameterMappingModelResolutionAccess {
|
||||||
<T> MappingModelExpressable<T> getResolvedMappingModelType(SqmParameter<T> parameter);
|
<T> MappingModelExpressible<T> getResolvedMappingModelType(SqmParameter<T> parameter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,11 +72,11 @@ import org.hibernate.metamodel.mapping.EntityVersionMapping;
|
||||||
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.metamodel.mapping.ModelPart;
|
import org.hibernate.metamodel.mapping.ModelPart;
|
||||||
import org.hibernate.metamodel.mapping.ModelPartContainer;
|
import org.hibernate.metamodel.mapping.ModelPartContainer;
|
||||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||||
import org.hibernate.metamodel.mapping.SqlExpressable;
|
import org.hibernate.metamodel.mapping.SqlExpressible;
|
||||||
import org.hibernate.metamodel.mapping.ValueMapping;
|
import org.hibernate.metamodel.mapping.ValueMapping;
|
||||||
import org.hibernate.metamodel.mapping.internal.EmbeddedCollectionPart;
|
import org.hibernate.metamodel.mapping.internal.EmbeddedCollectionPart;
|
||||||
import org.hibernate.metamodel.mapping.internal.EntityCollectionPart;
|
import org.hibernate.metamodel.mapping.internal.EntityCollectionPart;
|
||||||
|
@ -111,7 +111,7 @@ import org.hibernate.query.spi.QueryParameterBinding;
|
||||||
import org.hibernate.query.spi.QueryParameterBindings;
|
import org.hibernate.query.spi.QueryParameterBindings;
|
||||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||||
import org.hibernate.query.sqm.InterpretationException;
|
import org.hibernate.query.sqm.InterpretationException;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SqmPathSource;
|
import org.hibernate.query.sqm.SqmPathSource;
|
||||||
import org.hibernate.query.sqm.SqmQuerySource;
|
import org.hibernate.query.sqm.SqmQuerySource;
|
||||||
import org.hibernate.query.sqm.function.AbstractSqmSelfRenderingFunctionDescriptor;
|
import org.hibernate.query.sqm.function.AbstractSqmSelfRenderingFunctionDescriptor;
|
||||||
|
@ -387,7 +387,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
|
|
||||||
private final DomainParameterXref domainParameterXref;
|
private final DomainParameterXref domainParameterXref;
|
||||||
private final QueryParameterBindings domainParameterBindings;
|
private final QueryParameterBindings domainParameterBindings;
|
||||||
private final Map<SqmParameter<?>,MappingModelExpressable<?>> sqmParameterMappingModelTypes = new LinkedHashMap<>();
|
private final Map<SqmParameter<?>, MappingModelExpressible<?>> sqmParameterMappingModelTypes = new LinkedHashMap<>();
|
||||||
private final Map<JpaCriteriaParameter<?>, SqmJpaCriteriaParameterWrapper<?>> jpaCriteriaParamResolutions;
|
private final Map<JpaCriteriaParameter<?>, SqmJpaCriteriaParameterWrapper<?>> jpaCriteriaParamResolutions;
|
||||||
private final List<DomainResult<?>> domainResults;
|
private final List<DomainResult<?>> domainResults;
|
||||||
private final EntityGraphTraversalState entityGraphTraversalState;
|
private final EntityGraphTraversalState entityGraphTraversalState;
|
||||||
|
@ -413,7 +413,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
|
|
||||||
private SqmByUnit appliedByUnit;
|
private SqmByUnit appliedByUnit;
|
||||||
private Expression adjustedTimestamp;
|
private Expression adjustedTimestamp;
|
||||||
private SqmExpressable<?> adjustedTimestampType; //TODO: remove this once we can get a Type directly from adjustedTimestamp
|
private SqmExpressible<?> adjustedTimestampType; //TODO: remove this once we can get a Type directly from adjustedTimestamp
|
||||||
private Expression adjustmentScale;
|
private Expression adjustmentScale;
|
||||||
private boolean negativeAdjustment;
|
private boolean negativeAdjustment;
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
.getJpaCriteriaParamResolutions();
|
.getJpaCriteriaParamResolutions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<SqmParameter<?>,MappingModelExpressable<?>> getSqmParameterMappingModelExpressableResolutions() {
|
public Map<SqmParameter<?>, MappingModelExpressible<?>> getSqmParameterMappingModelExpressibleResolutions() {
|
||||||
return sqmParameterMappingModelTypes;
|
return sqmParameterMappingModelTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,8 +841,8 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
else {
|
else {
|
||||||
final Expression valueExpression = (Expression) assignmentValue.accept( this );
|
final Expression valueExpression = (Expression) assignmentValue.accept( this );
|
||||||
|
|
||||||
final int valueExprJdbcCount = getKeyExpressable( valueExpression.getExpressionType() ).getJdbcTypeCount();
|
final int valueExprJdbcCount = getKeyExpressible( valueExpression.getExpressionType() ).getJdbcTypeCount();
|
||||||
final int assignedPathJdbcCount = getKeyExpressable( assignedPathInterpretation.getExpressionType() )
|
final int assignedPathJdbcCount = getKeyExpressible( assignedPathInterpretation.getExpressionType() )
|
||||||
.getJdbcTypeCount();
|
.getJdbcTypeCount();
|
||||||
|
|
||||||
if ( valueExprJdbcCount != assignedPathJdbcCount ) {
|
if ( valueExprJdbcCount != assignedPathJdbcCount ) {
|
||||||
|
@ -3843,7 +3843,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
}
|
}
|
||||||
|
|
||||||
private Expression createCaseExpression(SqmPath<?> lhs, EntityDomainType<?> treatTarget, Expression expression) {
|
private Expression createCaseExpression(SqmPath<?> lhs, EntityDomainType<?> treatTarget, Expression expression) {
|
||||||
final BasicValuedMapping mappingModelExpressable = (BasicValuedMapping) expression.getExpressionType();
|
final BasicValuedMapping mappingModelExpressible = (BasicValuedMapping) expression.getExpressionType();
|
||||||
final List<CaseSearchedExpression.WhenFragment> whenFragments = new ArrayList<>( 1 );
|
final List<CaseSearchedExpression.WhenFragment> whenFragments = new ArrayList<>( 1 );
|
||||||
whenFragments.add(
|
whenFragments.add(
|
||||||
new CaseSearchedExpression.WhenFragment(
|
new CaseSearchedExpression.WhenFragment(
|
||||||
|
@ -3852,9 +3852,9 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return new CaseSearchedExpression(
|
return new CaseSearchedExpression(
|
||||||
mappingModelExpressable,
|
mappingModelExpressible,
|
||||||
whenFragments,
|
whenFragments,
|
||||||
new QueryLiteral<>( null, mappingModelExpressable )
|
new QueryLiteral<>( null, mappingModelExpressible )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3884,25 +3884,25 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expression visitLiteral(SqmLiteral<?> literal) {
|
public Expression visitLiteral(SqmLiteral<?> literal) {
|
||||||
final Supplier<MappingModelExpressable<?>> inferableTypeAccess = inferrableTypeAccessStack.getCurrent();
|
final Supplier<MappingModelExpressible<?>> inferableTypeAccess = inferrableTypeAccessStack.getCurrent();
|
||||||
|
|
||||||
if ( literal instanceof SqmLiteralNull ) {
|
if ( literal instanceof SqmLiteralNull ) {
|
||||||
MappingModelExpressable<?> mappingModelExpressable = inferableTypeAccess.get();
|
MappingModelExpressible<?> mappingModelExpressible = inferableTypeAccess.get();
|
||||||
if ( mappingModelExpressable == null ) {
|
if ( mappingModelExpressible == null ) {
|
||||||
mappingModelExpressable = determineCurrentExpressable( literal );
|
mappingModelExpressible = determineCurrentExpressible( literal );
|
||||||
}
|
}
|
||||||
if ( mappingModelExpressable instanceof BasicValuedMapping ) {
|
if ( mappingModelExpressible instanceof BasicValuedMapping ) {
|
||||||
return new QueryLiteral<>( null, (BasicValuedMapping) mappingModelExpressable );
|
return new QueryLiteral<>( null, (BasicValuedMapping) mappingModelExpressible);
|
||||||
}
|
}
|
||||||
final MappingModelExpressable<?> keyExpressable = getKeyExpressable( mappingModelExpressable );
|
final MappingModelExpressible<?> keyExpressible = getKeyExpressible(mappingModelExpressible);
|
||||||
if ( keyExpressable == null ) {
|
if ( keyExpressible == null ) {
|
||||||
// Default to the Object type
|
// Default to the Object type
|
||||||
return new QueryLiteral<>( null, basicType( Object.class ) );
|
return new QueryLiteral<>( null, basicType( Object.class ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Expression> expressions = new ArrayList<>( keyExpressable.getJdbcTypeCount() );
|
final List<Expression> expressions = new ArrayList<>( keyExpressible.getJdbcTypeCount() );
|
||||||
|
|
||||||
keyExpressable.forEachJdbcType(
|
keyExpressible.forEachJdbcType(
|
||||||
(index, jdbcMapping) -> expressions.add(
|
(index, jdbcMapping) -> expressions.add(
|
||||||
new QueryLiteral<>(
|
new QueryLiteral<>(
|
||||||
null,
|
null,
|
||||||
|
@ -3910,13 +3910,13 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return new SqlTuple( expressions, mappingModelExpressable );
|
return new SqlTuple( expressions, mappingModelExpressible);
|
||||||
}
|
}
|
||||||
|
|
||||||
final MappingModelExpressable<?> inferableExpressable = inferableTypeAccess.get();
|
final MappingModelExpressible<?> inferableExpressible = inferableTypeAccess.get();
|
||||||
|
|
||||||
if ( inferableExpressable instanceof ConvertibleModelPart ) {
|
if ( inferableExpressible instanceof ConvertibleModelPart ) {
|
||||||
final ConvertibleModelPart convertibleModelPart = (ConvertibleModelPart) inferableExpressable;
|
final ConvertibleModelPart convertibleModelPart = (ConvertibleModelPart) inferableExpressible;
|
||||||
final BasicValueConverter valueConverter = convertibleModelPart.getValueConverter();
|
final BasicValueConverter valueConverter = convertibleModelPart.getValueConverter();
|
||||||
|
|
||||||
if ( valueConverter != null ) {
|
if ( valueConverter != null ) {
|
||||||
|
@ -3945,8 +3945,8 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Special case for when we create an entity literal through the JPA CriteriaBuilder.literal API
|
// Special case for when we create an entity literal through the JPA CriteriaBuilder.literal API
|
||||||
else if ( inferableExpressable instanceof EntityDiscriminatorMapping ) {
|
else if ( inferableExpressible instanceof EntityDiscriminatorMapping ) {
|
||||||
final EntityDiscriminatorMapping discriminatorMapping = (EntityDiscriminatorMapping) inferableExpressable;
|
final EntityDiscriminatorMapping discriminatorMapping = (EntityDiscriminatorMapping) inferableExpressible;
|
||||||
final Object literalValue = literal.getLiteralValue();
|
final Object literalValue = literal.getLiteralValue();
|
||||||
final EntityPersister mappingDescriptor;
|
final EntityPersister mappingDescriptor;
|
||||||
if ( literalValue instanceof Class<?> ) {
|
if ( literalValue instanceof Class<?> ) {
|
||||||
|
@ -3977,38 +3977,38 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
return new EntityTypeLiteral( mappingDescriptor );
|
return new EntityTypeLiteral( mappingDescriptor );
|
||||||
}
|
}
|
||||||
|
|
||||||
final MappingModelExpressable<?> expressable;
|
final MappingModelExpressible<?> expressible;
|
||||||
final MappingModelExpressable<?> localExpressable = SqmMappingModelHelper.resolveMappingModelExpressable(
|
final MappingModelExpressible<?> localExpressible = SqmMappingModelHelper.resolveMappingModelExpressible(
|
||||||
literal,
|
literal,
|
||||||
getCreationContext().getDomainModel(),
|
getCreationContext().getDomainModel(),
|
||||||
getFromClauseAccess()::findTableGroup
|
getFromClauseAccess()::findTableGroup
|
||||||
);
|
);
|
||||||
if ( localExpressable == null ) {
|
if ( localExpressible == null ) {
|
||||||
expressable = getElementExpressable( inferableExpressable );
|
expressible = getElementExpressible( inferableExpressible );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final MappingModelExpressable<?> elementExpressable = getElementExpressable( localExpressable );
|
final MappingModelExpressible<?> elementExpressible = getElementExpressible( localExpressible );
|
||||||
if ( elementExpressable instanceof BasicType<?> ) {
|
if ( elementExpressible instanceof BasicType<?> ) {
|
||||||
expressable = InferredBasicValueResolver.resolveSqlTypeIndicators(
|
expressible = InferredBasicValueResolver.resolveSqlTypeIndicators(
|
||||||
this,
|
this,
|
||||||
(BasicType<?>) elementExpressable,
|
(BasicType<?>) elementExpressible,
|
||||||
literal.getJavaTypeDescriptor()
|
literal.getJavaTypeDescriptor()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
expressable = elementExpressable;
|
expressible = elementExpressible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( expressable instanceof BasicValuedMapping ) {
|
if ( expressible instanceof BasicValuedMapping ) {
|
||||||
return new QueryLiteral<>(
|
return new QueryLiteral<>(
|
||||||
literal.getLiteralValue(),
|
literal.getLiteralValue(),
|
||||||
(BasicValuedMapping) expressable
|
(BasicValuedMapping) expressible
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Handling other values might seem unnecessary, but with JPA Criteria it is totally possible to have such literals
|
// Handling other values might seem unnecessary, but with JPA Criteria it is totally possible to have such literals
|
||||||
else if ( expressable instanceof EmbeddableValuedModelPart ) {
|
else if ( expressible instanceof EmbeddableValuedModelPart ) {
|
||||||
final EmbeddableValuedModelPart embeddableValuedModelPart = (EmbeddableValuedModelPart) expressable;
|
final EmbeddableValuedModelPart embeddableValuedModelPart = (EmbeddableValuedModelPart) expressible;
|
||||||
final List<Expression> list = new ArrayList<>( embeddableValuedModelPart.getJdbcTypeCount() );
|
final List<Expression> list = new ArrayList<>( embeddableValuedModelPart.getJdbcTypeCount() );
|
||||||
embeddableValuedModelPart.forEachJdbcValue(
|
embeddableValuedModelPart.forEachJdbcValue(
|
||||||
literal.getLiteralValue(),
|
literal.getLiteralValue(),
|
||||||
|
@ -4017,10 +4017,10 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
-> list.add( new QueryLiteral<>( value, (BasicValuedMapping) jdbcMapping ) ),
|
-> list.add( new QueryLiteral<>( value, (BasicValuedMapping) jdbcMapping ) ),
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
return new SqlTuple( list, expressable );
|
return new SqlTuple( list, expressible );
|
||||||
}
|
}
|
||||||
else if ( expressable instanceof EntityValuedModelPart ) {
|
else if ( expressible instanceof EntityValuedModelPart ) {
|
||||||
final EntityValuedModelPart entityValuedModelPart = (EntityValuedModelPart) expressable;
|
final EntityValuedModelPart entityValuedModelPart = (EntityValuedModelPart) expressible;
|
||||||
final Object associationKey;
|
final Object associationKey;
|
||||||
final ModelPart associationKeyPart;
|
final ModelPart associationKeyPart;
|
||||||
if ( entityValuedModelPart instanceof Association ) {
|
if ( entityValuedModelPart instanceof Association ) {
|
||||||
|
@ -4062,26 +4062,26 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new NotYetImplementedFor6Exception(
|
throw new NotYetImplementedFor6Exception(
|
||||||
expressable == null ? literal.getLiteralValue().getClass() : expressable.getClass()
|
expressible == null ? literal.getLiteralValue().getClass() : expressible.getClass()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MappingModelExpressable<?> getKeyExpressable(JdbcMappingContainer mappingModelExpressable) {
|
private MappingModelExpressible<?> getKeyExpressible(JdbcMappingContainer mappingModelExpressible) {
|
||||||
if ( mappingModelExpressable instanceof EntityAssociationMapping ) {
|
if ( mappingModelExpressible instanceof EntityAssociationMapping ) {
|
||||||
return ( (EntityAssociationMapping) mappingModelExpressable ).getKeyTargetMatchPart();
|
return ( (EntityAssociationMapping) mappingModelExpressible ).getKeyTargetMatchPart();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (MappingModelExpressable<?>) mappingModelExpressable;
|
return (MappingModelExpressible<?>) mappingModelExpressible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MappingModelExpressable<?> getElementExpressable(MappingModelExpressable<?> mappingModelExpressable) {
|
private MappingModelExpressible<?> getElementExpressible(MappingModelExpressible<?> mappingModelExpressible) {
|
||||||
if ( mappingModelExpressable instanceof PluralAttributeMapping ) {
|
if ( mappingModelExpressible instanceof PluralAttributeMapping ) {
|
||||||
return ( (PluralAttributeMapping) mappingModelExpressable ).getElementDescriptor();
|
return ( (PluralAttributeMapping) mappingModelExpressible).getElementDescriptor();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return mappingModelExpressable;
|
return mappingModelExpressible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4106,7 +4106,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
|
|
||||||
protected Expression consumeSqmParameter(
|
protected Expression consumeSqmParameter(
|
||||||
SqmParameter<?> sqmParameter,
|
SqmParameter<?> sqmParameter,
|
||||||
MappingModelExpressable<?> valueMapping,
|
MappingModelExpressible<?> valueMapping,
|
||||||
BiConsumer<Integer, JdbcParameter> jdbcParameterConsumer) {
|
BiConsumer<Integer, JdbcParameter> jdbcParameterConsumer) {
|
||||||
final List<JdbcParameter> jdbcParametersForSqm = new ArrayList<>();
|
final List<JdbcParameter> jdbcParametersForSqm = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -4145,7 +4145,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
private void replaceJdbcParametersType(
|
private void replaceJdbcParametersType(
|
||||||
SqmParameter<?> sourceSqmParameter,
|
SqmParameter<?> sourceSqmParameter,
|
||||||
List<SqmParameter<?>> sqmParameters,
|
List<SqmParameter<?>> sqmParameters,
|
||||||
MappingModelExpressable<?> valueMapping) {
|
MappingModelExpressible<?> valueMapping) {
|
||||||
final JdbcMapping jdbcMapping = valueMapping.getJdbcMappings().get( 0 );
|
final JdbcMapping jdbcMapping = valueMapping.getJdbcMappings().get( 0 );
|
||||||
for ( SqmParameter<?> sqmParameter : sqmParameters ) {
|
for ( SqmParameter<?> sqmParameter : sqmParameters ) {
|
||||||
if ( sqmParameter == sourceSqmParameter ) {
|
if ( sqmParameter == sourceSqmParameter ) {
|
||||||
|
@ -4157,7 +4157,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
for ( List<JdbcParameter> parameters : jdbcParamsForSqmParameter ) {
|
for ( List<JdbcParameter> parameters : jdbcParamsForSqmParameter ) {
|
||||||
assert parameters.size() == 1;
|
assert parameters.size() == 1;
|
||||||
final JdbcParameter jdbcParameter = parameters.get( 0 );
|
final JdbcParameter jdbcParameter = parameters.get( 0 );
|
||||||
if ( ( (SqlExpressable) jdbcParameter ).getJdbcMapping() != valueMapping ) {
|
if ( ( (SqlExpressible) jdbcParameter ).getJdbcMapping() != valueMapping ) {
|
||||||
final JdbcParameter newJdbcParameter = new JdbcParameterImpl( jdbcMapping );
|
final JdbcParameter newJdbcParameter = new JdbcParameterImpl( jdbcMapping );
|
||||||
parameters.set( 0, newJdbcParameter );
|
parameters.set( 0, newJdbcParameter );
|
||||||
jdbcParameters.getJdbcParameters().remove( jdbcParameter );
|
jdbcParameters.getJdbcParameters().remove( jdbcParameter );
|
||||||
|
@ -4202,7 +4202,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Expression consumeSingleSqmParameter(SqmParameter<?> sqmParameter) {
|
protected Expression consumeSingleSqmParameter(SqmParameter<?> sqmParameter) {
|
||||||
final MappingModelExpressable<?> valueMapping = determineValueMapping( sqmParameter );
|
final MappingModelExpressible<?> valueMapping = determineValueMapping( sqmParameter );
|
||||||
|
|
||||||
final List<JdbcParameter> jdbcParametersForSqm = new ArrayList<>();
|
final List<JdbcParameter> jdbcParametersForSqm = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -4235,31 +4235,31 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected MappingModelExpressable<?> lenientlyResolveMappingExpressable(SqmExpressable<?> nodeType) {
|
// protected MappingModelExpressible<?> lenientlyResolveMappingExpressible(SqmExpressible<?> nodeType) {
|
||||||
// return resolveMappingExpressable( nodeType );
|
// return resolveMappingExpressible( nodeType );
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// protected MappingModelExpressable<?> resolveMappingExpressable(SqmExpressable<?> nodeType) {
|
// protected MappingModelExpressible<?> resolveMappingExpressible(SqmExpressible<?> nodeType) {
|
||||||
// final MappingModelExpressable<?> valueMapping = getCreationContext().getDomainModel().resolveMappingExpressable(
|
// final MappingModelExpressible<?> valueMapping = getCreationContext().getDomainModel().resolveMappingExpressible(
|
||||||
// nodeType,
|
// nodeType,
|
||||||
// this::findTableGroupByPath
|
// this::findTableGroupByPath
|
||||||
// );
|
// );
|
||||||
//
|
//
|
||||||
// if ( valueMapping == null ) {
|
// if ( valueMapping == null ) {
|
||||||
// final Supplier<MappingModelExpressable<?>> currentExpressableSupplier = inferrableTypeAccessStack.getCurrent();
|
// final Supplier<MappingModelExpressible<?>> currentExpressibleSupplier = inferrableTypeAccessStack.getCurrent();
|
||||||
// if ( currentExpressableSupplier != null ) {
|
// if ( currentExpressibleSupplier != null ) {
|
||||||
// return currentExpressableSupplier.get();
|
// return currentExpressibleSupplier.get();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if ( valueMapping == null ) {
|
// if ( valueMapping == null ) {
|
||||||
// throw new ConversionException( "Could not determine ValueMapping for SqmExpressable: " + nodeType );
|
// throw new ConversionException( "Could not determine ValueMapping for SqmExpressible: " + nodeType );
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// return valueMapping;
|
// return valueMapping;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
protected MappingModelExpressable<?> determineValueMapping(SqmExpression<?> sqmExpression) {
|
protected MappingModelExpressible<?> determineValueMapping(SqmExpression<?> sqmExpression) {
|
||||||
if ( sqmExpression instanceof SqmParameter ) {
|
if ( sqmExpression instanceof SqmParameter ) {
|
||||||
return determineValueMapping( (SqmParameter<?>) sqmExpression );
|
return determineValueMapping( (SqmParameter<?>) sqmExpression );
|
||||||
}
|
}
|
||||||
|
@ -4268,7 +4268,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
if ( sqmExpression instanceof SqmPath ) {
|
if ( sqmExpression instanceof SqmPath ) {
|
||||||
log.debugf( "Determining mapping-model type for SqmPath : %s ", sqmExpression );
|
log.debugf( "Determining mapping-model type for SqmPath : %s ", sqmExpression );
|
||||||
prepareReusablePath( (SqmPath<?>) sqmExpression, () -> null );
|
prepareReusablePath( (SqmPath<?>) sqmExpression, () -> null );
|
||||||
return SqmMappingModelHelper.resolveMappingModelExpressable(
|
return SqmMappingModelHelper.resolveMappingModelExpressible(
|
||||||
sqmExpression,
|
sqmExpression,
|
||||||
domainModel,
|
domainModel,
|
||||||
getFromClauseAccess()::findTableGroup
|
getFromClauseAccess()::findTableGroup
|
||||||
|
@ -4277,9 +4277,9 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
|
|
||||||
// The model type of an enum literal is always inferred
|
// The model type of an enum literal is always inferred
|
||||||
if ( sqmExpression instanceof SqmEnumLiteral<?> ) {
|
if ( sqmExpression instanceof SqmEnumLiteral<?> ) {
|
||||||
final Supplier<MappingModelExpressable<?>> currentExpressableSupplier = inferrableTypeAccessStack.getCurrent();
|
final Supplier<MappingModelExpressible<?>> currentExpressibleSupplier = inferrableTypeAccessStack.getCurrent();
|
||||||
if ( currentExpressableSupplier != null ) {
|
if ( currentExpressibleSupplier != null ) {
|
||||||
return currentExpressableSupplier.get();
|
return currentExpressibleSupplier.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4288,11 +4288,11 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
final SqmSelectClause selectClause = subQuery.getQuerySpec().getSelectClause();
|
final SqmSelectClause selectClause = subQuery.getQuerySpec().getSelectClause();
|
||||||
if ( selectClause.getSelections().size() == 1 ) {
|
if ( selectClause.getSelections().size() == 1 ) {
|
||||||
final SqmSelection<?> subQuerySelection = selectClause.getSelections().get( 0 );
|
final SqmSelection<?> subQuerySelection = selectClause.getSelections().get( 0 );
|
||||||
final SqmExpressable<?> selectionNodeType = subQuerySelection.getNodeType();
|
final SqmExpressible<?> selectionNodeType = subQuerySelection.getNodeType();
|
||||||
if ( selectionNodeType != null ) {
|
if ( selectionNodeType != null ) {
|
||||||
final SqmExpressable<?> sqmExpressable;
|
final SqmExpressible<?> sqmExpressible;
|
||||||
if ( selectionNodeType instanceof PluralPersistentAttribute ) {
|
if ( selectionNodeType instanceof PluralPersistentAttribute ) {
|
||||||
sqmExpressable = ( (PluralPersistentAttribute<?,?,?>) selectionNodeType ).getElementPathSource();
|
sqmExpressible = ( (PluralPersistentAttribute<?,?,?>) selectionNodeType ).getElementPathSource();
|
||||||
}
|
}
|
||||||
else if ( selectionNodeType instanceof SqmPathSource<?>) {
|
else if ( selectionNodeType instanceof SqmPathSource<?>) {
|
||||||
final SqmPathSource<?> pathSource = (SqmPathSource<?>) selectionNodeType;
|
final SqmPathSource<?> pathSource = (SqmPathSource<?>) selectionNodeType;
|
||||||
|
@ -4300,7 +4300,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
pathSource.getPathName()
|
pathSource.getPathName()
|
||||||
);
|
);
|
||||||
if ( partNature == null ) {
|
if ( partNature == null ) {
|
||||||
sqmExpressable = selectionNodeType;
|
sqmExpressible = selectionNodeType;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final SqmPath<?> sqmPath = (SqmPath<?>) subQuerySelection.getSelectableNode();
|
final SqmPath<?> sqmPath = (SqmPath<?>) subQuerySelection.getSelectableNode();
|
||||||
|
@ -4315,13 +4315,13 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sqmExpressable = selectionNodeType;
|
sqmExpressible = selectionNodeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
final MappingModelExpressable<?> expressable = domainModel.resolveMappingExpressable( sqmExpressable, this::findTableGroupByPath );
|
final MappingModelExpressible<?> expressible = domainModel.resolveMappingExpressible(sqmExpressible, this::findTableGroupByPath );
|
||||||
|
|
||||||
if ( expressable != null ) {
|
if ( expressible != null ) {
|
||||||
return expressable;
|
return expressible;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -4335,20 +4335,20 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debugf( "Determining mapping-model type for generalized SqmExpression : %s", sqmExpression );
|
log.debugf( "Determining mapping-model type for generalized SqmExpression : %s", sqmExpression );
|
||||||
final SqmExpressable<?> nodeType = sqmExpression.getNodeType();
|
final SqmExpressible<?> nodeType = sqmExpression.getNodeType();
|
||||||
if ( nodeType == null ) {
|
if ( nodeType == null ) {
|
||||||
// We can't determine the type of the expression
|
// We can't determine the type of the expression
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final MappingModelExpressable<?> valueMapping = domainModel.resolveMappingExpressable(
|
final MappingModelExpressible<?> valueMapping = domainModel.resolveMappingExpressible(
|
||||||
nodeType,
|
nodeType,
|
||||||
this::findTableGroupByPath
|
this::findTableGroupByPath
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( valueMapping == null ) {
|
if ( valueMapping == null ) {
|
||||||
final Supplier<MappingModelExpressable<?>> currentExpressableSupplier = inferrableTypeAccessStack.getCurrent();
|
final Supplier<MappingModelExpressible<?>> currentExpressibleSupplier = inferrableTypeAccessStack.getCurrent();
|
||||||
if ( currentExpressableSupplier != null ) {
|
if ( currentExpressibleSupplier != null ) {
|
||||||
return currentExpressableSupplier.get();
|
return currentExpressibleSupplier.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4359,10 +4359,10 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
return valueMapping;
|
return valueMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MappingModelExpressable<?> getInferredValueMapping() {
|
protected MappingModelExpressible<?> getInferredValueMapping() {
|
||||||
final Supplier<MappingModelExpressable<?>> currentExpressableSupplier = inferrableTypeAccessStack.getCurrent();
|
final Supplier<MappingModelExpressible<?>> currentExpressibleSupplier = inferrableTypeAccessStack.getCurrent();
|
||||||
if ( currentExpressableSupplier != null ) {
|
if ( currentExpressibleSupplier != null ) {
|
||||||
final MappingModelExpressable<?> inferredMapping = currentExpressableSupplier.get();
|
final MappingModelExpressible<?> inferredMapping = currentExpressibleSupplier.get();
|
||||||
if ( inferredMapping != null ) {
|
if ( inferredMapping != null ) {
|
||||||
if ( inferredMapping instanceof PluralAttributeMapping ) {
|
if ( inferredMapping instanceof PluralAttributeMapping ) {
|
||||||
return ( (PluralAttributeMapping) inferredMapping ).getElementDescriptor();
|
return ( (PluralAttributeMapping) inferredMapping ).getElementDescriptor();
|
||||||
|
@ -4376,7 +4376,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MappingModelExpressable<?> determineValueMapping(SqmParameter<?> sqmParameter) {
|
protected MappingModelExpressible<?> determineValueMapping(SqmParameter<?> sqmParameter) {
|
||||||
log.debugf( "Determining mapping-model type for SqmParameter : %s", sqmParameter );
|
log.debugf( "Determining mapping-model type for SqmParameter : %s", sqmParameter );
|
||||||
|
|
||||||
final QueryParameterImplementor<?> queryParameter = domainParameterXref.getQueryParameter( sqmParameter );
|
final QueryParameterImplementor<?> queryParameter = domainParameterXref.getQueryParameter( sqmParameter );
|
||||||
|
@ -4386,7 +4386,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
// this should indicate the condition that the user query did not define an
|
// this should indicate the condition that the user query did not define an
|
||||||
// explicit type in regard to this parameter. Here we should prefer the
|
// explicit type in regard to this parameter. Here we should prefer the
|
||||||
// inferrable type and fallback to the binding type
|
// inferrable type and fallback to the binding type
|
||||||
final MappingModelExpressable<?> inferredValueMapping = getInferredValueMapping();
|
final MappingModelExpressible<?> inferredValueMapping = getInferredValueMapping();
|
||||||
if ( inferredValueMapping != null ) {
|
if ( inferredValueMapping != null ) {
|
||||||
return inferredValueMapping;
|
return inferredValueMapping;
|
||||||
}
|
}
|
||||||
|
@ -4404,11 +4404,11 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
// Default to the Object type
|
// Default to the Object type
|
||||||
return basicType( Object.class );
|
return basicType( Object.class );
|
||||||
}
|
}
|
||||||
else if ( paramType instanceof MappingModelExpressable<?> && paramType.getBindableJavaType() == Object.class ) {
|
else if ( paramType instanceof MappingModelExpressible<?> && paramType.getBindableJavaType() == Object.class ) {
|
||||||
return (MappingModelExpressable<?>) paramType;
|
return (MappingModelExpressible<?>) paramType;
|
||||||
}
|
}
|
||||||
|
|
||||||
final SqmExpressable<?> paramSqmType = paramType.resolveExpressable( creationContext.getSessionFactory() );
|
final SqmExpressible<?> paramSqmType = paramType.resolveExpressible( creationContext.getSessionFactory() );
|
||||||
|
|
||||||
if ( paramSqmType instanceof SqmPath ) {
|
if ( paramSqmType instanceof SqmPath ) {
|
||||||
final SqmPath<?> sqmPath = (SqmPath<?>) paramSqmType;
|
final SqmPath<?> sqmPath = (SqmPath<?>) paramSqmType;
|
||||||
|
@ -4430,7 +4430,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
|
|
||||||
if ( paramSqmType instanceof CompositeSqmPathSource ) {
|
if ( paramSqmType instanceof CompositeSqmPathSource ) {
|
||||||
// Try to infer the value mapping since the other side apparently is a path source
|
// Try to infer the value mapping since the other side apparently is a path source
|
||||||
final MappingModelExpressable<?> inferredValueMapping = getInferredValueMapping();
|
final MappingModelExpressible<?> inferredValueMapping = getInferredValueMapping();
|
||||||
if ( inferredValueMapping != null ) {
|
if ( inferredValueMapping != null ) {
|
||||||
return inferredValueMapping;
|
return inferredValueMapping;
|
||||||
}
|
}
|
||||||
|
@ -4439,25 +4439,25 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
|
|
||||||
if ( paramSqmType instanceof SqmPathSource<?> || paramSqmType instanceof BasicDomainType<?> ) {
|
if ( paramSqmType instanceof SqmPathSource<?> || paramSqmType instanceof BasicDomainType<?> ) {
|
||||||
// Try to infer the value mapping since the other side apparently is a path source
|
// Try to infer the value mapping since the other side apparently is a path source
|
||||||
final MappingModelExpressable<?> inferredValueMapping = getInferredValueMapping();
|
final MappingModelExpressible<?> inferredValueMapping = getInferredValueMapping();
|
||||||
if ( inferredValueMapping != null ) {
|
if ( inferredValueMapping != null ) {
|
||||||
return inferredValueMapping;
|
return inferredValueMapping;
|
||||||
}
|
}
|
||||||
return getTypeConfiguration().getBasicTypeForJavaType(
|
return getTypeConfiguration().getBasicTypeForJavaType(
|
||||||
paramSqmType.getExpressableJavaType().getJavaTypeClass()
|
paramSqmType.getExpressibleJavaType().getJavaTypeClass()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ConversionException( "Could not determine ValueMapping for SqmParameter: " + sqmParameter );
|
throw new ConversionException( "Could not determine ValueMapping for SqmParameter: " + sqmParameter );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Stack<Supplier<MappingModelExpressable<?>>> inferrableTypeAccessStack = new StandardStack<>(
|
protected final Stack<Supplier<MappingModelExpressible<?>>> inferrableTypeAccessStack = new StandardStack<>(
|
||||||
() -> null
|
() -> null
|
||||||
);
|
);
|
||||||
|
|
||||||
private void resolveSqmParameter(
|
private void resolveSqmParameter(
|
||||||
SqmParameter<?> expression,
|
SqmParameter<?> expression,
|
||||||
MappingModelExpressable<?> valueMapping,
|
MappingModelExpressible<?> valueMapping,
|
||||||
BiConsumer<Integer,JdbcParameter> jdbcParameterConsumer) {
|
BiConsumer<Integer,JdbcParameter> jdbcParameterConsumer) {
|
||||||
sqmParameterMappingModelTypes.put( expression, valueMapping );
|
sqmParameterMappingModelTypes.put( expression, valueMapping );
|
||||||
final Bindable bindable;
|
final Bindable bindable;
|
||||||
|
@ -4512,10 +4512,10 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
final List<SqmExpression<?>> groupedExpressions = sqmTuple.getGroupedExpressions();
|
final List<SqmExpression<?>> groupedExpressions = sqmTuple.getGroupedExpressions();
|
||||||
final int size = groupedExpressions.size();
|
final int size = groupedExpressions.size();
|
||||||
final List<Expression> expressions = new ArrayList<>( size );
|
final List<Expression> expressions = new ArrayList<>( size );
|
||||||
final MappingModelExpressable<?> mappingModelExpressable = inferrableTypeAccessStack.getCurrent().get();
|
final MappingModelExpressible<?> mappingModelExpressible = inferrableTypeAccessStack.getCurrent().get();
|
||||||
final EmbeddableMappingType embeddableMappingType;
|
final EmbeddableMappingType embeddableMappingType;
|
||||||
if ( mappingModelExpressable instanceof ValueMapping ) {
|
if ( mappingModelExpressible instanceof ValueMapping ) {
|
||||||
embeddableMappingType = (EmbeddableMappingType) ( (ValueMapping) mappingModelExpressable ).getMappedType();
|
embeddableMappingType = (EmbeddableMappingType) ( (ValueMapping) mappingModelExpressible).getMappedType();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
embeddableMappingType = null;
|
embeddableMappingType = null;
|
||||||
|
@ -4543,14 +4543,14 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final MappingModelExpressable<?> valueMapping;
|
final MappingModelExpressible<?> valueMapping;
|
||||||
if ( mappingModelExpressable != null ) {
|
if ( mappingModelExpressible != null ) {
|
||||||
valueMapping = mappingModelExpressable;
|
valueMapping = mappingModelExpressible;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final SqmExpressable<?> expressable = sqmTuple.getExpressable();
|
final SqmExpressible<?> expressible = sqmTuple.getExpressible();
|
||||||
if ( expressable instanceof MappingModelExpressable<?> ) {
|
if ( expressible instanceof MappingModelExpressible<?>) {
|
||||||
valueMapping = (MappingModelExpressable<?>) expressable;
|
valueMapping = (MappingModelExpressible<?>) expressible;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
valueMapping = null;
|
valueMapping = null;
|
||||||
|
@ -4687,14 +4687,14 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
}
|
}
|
||||||
|
|
||||||
private BasicValuedMapping getExpressionType(SqmBinaryArithmetic<?> expression) {
|
private BasicValuedMapping getExpressionType(SqmBinaryArithmetic<?> expression) {
|
||||||
final SqmExpressable<?> nodeType = expression.getNodeType();
|
final SqmExpressible<?> nodeType = expression.getNodeType();
|
||||||
if ( nodeType != null ) {
|
if ( nodeType != null ) {
|
||||||
if ( nodeType instanceof BasicValuedMapping ) {
|
if ( nodeType instanceof BasicValuedMapping ) {
|
||||||
return (BasicValuedMapping) nodeType;
|
return (BasicValuedMapping) nodeType;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return getTypeConfiguration().getBasicTypeForJavaType(
|
return getTypeConfiguration().getBasicTypeForJavaType(
|
||||||
nodeType.getExpressableJavaType().getJavaTypeClass()
|
nodeType.getExpressibleJavaType().getJavaTypeClass()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4738,14 +4738,14 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
// ts - x * (d1 - d2) => (ts - x * d1) + x * d2
|
// ts - x * (d1 - d2) => (ts - x * d1) + x * d2
|
||||||
|
|
||||||
Expression timestamp = adjustedTimestamp;
|
Expression timestamp = adjustedTimestamp;
|
||||||
SqmExpressable<?> timestampType = adjustedTimestampType;
|
SqmExpressible<?> timestampType = adjustedTimestampType;
|
||||||
adjustedTimestamp = toSqlExpression( expression.getLeftHandOperand().accept( this ) );
|
adjustedTimestamp = toSqlExpression( expression.getLeftHandOperand().accept( this ) );
|
||||||
JdbcMappingContainer type = adjustedTimestamp.getExpressionType();
|
JdbcMappingContainer type = adjustedTimestamp.getExpressionType();
|
||||||
if ( type instanceof SqmExpressable ) {
|
if ( type instanceof SqmExpressible) {
|
||||||
adjustedTimestampType = (SqmExpressable<?>) type;
|
adjustedTimestampType = (SqmExpressible<?>) type;
|
||||||
}
|
}
|
||||||
else if (type instanceof AttributeMapping ) {
|
else if (type instanceof AttributeMapping ) {
|
||||||
adjustedTimestampType = (SqmExpressable<?>) ( (AttributeMapping) type ).getMappedType();
|
adjustedTimestampType = (SqmExpressible<?>) ( (AttributeMapping) type ).getMappedType();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// else we know it has not been transformed
|
// else we know it has not been transformed
|
||||||
|
@ -4883,7 +4883,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
private <X> X cleanly(Supplier<X> supplier) {
|
private <X> X cleanly(Supplier<X> supplier) {
|
||||||
SqmByUnit byUnit = appliedByUnit;
|
SqmByUnit byUnit = appliedByUnit;
|
||||||
Expression timestamp = adjustedTimestamp;
|
Expression timestamp = adjustedTimestamp;
|
||||||
SqmExpressable<?> timestampType = adjustedTimestampType;
|
SqmExpressible<?> timestampType = adjustedTimestampType;
|
||||||
Expression scale = adjustmentScale;
|
Expression scale = adjustmentScale;
|
||||||
boolean negate = negativeAdjustment;
|
boolean negate = negativeAdjustment;
|
||||||
adjustmentScale = null;
|
adjustmentScale = null;
|
||||||
|
@ -5090,11 +5090,11 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
@Override
|
@Override
|
||||||
public CaseSimpleExpression visitSimpleCaseExpression(SqmCaseSimple<?, ?> expression) {
|
public CaseSimpleExpression visitSimpleCaseExpression(SqmCaseSimple<?, ?> expression) {
|
||||||
final List<CaseSimpleExpression.WhenFragment> whenFragments = new ArrayList<>( expression.getWhenFragments().size() );
|
final List<CaseSimpleExpression.WhenFragment> whenFragments = new ArrayList<>( expression.getWhenFragments().size() );
|
||||||
final Supplier<MappingModelExpressable<?>> inferenceSupplier = inferrableTypeAccessStack.getCurrent();
|
final Supplier<MappingModelExpressible<?>> inferenceSupplier = inferrableTypeAccessStack.getCurrent();
|
||||||
inferrableTypeAccessStack.push(
|
inferrableTypeAccessStack.push(
|
||||||
() -> {
|
() -> {
|
||||||
for ( SqmCaseSimple.WhenFragment<?, ?> whenFragment : expression.getWhenFragments() ) {
|
for ( SqmCaseSimple.WhenFragment<?, ?> whenFragment : expression.getWhenFragments() ) {
|
||||||
final MappingModelExpressable<?> resolved = determineCurrentExpressable( whenFragment.getCheckValue() );
|
final MappingModelExpressible<?> resolved = determineCurrentExpressible( whenFragment.getCheckValue() );
|
||||||
if ( resolved != null ) {
|
if ( resolved != null ) {
|
||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
|
@ -5103,21 +5103,21 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
final Expression fixture = (Expression) expression.getFixture().accept( this );
|
final Expression fixture = (Expression) expression.getFixture().accept( this );
|
||||||
final MappingModelExpressable<?> fixtureType = (MappingModelExpressable<?>) fixture.getExpressionType();
|
final MappingModelExpressible<?> fixtureType = (MappingModelExpressible<?>) fixture.getExpressionType();
|
||||||
inferrableTypeAccessStack.pop();
|
inferrableTypeAccessStack.pop();
|
||||||
MappingModelExpressable<?> resolved = determineCurrentExpressable( expression );
|
MappingModelExpressible<?> resolved = determineCurrentExpressible( expression );
|
||||||
Expression otherwise = null;
|
Expression otherwise = null;
|
||||||
for ( SqmCaseSimple.WhenFragment<?, ?> whenFragment : expression.getWhenFragments() ) {
|
for ( SqmCaseSimple.WhenFragment<?, ?> whenFragment : expression.getWhenFragments() ) {
|
||||||
inferrableTypeAccessStack.push( () -> fixtureType );
|
inferrableTypeAccessStack.push( () -> fixtureType );
|
||||||
final Expression checkValue = (Expression) whenFragment.getCheckValue().accept( this );
|
final Expression checkValue = (Expression) whenFragment.getCheckValue().accept( this );
|
||||||
inferrableTypeAccessStack.pop();
|
inferrableTypeAccessStack.pop();
|
||||||
final MappingModelExpressable<?> alreadyKnown = resolved;
|
final MappingModelExpressible<?> alreadyKnown = resolved;
|
||||||
inferrableTypeAccessStack.push(
|
inferrableTypeAccessStack.push(
|
||||||
() -> alreadyKnown == null && inferenceSupplier != null ? inferenceSupplier.get() : alreadyKnown
|
() -> alreadyKnown == null && inferenceSupplier != null ? inferenceSupplier.get() : alreadyKnown
|
||||||
);
|
);
|
||||||
final Expression resultExpression = (Expression) whenFragment.getResult().accept( this );
|
final Expression resultExpression = (Expression) whenFragment.getResult().accept( this );
|
||||||
inferrableTypeAccessStack.pop();
|
inferrableTypeAccessStack.pop();
|
||||||
resolved = (MappingModelExpressable<?>) TypeHelper.highestPrecedence( resolved, resultExpression.getExpressionType() );
|
resolved = (MappingModelExpressible<?>) TypeHelper.highestPrecedence( resolved, resultExpression.getExpressionType() );
|
||||||
|
|
||||||
whenFragments.add(
|
whenFragments.add(
|
||||||
new CaseSimpleExpression.WhenFragment(
|
new CaseSimpleExpression.WhenFragment(
|
||||||
|
@ -5128,13 +5128,13 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( expression.getOtherwise() != null ) {
|
if ( expression.getOtherwise() != null ) {
|
||||||
final MappingModelExpressable<?> alreadyKnown = resolved;
|
final MappingModelExpressible<?> alreadyKnown = resolved;
|
||||||
inferrableTypeAccessStack.push(
|
inferrableTypeAccessStack.push(
|
||||||
() -> alreadyKnown == null && inferenceSupplier != null ? inferenceSupplier.get() : alreadyKnown
|
() -> alreadyKnown == null && inferenceSupplier != null ? inferenceSupplier.get() : alreadyKnown
|
||||||
);
|
);
|
||||||
otherwise = (Expression) expression.getOtherwise().accept( this );
|
otherwise = (Expression) expression.getOtherwise().accept( this );
|
||||||
inferrableTypeAccessStack.pop();
|
inferrableTypeAccessStack.pop();
|
||||||
resolved = (MappingModelExpressable<?>) TypeHelper.highestPrecedence( resolved, otherwise.getExpressionType() );
|
resolved = (MappingModelExpressible<?>) TypeHelper.highestPrecedence( resolved, otherwise.getExpressionType() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CaseSimpleExpression(
|
return new CaseSimpleExpression(
|
||||||
|
@ -5148,42 +5148,42 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
@Override
|
@Override
|
||||||
public CaseSearchedExpression visitSearchedCaseExpression(SqmCaseSearched<?> expression) {
|
public CaseSearchedExpression visitSearchedCaseExpression(SqmCaseSearched<?> expression) {
|
||||||
final List<CaseSearchedExpression.WhenFragment> whenFragments = new ArrayList<>( expression.getWhenFragments().size() );
|
final List<CaseSearchedExpression.WhenFragment> whenFragments = new ArrayList<>( expression.getWhenFragments().size() );
|
||||||
final Supplier<MappingModelExpressable<?>> inferenceSupplier = inferrableTypeAccessStack.getCurrent();
|
final Supplier<MappingModelExpressible<?>> inferenceSupplier = inferrableTypeAccessStack.getCurrent();
|
||||||
MappingModelExpressable<?> resolved = determineCurrentExpressable( expression );
|
MappingModelExpressible<?> resolved = determineCurrentExpressible( expression );
|
||||||
|
|
||||||
Expression otherwise = null;
|
Expression otherwise = null;
|
||||||
for ( SqmCaseSearched.WhenFragment<?> whenFragment : expression.getWhenFragments() ) {
|
for ( SqmCaseSearched.WhenFragment<?> whenFragment : expression.getWhenFragments() ) {
|
||||||
inferrableTypeAccessStack.push( () -> null );
|
inferrableTypeAccessStack.push( () -> null );
|
||||||
final Predicate whenPredicate = (Predicate) whenFragment.getPredicate().accept( this );
|
final Predicate whenPredicate = (Predicate) whenFragment.getPredicate().accept( this );
|
||||||
inferrableTypeAccessStack.pop();
|
inferrableTypeAccessStack.pop();
|
||||||
final MappingModelExpressable<?> alreadyKnown = resolved;
|
final MappingModelExpressible<?> alreadyKnown = resolved;
|
||||||
inferrableTypeAccessStack.push(
|
inferrableTypeAccessStack.push(
|
||||||
() -> alreadyKnown == null && inferenceSupplier != null ? inferenceSupplier.get() : alreadyKnown
|
() -> alreadyKnown == null && inferenceSupplier != null ? inferenceSupplier.get() : alreadyKnown
|
||||||
);
|
);
|
||||||
final Expression resultExpression = (Expression) whenFragment.getResult().accept( this );
|
final Expression resultExpression = (Expression) whenFragment.getResult().accept( this );
|
||||||
inferrableTypeAccessStack.pop();
|
inferrableTypeAccessStack.pop();
|
||||||
resolved = (MappingModelExpressable<?>) TypeHelper.highestPrecedence( resolved, resultExpression.getExpressionType() );
|
resolved = (MappingModelExpressible<?>) TypeHelper.highestPrecedence( resolved, resultExpression.getExpressionType() );
|
||||||
|
|
||||||
whenFragments.add( new CaseSearchedExpression.WhenFragment( whenPredicate, resultExpression ) );
|
whenFragments.add( new CaseSearchedExpression.WhenFragment( whenPredicate, resultExpression ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( expression.getOtherwise() != null ) {
|
if ( expression.getOtherwise() != null ) {
|
||||||
final MappingModelExpressable<?> alreadyKnown = resolved;
|
final MappingModelExpressible<?> alreadyKnown = resolved;
|
||||||
inferrableTypeAccessStack.push(
|
inferrableTypeAccessStack.push(
|
||||||
() -> alreadyKnown == null && inferenceSupplier != null ? inferenceSupplier.get() : alreadyKnown
|
() -> alreadyKnown == null && inferenceSupplier != null ? inferenceSupplier.get() : alreadyKnown
|
||||||
);
|
);
|
||||||
otherwise = (Expression) expression.getOtherwise().accept( this );
|
otherwise = (Expression) expression.getOtherwise().accept( this );
|
||||||
inferrableTypeAccessStack.pop();
|
inferrableTypeAccessStack.pop();
|
||||||
resolved = (MappingModelExpressable<?>) TypeHelper.highestPrecedence( resolved, otherwise.getExpressionType() );
|
resolved = (MappingModelExpressible<?>) TypeHelper.highestPrecedence( resolved, otherwise.getExpressionType() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CaseSearchedExpression( resolved, whenFragments, otherwise );
|
return new CaseSearchedExpression( resolved, whenFragments, otherwise );
|
||||||
}
|
}
|
||||||
|
|
||||||
private MappingModelExpressable<?> determineCurrentExpressable(SqmTypedNode<?> expression) {
|
private MappingModelExpressible<?> determineCurrentExpressible(SqmTypedNode<?> expression) {
|
||||||
return creationContext
|
return creationContext
|
||||||
.getDomainModel()
|
.getDomainModel()
|
||||||
.resolveMappingExpressable( expression.getNodeType(), getFromClauseIndex()::findTableGroup );
|
.resolveMappingExpressible( expression.getNodeType(), getFromClauseIndex()::findTableGroup );
|
||||||
}
|
}
|
||||||
|
|
||||||
private <X> X visitWithInferredType(SqmExpression<?> expression, SqmExpression<?> inferred) {
|
private <X> X visitWithInferredType(SqmExpression<?> expression, SqmExpression<?> inferred) {
|
||||||
|
@ -5199,9 +5199,9 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
// private <X> X visitWithLenientInferredType(SqmExpression<?> expression, SqmExpression<?> inferred) {
|
// private <X> X visitWithLenientInferredType(SqmExpression<?> expression, SqmExpression<?> inferred) {
|
||||||
// inferrableTypeAccessStack.push(
|
// inferrableTypeAccessStack.push(
|
||||||
// () -> {
|
// () -> {
|
||||||
// MappingModelExpressable<?> definedType = creationContext
|
// MappingModelExpressible<?> definedType = creationContext
|
||||||
// .getDomainModel()
|
// .getDomainModel()
|
||||||
// .resolveMappingExpressable(
|
// .resolveMappingExpressible(
|
||||||
// expression.getNodeType(),
|
// expression.getNodeType(),
|
||||||
// getFromClauseIndex()::findTableGroup
|
// getFromClauseIndex()::findTableGroup
|
||||||
// );
|
// );
|
||||||
|
@ -5210,7 +5210,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
// }
|
// }
|
||||||
// definedType = creationContext
|
// definedType = creationContext
|
||||||
// .getDomainModel()
|
// .getDomainModel()
|
||||||
// .lenientlyResolveMappingExpressable(
|
// .lenientlyResolveMappingExpressible(
|
||||||
// inferred.getNodeType(),
|
// inferred.getNodeType(),
|
||||||
// getFromClauseIndex()::findTableGroup
|
// getFromClauseIndex()::findTableGroup
|
||||||
// );
|
// );
|
||||||
|
@ -5230,7 +5230,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
public Object visitAny(SqmAny<?> sqmAny) {
|
public Object visitAny(SqmAny<?> sqmAny) {
|
||||||
return new Any(
|
return new Any(
|
||||||
visitSubQueryExpression( sqmAny.getSubquery() ),
|
visitSubQueryExpression( sqmAny.getSubquery() ),
|
||||||
null //resolveMappingExpressable( sqmAny.getNodeType() )
|
null //resolveMappingExpressible( sqmAny.getNodeType() )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5238,7 +5238,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
public Object visitEvery(SqmEvery<?> sqmEvery) {
|
public Object visitEvery(SqmEvery<?> sqmEvery) {
|
||||||
return new Every(
|
return new Every(
|
||||||
visitSubQueryExpression( sqmEvery.getSubquery() ),
|
visitSubQueryExpression( sqmEvery.getSubquery() ),
|
||||||
null //resolveMappingExpressable( sqmEvery.getNodeType() )
|
null //resolveMappingExpressible( sqmEvery.getNodeType() )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5293,7 +5293,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
return new QueryLiteral<>( jdbcValue, inferredPart );
|
return new QueryLiteral<>( jdbcValue, inferredPart );
|
||||||
}
|
}
|
||||||
|
|
||||||
final EnumJavaType<?> enumJtd = sqmEnumLiteral.getExpressableJavaType();
|
final EnumJavaType<?> enumJtd = sqmEnumLiteral.getExpressibleJavaType();
|
||||||
final JdbcType jdbcType = getTypeConfiguration().getJdbcTypeRegistry().getDescriptor( SqlTypes.TINYINT );
|
final JdbcType jdbcType = getTypeConfiguration().getJdbcTypeRegistry().getDescriptor( SqlTypes.TINYINT );
|
||||||
final BasicJavaType<Integer> relationalJtd = (BasicJavaType) getTypeConfiguration()
|
final BasicJavaType<Integer> relationalJtd = (BasicJavaType) getTypeConfiguration()
|
||||||
.getJavaTypeRegistry()
|
.getJavaTypeRegistry()
|
||||||
|
@ -5651,7 +5651,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
inferrableTypeAccessStack.push(
|
inferrableTypeAccessStack.push(
|
||||||
() -> {
|
() -> {
|
||||||
for ( SqmExpression<?> listExpression : predicate.getListExpressions() ) {
|
for ( SqmExpression<?> listExpression : predicate.getListExpressions() ) {
|
||||||
final MappingModelExpressable<?> mapping = determineValueMapping( listExpression );
|
final MappingModelExpressible<?> mapping = determineValueMapping( listExpression );
|
||||||
if ( mapping != null ) {
|
if ( mapping != null ) {
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.query.sqm.sql;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||||
import org.hibernate.sql.ast.spi.FromClauseAccess;
|
import org.hibernate.sql.ast.spi.FromClauseAccess;
|
||||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||||
|
@ -26,5 +26,5 @@ public interface SqmTranslation<T extends Statement> {
|
||||||
SqlExpressionResolver getSqlExpressionResolver();
|
SqlExpressionResolver getSqlExpressionResolver();
|
||||||
FromClauseAccess getFromClauseAccess();
|
FromClauseAccess getFromClauseAccess();
|
||||||
Map<SqmParameter<?>, List<List<JdbcParameter>>> getJdbcParamsBySqmParam();
|
Map<SqmParameter<?>, List<List<JdbcParameter>>> getJdbcParamsBySqmParam();
|
||||||
Map<SqmParameter<?>, MappingModelExpressable<?>> getSqmParameterMappingModelTypeResolutions();
|
Map<SqmParameter<?>, MappingModelExpressible<?>> getSqmParameterMappingModelTypeResolutions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.query.sqm.sql;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||||
import org.hibernate.sql.ast.spi.FromClauseAccess;
|
import org.hibernate.sql.ast.spi.FromClauseAccess;
|
||||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||||
|
@ -23,14 +23,14 @@ public class StandardSqmTranslation<T extends Statement> implements SqmTranslati
|
||||||
|
|
||||||
private final T sqlAst;
|
private final T sqlAst;
|
||||||
private final Map<SqmParameter<?>, List<List<JdbcParameter>>> jdbcParamMap;
|
private final Map<SqmParameter<?>, List<List<JdbcParameter>>> jdbcParamMap;
|
||||||
private final Map<SqmParameter<?>, MappingModelExpressable<?>> parameterMappingModelTypeMap;
|
private final Map<SqmParameter<?>, MappingModelExpressible<?>> parameterMappingModelTypeMap;
|
||||||
private final SqlExpressionResolver sqlExpressionResolver;
|
private final SqlExpressionResolver sqlExpressionResolver;
|
||||||
private final FromClauseAccess fromClauseAccess;
|
private final FromClauseAccess fromClauseAccess;
|
||||||
|
|
||||||
public StandardSqmTranslation(
|
public StandardSqmTranslation(
|
||||||
T sqlAst,
|
T sqlAst,
|
||||||
Map<SqmParameter<?>, List<List<JdbcParameter>>> jdbcParamMap,
|
Map<SqmParameter<?>, List<List<JdbcParameter>>> jdbcParamMap,
|
||||||
Map<SqmParameter<?>, MappingModelExpressable<?>> parameterMappingModelTypeMap,
|
Map<SqmParameter<?>, MappingModelExpressible<?>> parameterMappingModelTypeMap,
|
||||||
SqlExpressionResolver sqlExpressionResolver,
|
SqlExpressionResolver sqlExpressionResolver,
|
||||||
FromClauseAccess fromClauseAccess) {
|
FromClauseAccess fromClauseAccess) {
|
||||||
this.sqlAst = sqlAst;
|
this.sqlAst = sqlAst;
|
||||||
|
@ -51,7 +51,7 @@ public class StandardSqmTranslation<T extends Statement> implements SqmTranslati
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<SqmParameter<?>, MappingModelExpressable<?>> getSqmParameterMappingModelTypeResolutions() {
|
public Map<SqmParameter<?>, MappingModelExpressible<?>> getSqmParameterMappingModelTypeResolutions() {
|
||||||
return parameterMappingModelTypeMap;
|
return parameterMappingModelTypeMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ public interface DomainResultProducer<T> {
|
||||||
/*
|
/*
|
||||||
* select p.name, p2.name from Person p, Person p2
|
* select p.name, p2.name from Person p, Person p2
|
||||||
*
|
*
|
||||||
* SqmPathSource (SqmExpressable) (unmapped)
|
* SqmPathSource (SqmExpressible) (unmapped)
|
||||||
*
|
*
|
||||||
* DomainType
|
* DomainType
|
||||||
* SimpleDomainType
|
* SimpleDomainType
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class SqlAstProcessingStateImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// public Expression resolveSqlExpression(NonQualifiableSqlExpressable sqlSelectable) {
|
// public Expression resolveSqlExpression(NonQualifiableSqlExpressible sqlSelectable) {
|
||||||
// final Expression expression = normalize( sqlSelectable.createExpression() );
|
// final Expression expression = normalize( sqlSelectable.createExpression() );
|
||||||
// final Consumer<Expression> expressionConsumer = resolvedExpressionConsumerAccess.get();
|
// final Consumer<Expression> expressionConsumer = resolvedExpressionConsumerAccess.get();
|
||||||
// if ( expressionConsumer != null ) {
|
// if ( expressionConsumer != null ) {
|
||||||
|
|
|
@ -13,12 +13,12 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.mapping.DiscriminatedAssociationModelPart;
|
import org.hibernate.metamodel.mapping.DiscriminatedAssociationModelPart;
|
||||||
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
||||||
import org.hibernate.metamodel.mapping.EntityValuedModelPart;
|
import org.hibernate.metamodel.mapping.EntityValuedModelPart;
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.BindableType;
|
import org.hibernate.query.BindableType;
|
||||||
import org.hibernate.query.SemanticException;
|
import org.hibernate.query.SemanticException;
|
||||||
import org.hibernate.query.spi.QueryParameterBinding;
|
import org.hibernate.query.spi.QueryParameterBinding;
|
||||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||||
import org.hibernate.sql.ast.SqlAstWalker;
|
import org.hibernate.sql.ast.SqlAstWalker;
|
||||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||||
|
@ -36,7 +36,7 @@ import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||||
public class SqmParameterInterpretation implements Expression, DomainResultProducer, SqlTupleContainer {
|
public class SqmParameterInterpretation implements Expression, DomainResultProducer, SqlTupleContainer {
|
||||||
private final SqmParameter<?> sqmParameter;
|
private final SqmParameter<?> sqmParameter;
|
||||||
private final QueryParameterImplementor<?> queryParameter;
|
private final QueryParameterImplementor<?> queryParameter;
|
||||||
private final MappingModelExpressable<?> valueMapping;
|
private final MappingModelExpressible<?> valueMapping;
|
||||||
private final Function<QueryParameterImplementor<?>, QueryParameterBinding<?>> queryParameterBindingResolver;
|
private final Function<QueryParameterImplementor<?>, QueryParameterBinding<?>> queryParameterBindingResolver;
|
||||||
|
|
||||||
private final Expression resolvedExpression;
|
private final Expression resolvedExpression;
|
||||||
|
@ -45,7 +45,7 @@ public class SqmParameterInterpretation implements Expression, DomainResultProdu
|
||||||
SqmParameter<?> sqmParameter,
|
SqmParameter<?> sqmParameter,
|
||||||
QueryParameterImplementor<?> queryParameter,
|
QueryParameterImplementor<?> queryParameter,
|
||||||
List<JdbcParameter> jdbcParameters,
|
List<JdbcParameter> jdbcParameters,
|
||||||
MappingModelExpressable<?> valueMapping,
|
MappingModelExpressible<?> valueMapping,
|
||||||
Function<QueryParameterImplementor<?>, QueryParameterBinding<?>> queryParameterBindingResolver) {
|
Function<QueryParameterImplementor<?>, QueryParameterBinding<?>> queryParameterBindingResolver) {
|
||||||
this.sqmParameter = sqmParameter;
|
this.sqmParameter = sqmParameter;
|
||||||
this.queryParameter = queryParameter;
|
this.queryParameter = queryParameter;
|
||||||
|
@ -64,7 +64,7 @@ public class SqmParameterInterpretation implements Expression, DomainResultProdu
|
||||||
this.resolvedExpression = determineResolvedExpression( jdbcParameters, this.valueMapping );
|
this.resolvedExpression = determineResolvedExpression( jdbcParameters, this.valueMapping );
|
||||||
}
|
}
|
||||||
|
|
||||||
private Expression determineResolvedExpression(List<JdbcParameter> jdbcParameters, MappingModelExpressable<?> valueMapping) {
|
private Expression determineResolvedExpression(List<JdbcParameter> jdbcParameters, MappingModelExpressible<?> valueMapping) {
|
||||||
if ( valueMapping instanceof EmbeddableValuedModelPart
|
if ( valueMapping instanceof EmbeddableValuedModelPart
|
||||||
|| valueMapping instanceof DiscriminatedAssociationModelPart ) {
|
|| valueMapping instanceof DiscriminatedAssociationModelPart ) {
|
||||||
return new SqlTuple( jdbcParameters, valueMapping );
|
return new SqlTuple( jdbcParameters, valueMapping );
|
||||||
|
@ -84,7 +84,7 @@ public class SqmParameterInterpretation implements Expression, DomainResultProdu
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingModelExpressable<?> getExpressionType() {
|
public MappingModelExpressible<?> getExpressionType() {
|
||||||
return valueMapping;
|
return valueMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,18 +105,18 @@ public class SqmParameterInterpretation implements Expression, DomainResultProdu
|
||||||
.getCreationContext()
|
.getCreationContext()
|
||||||
.getSessionFactory();
|
.getSessionFactory();
|
||||||
|
|
||||||
final SqmExpressable<?> sqmExpressable = nodeType.resolveExpressable( sessionFactory );
|
final SqmExpressible<?> sqmExpressible = nodeType.resolveExpressible( sessionFactory );
|
||||||
|
|
||||||
final SqlSelection sqlSelection = creationState.getSqlAstCreationState().getSqlExpressionResolver().resolveSqlSelection(
|
final SqlSelection sqlSelection = creationState.getSqlAstCreationState().getSqlExpressionResolver().resolveSqlSelection(
|
||||||
resolvedExpression,
|
resolvedExpression,
|
||||||
sqmExpressable.getExpressableJavaType(),
|
sqmExpressible.getExpressibleJavaType(),
|
||||||
sessionFactory.getTypeConfiguration()
|
sessionFactory.getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
|
||||||
return new BasicResult<>(
|
return new BasicResult<>(
|
||||||
sqlSelection.getValuesArrayPosition(),
|
sqlSelection.getValuesArrayPosition(),
|
||||||
resultVariable,
|
resultVariable,
|
||||||
sqmExpressable.getExpressableJavaType()
|
sqmExpressible.getExpressibleJavaType()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,11 +147,11 @@ public class SqmParameterInterpretation implements Expression, DomainResultProdu
|
||||||
.getCreationContext()
|
.getCreationContext()
|
||||||
.getSessionFactory();
|
.getSessionFactory();
|
||||||
|
|
||||||
final SqmExpressable<?> sqmExpressable = nodeType.resolveExpressable( sessionFactory );
|
final SqmExpressible<?> sqmExpressible = nodeType.resolveExpressible( sessionFactory );
|
||||||
|
|
||||||
return creationState.getSqlAstCreationState().getSqlExpressionResolver().resolveSqlSelection(
|
return creationState.getSqlAstCreationState().getSqlExpressionResolver().resolveSqlSelection(
|
||||||
resolvedExpression,
|
resolvedExpression,
|
||||||
sqmExpressable.getExpressableJavaType(),
|
sqmExpressible.getExpressibleJavaType(),
|
||||||
sessionFactory.getTypeConfiguration()
|
sessionFactory.getTypeConfiguration()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.query.sqm.sql.internal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
import org.hibernate.metamodel.mapping.MappingModelExpressible;
|
||||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.internal.SqmMappingModelHelper;
|
import org.hibernate.query.sqm.internal.SqmMappingModelHelper;
|
||||||
import org.hibernate.sql.ast.spi.SqlAstCreationState;
|
import org.hibernate.sql.ast.spi.SqlAstCreationState;
|
||||||
|
@ -36,7 +36,7 @@ public class SqmTupleInterpretation<T> extends SqlTuple {
|
||||||
return new SqmTupleInterpretation<>(
|
return new SqmTupleInterpretation<>(
|
||||||
sqmTuple,
|
sqmTuple,
|
||||||
groupedSqlExpressions,
|
groupedSqlExpressions,
|
||||||
SqmMappingModelHelper.resolveMappingModelExpressable(
|
SqmMappingModelHelper.resolveMappingModelExpressible(
|
||||||
sqmTuple,
|
sqmTuple,
|
||||||
sqlAstCreationState.getCreationContext().getDomainModel(),
|
sqlAstCreationState.getCreationContext().getDomainModel(),
|
||||||
sqlAstCreationState.getFromClauseAccess()::findTableGroup
|
sqlAstCreationState.getFromClauseAccess()::findTableGroup
|
||||||
|
@ -49,7 +49,7 @@ public class SqmTupleInterpretation<T> extends SqlTuple {
|
||||||
public SqmTupleInterpretation(
|
public SqmTupleInterpretation(
|
||||||
SqmTuple<T> sqmTuple,
|
SqmTuple<T> sqmTuple,
|
||||||
List<? extends Expression> expressions,
|
List<? extends Expression> expressions,
|
||||||
MappingModelExpressable valueMapping) {
|
MappingModelExpressible valueMapping) {
|
||||||
|
|
||||||
super( expressions, valueMapping );
|
super( expressions, valueMapping );
|
||||||
interpretedSqmTuple = sqmTuple;
|
interpretedSqmTuple = sqmTuple;
|
||||||
|
|
|
@ -6,22 +6,22 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.tree;
|
package org.hibernate.query.sqm.tree;
|
||||||
|
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accessor for {@link SqmExpressable}.
|
* Accessor for {@link SqmExpressible}.
|
||||||
*
|
*
|
||||||
* @author Christian Beikov
|
* @author Christian Beikov
|
||||||
*/
|
*/
|
||||||
public interface SqmExpressableAccessor<T> {
|
public interface SqmExpressibleAccessor<T> {
|
||||||
/**
|
/**
|
||||||
* The Java type descriptor for this node.
|
* The Java type descriptor for this node.
|
||||||
*/
|
*/
|
||||||
default JavaType<T> getNodeJavaType() {
|
default JavaType<T> getNodeJavaType() {
|
||||||
final SqmExpressable<T> nodeType = getExpressable();
|
final SqmExpressible<T> nodeType = getExpressible();
|
||||||
return nodeType != null ? nodeType.getExpressableJavaType() : null;
|
return nodeType != null ? nodeType.getExpressibleJavaType() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
SqmExpressable<T> getExpressable();
|
SqmExpressible<T> getExpressible();
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.tree;
|
package org.hibernate.query.sqm.tree;
|
||||||
|
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,19 +15,19 @@ import org.hibernate.type.descriptor.java.JavaType;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface SqmTypedNode<T> extends SqmNode, SqmExpressableAccessor<T> {
|
public interface SqmTypedNode<T> extends SqmNode, SqmExpressibleAccessor<T> {
|
||||||
/**
|
/**
|
||||||
* The Java type descriptor for this node.
|
* The Java type descriptor for this node.
|
||||||
*/
|
*/
|
||||||
default JavaType<T> getNodeJavaType() {
|
default JavaType<T> getNodeJavaType() {
|
||||||
final SqmExpressable<T> nodeType = getNodeType();
|
final SqmExpressible<T> nodeType = getNodeType();
|
||||||
return nodeType != null ? nodeType.getExpressableJavaType() : null;
|
return nodeType != null ? nodeType.getExpressibleJavaType() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default SqmExpressable<T> getExpressable() {
|
default SqmExpressible<T> getExpressible() {
|
||||||
return getNodeType();
|
return getNodeType();
|
||||||
}
|
}
|
||||||
|
|
||||||
SqmExpressable<T> getNodeType();
|
SqmExpressible<T> getNodeType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.query.sqm.tree.cte;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.hibernate.metamodel.mapping.ModelPart;
|
|
||||||
import org.hibernate.metamodel.mapping.ValueMapping;
|
import org.hibernate.metamodel.mapping.ValueMapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,15 +17,15 @@ import org.hibernate.metamodel.mapping.ValueMapping;
|
||||||
public class SqmCteTableColumn implements Serializable {
|
public class SqmCteTableColumn implements Serializable {
|
||||||
private final SqmCteTable cteTable;
|
private final SqmCteTable cteTable;
|
||||||
private final String columnName;
|
private final String columnName;
|
||||||
private final ValueMapping typeExpressable;
|
private final ValueMapping typeExpressible;
|
||||||
|
|
||||||
public SqmCteTableColumn(
|
public SqmCteTableColumn(
|
||||||
SqmCteTable cteTable,
|
SqmCteTable cteTable,
|
||||||
String columnName,
|
String columnName,
|
||||||
ValueMapping typeExpressable) {
|
ValueMapping typeExpressible) {
|
||||||
this.cteTable = cteTable;
|
this.cteTable = cteTable;
|
||||||
this.columnName = columnName;
|
this.columnName = columnName;
|
||||||
this.typeExpressable = typeExpressable;
|
this.typeExpressible = typeExpressible;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqmCteTable getCteTable() {
|
public SqmCteTable getCteTable() {
|
||||||
|
@ -38,7 +37,7 @@ public class SqmCteTableColumn implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueMapping getType() {
|
public ValueMapping getType() {
|
||||||
return typeExpressable;
|
return typeExpressible;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.hibernate.query.SemanticException;
|
||||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SqmPathSource;
|
import org.hibernate.query.sqm.SqmPathSource;
|
||||||
import org.hibernate.type.descriptor.java.BasicJavaType;
|
import org.hibernate.type.descriptor.java.BasicJavaType;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
@ -24,7 +24,7 @@ import org.hibernate.type.descriptor.java.JavaType;
|
||||||
*/
|
*/
|
||||||
public class SqmBasicValuedSimplePath<T>
|
public class SqmBasicValuedSimplePath<T>
|
||||||
extends AbstractSqmSimplePath<T>
|
extends AbstractSqmSimplePath<T>
|
||||||
implements BindableType<T>, SqmExpressable<T> {
|
implements BindableType<T>, SqmExpressible<T> {
|
||||||
public SqmBasicValuedSimplePath(
|
public SqmBasicValuedSimplePath(
|
||||||
NavigablePath navigablePath,
|
NavigablePath navigablePath,
|
||||||
SqmPathSource<T> referencedPathSource,
|
SqmPathSource<T> referencedPathSource,
|
||||||
|
@ -93,7 +93,7 @@ public class SqmBasicValuedSimplePath<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<T> getExpressableJavaType() {
|
public JavaType<T> getExpressibleJavaType() {
|
||||||
return getJavaTypeDescriptor();
|
return getJavaTypeDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.hibernate.query.PathException;
|
||||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SqmPathSource;
|
import org.hibernate.query.sqm.SqmPathSource;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import org.hibernate.type.descriptor.java.JavaType;
|
||||||
*/
|
*/
|
||||||
public class SqmEmbeddedValuedSimplePath<T>
|
public class SqmEmbeddedValuedSimplePath<T>
|
||||||
extends AbstractSqmSimplePath<T>
|
extends AbstractSqmSimplePath<T>
|
||||||
implements BindableType<T>, SqmExpressable<T> {
|
implements BindableType<T>, SqmExpressible<T> {
|
||||||
public SqmEmbeddedValuedSimplePath(
|
public SqmEmbeddedValuedSimplePath(
|
||||||
NavigablePath navigablePath,
|
NavigablePath navigablePath,
|
||||||
SqmPathSource<T> referencedPathSource,
|
SqmPathSource<T> referencedPathSource,
|
||||||
|
@ -73,7 +73,7 @@ public class SqmEmbeddedValuedSimplePath<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<T> getExpressableJavaType() {
|
public JavaType<T> getExpressibleJavaType() {
|
||||||
return getJavaTypeDescriptor();
|
return getJavaTypeDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.function.Consumer;
|
||||||
import org.hibernate.query.criteria.JpaSelection;
|
import org.hibernate.query.criteria.JpaSelection;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.tree.select.SqmSelectableNode;
|
import org.hibernate.query.sqm.tree.select.SqmSelectableNode;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
import org.hibernate.type.descriptor.java.JavaType;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import jakarta.persistence.criteria.Predicate;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class SqmMapEntryReference<K,V>
|
public class SqmMapEntryReference<K,V>
|
||||||
implements SqmSelectableNode<Map.Entry<K,V>>, Expression<Map.Entry<K,V>>, SqmExpressable<Map.Entry<K,V>> {
|
implements SqmSelectableNode<Map.Entry<K,V>>, Expression<Map.Entry<K,V>>, SqmExpressible<Map.Entry<K,V>> {
|
||||||
@SuppressWarnings({"FieldCanBeLocal", "unused"})
|
@SuppressWarnings({"FieldCanBeLocal", "unused"})
|
||||||
private final SqmPath<?> mapPath;
|
private final SqmPath<?> mapPath;
|
||||||
private final NodeBuilder nodeBuilder;
|
private final NodeBuilder nodeBuilder;
|
||||||
|
@ -78,7 +78,7 @@ public class SqmMapEntryReference<K,V>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<Map.Entry<K, V>> getExpressableJavaType() {
|
public JavaType<Map.Entry<K, V>> getExpressibleJavaType() {
|
||||||
return mapEntryTypeDescriptor;
|
return mapEntryTypeDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public class SqmMapEntryReference<K,V>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmExpressable<Map.Entry<K, V>> getNodeType() {
|
public SqmExpressible<Map.Entry<K, V>> getNodeType() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.hibernate.query.criteria.JpaPath;
|
||||||
import org.hibernate.query.hql.spi.SemanticPathPart;
|
import org.hibernate.query.hql.spi.SemanticPathPart;
|
||||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||||
import org.hibernate.query.sqm.ParsingException;
|
import org.hibernate.query.sqm.ParsingException;
|
||||||
import org.hibernate.query.sqm.SqmExpressable;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SqmPathSource;
|
import org.hibernate.query.sqm.SqmPathSource;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||||
import org.hibernate.query.sqm.tree.from.SqmRoot;
|
import org.hibernate.query.sqm.tree.from.SqmRoot;
|
||||||
|
@ -103,13 +103,13 @@ public interface SqmPath<T> extends SqmExpression<T>, SemanticPathPart, JpaPath<
|
||||||
SqmPathSource<T> getNodeType();
|
SqmPathSource<T> getNodeType();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void applyInferableType(SqmExpressable<?> type) {
|
default void applyInferableType(SqmExpressible<?> type) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default JavaType<T> getJavaTypeDescriptor() {
|
default JavaType<T> getJavaTypeDescriptor() {
|
||||||
return getNodeType().getExpressableJavaType();
|
return getNodeType().getExpressibleJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class SqmPolymorphicRootDescriptor<T> implements EntityDomainType<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaType<T> getExpressableJavaType() {
|
public JavaType<T> getExpressibleJavaType() {
|
||||||
return polymorphicJavaType;
|
return polymorphicJavaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue