HHH-15017 - Clean-up Query#setParameter overloads
- https://hibernate.atlassian.net/browse/HHH-15017
This commit is contained in:
parent
b8114bad31
commit
b62c23ab29
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.dialect.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor;
|
||||
import org.hibernate.query.sqm.function.SelfRenderingSqmFunction;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.dialect.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor;
|
||||
import org.hibernate.query.sqm.function.SelfRenderingSqmFunction;
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
package org.hibernate.dialect.function;
|
||||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.TemporalUnit;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.dialect.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.BinaryArithmeticOperator;
|
||||
import org.hibernate.query.ComparisonOperator;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.dialect.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor;
|
||||
import org.hibernate.query.sqm.function.SelfRenderingSqmFunction;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.dialect.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.TrimSpec;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.dialect.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor;
|
||||
import org.hibernate.query.sqm.function.SelfRenderingSqmFunction;
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.sqm.function.NamedSqmFunctionDescriptor;
|
||||
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.dialect.function;
|
|||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.BinaryArithmeticOperator;
|
||||
import org.hibernate.query.TemporalUnit;
|
||||
import org.hibernate.query.sqm.function.AbstractSqmSelfRenderingFunctionDescriptor;
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.dialect.function;
|
|||
import java.util.List;
|
||||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.sqm.function.AbstractSqmSelfRenderingFunctionDescriptor;
|
||||
import org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression;
|
||||
import org.hibernate.query.sqm.produce.function.ArgumentTypesValidator;
|
||||
|
|
|
@ -8,7 +8,7 @@ package org.hibernate.dialect.function;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.function.FunctionRenderingSupport;
|
||||
import org.hibernate.query.sqm.function.SelfRenderingSqmFunction;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
package org.hibernate.engine.query.spi;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
|
||||
import org.hibernate.metamodel.model.domain.internal.EntityTypeImpl;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
|
@ -18,12 +18,12 @@ import org.hibernate.query.QueryParameter;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
@Incubating
|
||||
public abstract class AbstractParameterDescriptor implements QueryParameter {
|
||||
public abstract class AbstractParameterDescriptor<T> implements QueryParameter<T> {
|
||||
private final int[] sourceLocations;
|
||||
|
||||
private AllowableParameterType expectedType;
|
||||
private AllowableParameterType<T> expectedType;
|
||||
|
||||
public AbstractParameterDescriptor(int[] sourceLocations, AllowableParameterType expectedType) {
|
||||
public AbstractParameterDescriptor(int[] sourceLocations, AllowableParameterType<T> expectedType) {
|
||||
this.sourceLocations = sourceLocations;
|
||||
this.expectedType = expectedType;
|
||||
}
|
||||
|
@ -39,28 +39,28 @@ public abstract class AbstractParameterDescriptor implements QueryParameter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getParameterType() {
|
||||
return expectedType == null ? null : expectedType.getExpressableJavaTypeDescriptor().getJavaTypeClass();
|
||||
public Class<T> getParameterType() {
|
||||
return expectedType == null ? null : expectedType.getBindableJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AllowableParameterType getHibernateType() {
|
||||
public AllowableParameterType<T> getHibernateType() {
|
||||
return getExpectedType();
|
||||
}
|
||||
|
||||
|
||||
public AllowableParameterType getExpectedType() {
|
||||
public AllowableParameterType<T> getExpectedType() {
|
||||
return expectedType;
|
||||
}
|
||||
|
||||
public void resetExpectedType(AllowableParameterType expectedType) {
|
||||
public void resetExpectedType(AllowableParameterType<T> expectedType) {
|
||||
this.expectedType = expectedType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowsMultiValuedBinding() {
|
||||
if ( expectedType instanceof EntityTypeImpl ) {
|
||||
return ( (EntityTypeImpl) expectedType ).getIdType() instanceof EmbeddableDomainType;
|
||||
return ( (EntityTypeImpl<T>) expectedType ).getIdType() instanceof EmbeddableDomainType;
|
||||
}
|
||||
return expectedType instanceof EmbeddableDomainType;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
package org.hibernate.engine.query.spi;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
|
||||
/**
|
||||
* Descriptor regarding a named parameter.
|
||||
|
@ -15,7 +15,7 @@ import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
@Incubating
|
||||
public class NamedParameterDescriptor extends AbstractParameterDescriptor {
|
||||
public class NamedParameterDescriptor<T> extends AbstractParameterDescriptor<T> {
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@ public class NamedParameterDescriptor extends AbstractParameterDescriptor {
|
|||
* @param expectedType The expected type of the parameter, according to the translator
|
||||
* @param sourceLocations The locations of the named parameters (aye aye aye)
|
||||
*/
|
||||
public NamedParameterDescriptor(String name, AllowableParameterType expectedType, int[] sourceLocations) {
|
||||
public NamedParameterDescriptor(String name, AllowableParameterType<T> expectedType, int[] sourceLocations) {
|
||||
super( sourceLocations, expectedType );
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class NamedParameterDescriptor extends AbstractParameterDescriptor {
|
|||
return false;
|
||||
}
|
||||
|
||||
NamedParameterDescriptor that = (NamedParameterDescriptor) o;
|
||||
final NamedParameterDescriptor<?> that = (NamedParameterDescriptor<?>) o;
|
||||
return getName().equals( that.getName() );
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
package org.hibernate.engine.query.spi;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
|
||||
/**
|
||||
* Descriptor regarding an ordinal parameter.
|
||||
|
@ -15,7 +15,7 @@ import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
@Incubating
|
||||
public class OrdinalParameterDescriptor extends AbstractParameterDescriptor {
|
||||
public class OrdinalParameterDescriptor<T> extends AbstractParameterDescriptor<T> {
|
||||
private final int label;
|
||||
private final int valuePosition;
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class OrdinalParameterDescriptor extends AbstractParameterDescriptor {
|
|||
public OrdinalParameterDescriptor(
|
||||
int label,
|
||||
int valuePosition,
|
||||
AllowableParameterType expectedType,
|
||||
AllowableParameterType<T> expectedType,
|
||||
int[] sourceLocations) {
|
||||
super( sourceLocations, expectedType );
|
||||
this.label = label;
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.hibernate.internal.FastSessionServices;
|
|||
import org.hibernate.metadata.ClassMetadata;
|
||||
import org.hibernate.metadata.CollectionMetadata;
|
||||
import org.hibernate.metamodel.RuntimeMetamodels;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.JpaMetamodel;
|
||||
import org.hibernate.metamodel.spi.MetamodelImplementor;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.graph.internal.parse;
|
||||
|
||||
import org.hibernate.graph.CannotContainSubGraphException;
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.metamodel.model.domain.SimpleDomainType;
|
||||
import org.hibernate.metamodel.model.domain.ManagedDomainType;
|
||||
|
||||
|
@ -35,7 +36,7 @@ public enum PathQualifierType {
|
|||
);
|
||||
|
||||
private static ManagedDomainType resolveSubTypeManagedType(
|
||||
SimpleDomainType<?> graphType,
|
||||
DomainType<?> graphType,
|
||||
String subTypeName) {
|
||||
if ( !( graphType instanceof ManagedDomainType ) ) {
|
||||
throw new CannotContainSubGraphException( "The given type [" + graphType + "] is not a ManagedType" );
|
||||
|
|
|
@ -99,7 +99,7 @@ import org.hibernate.metadata.ClassMetadata;
|
|||
import org.hibernate.metadata.CollectionMetadata;
|
||||
import org.hibernate.metamodel.RuntimeMetamodels;
|
||||
import org.hibernate.metamodel.internal.RuntimeMetamodelsImpl;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.JpaMetamodel;
|
||||
import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl;
|
||||
import org.hibernate.metamodel.spi.MetamodelImplementor;
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.util.function.Function;
|
|||
import org.hibernate.Incubating;
|
||||
import org.hibernate.graph.RootGraph;
|
||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.metamodel.model.domain.NavigableRole;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.hibernate.metamodel.mapping.AttributeMapping;
|
|||
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
|
||||
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
||||
import org.hibernate.metamodel.model.domain.AbstractIdentifiableType;
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
|
||||
import org.hibernate.metamodel.model.domain.IdentifiableDomainType;
|
||||
import org.hibernate.metamodel.model.domain.ManagedDomainType;
|
||||
|
@ -110,15 +111,15 @@ public class AttributeFactory {
|
|||
normalMemberResolver,
|
||||
metadataContext
|
||||
);
|
||||
if ( attributeMetadata == null ) {
|
||||
return null;
|
||||
}
|
||||
if ( attributeMetadata.isPlural() ) {
|
||||
|
||||
if ( attributeMetadata instanceof PluralAttributeMetadata ) {
|
||||
//noinspection rawtypes
|
||||
return PluralAttributeBuilder.build( (PluralAttributeMetadata) attributeMetadata, metadataContext );
|
||||
}
|
||||
|
||||
final SingularAttributeMetadata<X, Y> singularAttributeMetadata = (SingularAttributeMetadata<X, Y>) attributeMetadata;
|
||||
final SimpleDomainType<Y> metaModelType = determineSimpleType( singularAttributeMetadata.getValueContext(), metadataContext );
|
||||
return new SingularAttributeImpl(
|
||||
final DomainType<Y> metaModelType = determineSimpleType( singularAttributeMetadata.getValueContext(), metadataContext );
|
||||
return new SingularAttributeImpl<>(
|
||||
ownerType,
|
||||
attributeMetadata.getName(),
|
||||
attributeMetadata.getAttributeClassification(),
|
||||
|
@ -132,7 +133,7 @@ public class AttributeFactory {
|
|||
}
|
||||
|
||||
private static <X> AttributeContext<X> wrap(final ManagedDomainType<X> ownerType, final Property property) {
|
||||
return new AttributeContext<X>() {
|
||||
return new AttributeContext<>() {
|
||||
public ManagedDomainType<X> getOwnerType() {
|
||||
return ownerType;
|
||||
}
|
||||
|
@ -153,7 +154,6 @@ public class AttributeFactory {
|
|||
*
|
||||
* @return The built attribute descriptor
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <X, Y> SingularPersistentAttribute<X, Y> buildIdAttribute(
|
||||
IdentifiableDomainType<X> ownerType,
|
||||
Property property) {
|
||||
|
@ -164,15 +164,15 @@ public class AttributeFactory {
|
|||
|
||||
// id-attribute = "id"
|
||||
|
||||
final SingularAttributeMetadata<X, Y> attributeMetadata = (SingularAttributeMetadata) determineAttributeMetadata(
|
||||
final SingularAttributeMetadata<X, Y> attributeMetadata = (SingularAttributeMetadata<X,Y>) determineAttributeMetadata(
|
||||
wrap( ownerType, property ),
|
||||
identifierMemberResolver
|
||||
);
|
||||
|
||||
return new SingularAttributeImpl.Identifier(
|
||||
return new SingularAttributeImpl.Identifier<>(
|
||||
ownerType,
|
||||
property.getName(),
|
||||
determineSimpleType( attributeMetadata.getValueContext() ),
|
||||
(SimpleDomainType<Y>) determineSimpleType( attributeMetadata.getValueContext() ),
|
||||
attributeMetadata.getMember(),
|
||||
attributeMetadata.getAttributeClassification(),
|
||||
context
|
||||
|
@ -189,7 +189,6 @@ public class AttributeFactory {
|
|||
*
|
||||
* @return The built attribute descriptor
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <X, Y> SingularAttributeImpl<X, Y> buildVersionAttribute(
|
||||
IdentifiableDomainType<X> ownerType,
|
||||
Property property) {
|
||||
|
@ -200,22 +199,22 @@ public class AttributeFactory {
|
|||
versionMemberResolver
|
||||
);
|
||||
|
||||
return new SingularAttributeImpl.Version(
|
||||
return new SingularAttributeImpl.Version<>(
|
||||
ownerType,
|
||||
property.getName(),
|
||||
attributeMetadata.getAttributeClassification(),
|
||||
determineSimpleType( attributeMetadata.getValueContext() ),
|
||||
(SimpleDomainType<Y>) determineSimpleType( attributeMetadata.getValueContext() ),
|
||||
attributeMetadata.getMember(),
|
||||
context
|
||||
);
|
||||
}
|
||||
|
||||
private <Y> SimpleDomainType<Y> determineSimpleType(ValueContext typeContext) {
|
||||
private <Y> DomainType<Y> determineSimpleType(ValueContext typeContext) {
|
||||
return determineSimpleType( typeContext, context );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <Y> SimpleDomainType<Y> determineSimpleType(ValueContext typeContext, MetadataContext context) {
|
||||
public static <Y> DomainType<Y> determineSimpleType(ValueContext typeContext, MetadataContext context) {
|
||||
switch ( typeContext.getValueClassification() ) {
|
||||
case BASIC: {
|
||||
return context.resolveBasicType( typeContext.getJpaBindableType() );
|
||||
|
@ -229,7 +228,7 @@ public class AttributeFactory {
|
|||
|
||||
assert type instanceof AnyType;
|
||||
final AnyType anyType = (AnyType) type;
|
||||
final JavaType<Object> baseJtd = context.getTypeConfiguration()
|
||||
final JavaType<Y> baseJtd = context.getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.resolveDescriptor( anyType.getReturnedClass() );
|
||||
return new AnyMappingDomainTypeImpl<>( anyType, baseJtd );
|
||||
|
@ -239,7 +238,7 @@ public class AttributeFactory {
|
|||
final EmbeddableTypeImpl<Y> embeddableType;
|
||||
|
||||
if ( component.isDynamic() ) {
|
||||
final JavaType javaTypeDescriptor = context.getJavaTypeDescriptorRegistry().getDescriptor( java.util.Map.class );
|
||||
final JavaType<Y> javaTypeDescriptor = context.getJavaTypeDescriptorRegistry().getDescriptor( java.util.Map.class );
|
||||
|
||||
embeddableType = new EmbeddableTypeImpl<>(
|
||||
javaTypeDescriptor,
|
||||
|
@ -293,10 +292,6 @@ public class AttributeFactory {
|
|||
}
|
||||
}
|
||||
|
||||
private EntityMetamodel getDeclarerEntityMetamodel(AbstractIdentifiableType<?> ownerType) {
|
||||
return getDeclarerEntityMetamodel( ownerType, context );
|
||||
}
|
||||
|
||||
private static EntityPersister getDeclaringEntity(
|
||||
AbstractIdentifiableType<?> ownerType,
|
||||
MetadataContext metadataContext) {
|
||||
|
@ -347,7 +342,6 @@ public class AttributeFactory {
|
|||
*
|
||||
* @return The attribute description
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private <X, Y> AttributeMetadata<X, Y> determineAttributeMetadata(
|
||||
AttributeContext<X> attributeContext,
|
||||
MemberResolver memberResolver) {
|
||||
|
@ -447,7 +441,7 @@ public class AttributeFactory {
|
|||
else {
|
||||
indexClassification = null;
|
||||
}
|
||||
return new PluralAttributeMetadataImpl(
|
||||
return new PluralAttributeMetadataImpl<>(
|
||||
propertyMapping,
|
||||
attributeContext.getOwnerType(),
|
||||
member,
|
||||
|
@ -644,7 +638,7 @@ public class AttributeFactory {
|
|||
* A {@link Member} resolver for normal attributes.
|
||||
*/
|
||||
private static final MemberResolver normalMemberResolver = (attributeContext, metadataContext) -> {
|
||||
final ManagedDomainType ownerType = attributeContext.getOwnerType();
|
||||
final ManagedDomainType<?> ownerType = attributeContext.getOwnerType();
|
||||
final Property property = attributeContext.getPropertyMapping();
|
||||
final Type.PersistenceType persistenceType = ownerType.getPersistenceType();
|
||||
if ( Type.PersistenceType.EMBEDDABLE == persistenceType ) {
|
||||
|
@ -652,7 +646,7 @@ public class AttributeFactory {
|
|||
}
|
||||
else if ( Type.PersistenceType.ENTITY == persistenceType
|
||||
|| Type.PersistenceType.MAPPED_SUPERCLASS == persistenceType ) {
|
||||
final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) ownerType;
|
||||
final AbstractIdentifiableType<?> identifiableType = (AbstractIdentifiableType<?>) ownerType;
|
||||
final EntityPersister declaringEntityMapping = getDeclaringEntity( identifiableType, metadataContext );
|
||||
final EntityMetamodel entityMetamodel = declaringEntityMapping.getEntityMetamodel();
|
||||
final String propertyName = property.getName();
|
||||
|
@ -674,7 +668,7 @@ public class AttributeFactory {
|
|||
};
|
||||
|
||||
private final MemberResolver identifierMemberResolver = (attributeContext, metadataContext) -> {
|
||||
final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType();
|
||||
final AbstractIdentifiableType<?> identifiableType = (AbstractIdentifiableType<?>) attributeContext.getOwnerType();
|
||||
final EntityPersister declaringEntityMapping = getDeclaringEntity( identifiableType, metadataContext );
|
||||
final EntityMetamodel entityMetamodel = declaringEntityMapping.getEntityMetamodel();
|
||||
|
||||
|
@ -696,30 +690,25 @@ public class AttributeFactory {
|
|||
}
|
||||
};
|
||||
|
||||
private final MemberResolver versionMemberResolver = new MemberResolver() {
|
||||
@Override
|
||||
public Member resolveMember(
|
||||
AttributeContext attributeContext,
|
||||
MetadataContext metadataContext) {
|
||||
final AbstractIdentifiableType identifiableType = (AbstractIdentifiableType) attributeContext.getOwnerType();
|
||||
final EntityPersister declaringEntityMapping = getDeclaringEntity( identifiableType, metadataContext );
|
||||
final EntityMetamodel entityMetamodel = declaringEntityMapping.getEntityMetamodel();
|
||||
final String versionPropertyName = attributeContext.getPropertyMapping().getName();
|
||||
if ( !versionPropertyName.equals( entityMetamodel.getVersionProperty().getName() ) ) {
|
||||
// this should never happen, but to be safe...
|
||||
throw new IllegalArgumentException( "Given property did not match declared version property" );
|
||||
}
|
||||
private final MemberResolver versionMemberResolver = (attributeContext, metadataContext) -> {
|
||||
final AbstractIdentifiableType<?> identifiableType = (AbstractIdentifiableType<?>) attributeContext.getOwnerType();
|
||||
final EntityPersister declaringEntityMapping = getDeclaringEntity( identifiableType, metadataContext );
|
||||
final EntityMetamodel entityMetamodel = declaringEntityMapping.getEntityMetamodel();
|
||||
final String versionPropertyName = attributeContext.getPropertyMapping().getName();
|
||||
if ( !versionPropertyName.equals( entityMetamodel.getVersionProperty().getName() ) ) {
|
||||
// this should never happen, but to be safe...
|
||||
throw new IllegalArgumentException( "Given property did not match declared version property" );
|
||||
}
|
||||
|
||||
final Getter getter = declaringEntityMapping.getRepresentationStrategy().resolvePropertyAccess( attributeContext.getPropertyMapping() ).getGetter();
|
||||
if ( PropertyAccessMapImpl.GetterImpl.class.isInstance( getter ) ) {
|
||||
return new MapMember(
|
||||
versionPropertyName,
|
||||
attributeContext.getPropertyMapping().getType().getReturnedClass()
|
||||
);
|
||||
}
|
||||
else {
|
||||
return getter.getMember();
|
||||
}
|
||||
final Getter getter = declaringEntityMapping.getRepresentationStrategy().resolvePropertyAccess( attributeContext.getPropertyMapping() ).getGetter();
|
||||
if ( getter instanceof PropertyAccessMapImpl.GetterImpl ) {
|
||||
return new MapMember(
|
||||
versionPropertyName,
|
||||
attributeContext.getPropertyMapping().getType().getReturnedClass()
|
||||
);
|
||||
}
|
||||
else {
|
||||
return getter.getMember();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,12 +11,12 @@ import org.hibernate.metamodel.CollectionClassification;
|
|||
/**
|
||||
* Attribute metadata contract for a plural attribute.
|
||||
*
|
||||
* @param <X> The owner type
|
||||
* @param <Y> The attribute type (the collection type)
|
||||
* @param <O> The owner type
|
||||
* @param <C> The attribute type (the collection type)
|
||||
* @param <E> The collection element type
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public interface PluralAttributeMetadata<X, Y, E> extends AttributeMetadata<X, Y> {
|
||||
public interface PluralAttributeMetadata<O, C, E> extends AttributeMetadata<O, C> {
|
||||
/**
|
||||
* The classification of the collection, indicating the collection semantics
|
||||
* to be used.
|
||||
|
|
|
@ -34,4 +34,9 @@ public abstract class AbstractDomainType<J> implements SimpleDomainType<J> {
|
|||
public Class<J> getJavaType() {
|
||||
return getExpressableJavaTypeDescriptor().getJavaTypeClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<J> getBindableJavaType() {
|
||||
return getJavaType();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
|
||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
*/
|
||||
package org.hibernate.metamodel.model.domain;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.query.Query;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
|
||||
/**
|
||||
* Specialization of {@link DomainType} for types that can be used as {@link Query} parameter bind values.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Incubating
|
||||
public interface AllowableParameterType<J> extends SimpleDomainType<J> {
|
||||
JavaType<J> getExpressableJavaTypeDescriptor();
|
||||
}
|
|
@ -10,6 +10,8 @@ import java.util.Objects;
|
|||
import jakarta.persistence.metamodel.BasicType;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableOutputParameterType;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
package org.hibernate.metamodel.model.domain;
|
||||
|
||||
import org.hibernate.metamodel.ManagedTypeRepresentationStrategy;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
|
||||
import jakarta.persistence.metamodel.EmbeddableType;
|
||||
|
||||
|
@ -18,5 +19,6 @@ import jakarta.persistence.metamodel.EmbeddableType;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface EmbeddableDomainType<J> extends ManagedDomainType<J>, EmbeddableType<J>, AllowableParameterType<J> {
|
||||
public interface EmbeddableDomainType<J>
|
||||
extends ManagedDomainType<J>, EmbeddableType<J>, AllowableParameterType<J>, SqmExpressable<J> {
|
||||
}
|
||||
|
|
|
@ -7,17 +7,19 @@
|
|||
package org.hibernate.metamodel.model.domain;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import jakarta.persistence.metamodel.ManagedType;
|
||||
|
||||
import org.hibernate.graph.spi.SubGraphImplementor;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
|
||||
import jakarta.persistence.metamodel.ManagedType;
|
||||
|
||||
/**
|
||||
* Hibernate extension to the JPA {@link ManagedType} contract
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface ManagedDomainType<J> extends AllowableParameterType<J>, ManagedType<J> {
|
||||
public interface ManagedDomainType<J> extends SqmExpressable<J>, DomainType<J>, ManagedType<J> {
|
||||
/**
|
||||
* Get the type name.
|
||||
*
|
||||
|
|
|
@ -27,6 +27,6 @@ public interface PersistentAttribute<D,J> extends Attribute<D,J> {
|
|||
*/
|
||||
AttributeClassification getAttributeClassification();
|
||||
|
||||
SimpleDomainType<?> getValueGraphType();
|
||||
DomainType<?> getValueGraphType();
|
||||
SimpleDomainType<?> getKeyGraphType();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hibernate.query.sqm.SqmPathSource;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface PluralPersistentAttribute<D, C, E>
|
||||
extends PersistentAttribute<D, C>, SqmPathSource<E>, SqmJoinable, PluralAttribute<D, C, E> {
|
||||
extends PersistentAttribute<D, C>, SqmPathSource<E>, SqmJoinable<D,E>, PluralAttribute<D, C, E> {
|
||||
@Override
|
||||
ManagedDomainType<D> getDeclaringType();
|
||||
|
||||
|
|
|
@ -12,4 +12,8 @@ package org.hibernate.metamodel.model.domain;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface SimpleDomainType<J> extends DomainType<J>, jakarta.persistence.metamodel.Type<J> {
|
||||
@Override
|
||||
default Class<J> getBindableJavaType() {
|
||||
return getJavaType();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,14 @@ public interface SingularPersistentAttribute<D,J>
|
|||
ManagedDomainType<D> getDeclaringType();
|
||||
|
||||
@Override
|
||||
SimpleDomainType<J> getSqmPathType();
|
||||
DomainType<J> getSqmPathType();
|
||||
|
||||
/**
|
||||
* For a singular attribute, the value type is defined as the
|
||||
* attribute type
|
||||
*/
|
||||
@Override
|
||||
default SimpleDomainType<?> getValueGraphType() {
|
||||
default DomainType<?> getValueGraphType() {
|
||||
return getType();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import jakarta.persistence.metamodel.Attribute;
|
|||
|
||||
import org.hibernate.metamodel.AttributeClassification;
|
||||
import org.hibernate.metamodel.internal.MetadataContext;
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.metamodel.model.domain.ManagedDomainType;
|
||||
import org.hibernate.metamodel.model.domain.PersistentAttribute;
|
||||
import org.hibernate.metamodel.model.domain.SimpleDomainType;
|
||||
|
@ -34,7 +35,7 @@ public abstract class AbstractAttribute<D,J,B> implements PersistentAttribute<D,
|
|||
|
||||
private final AttributeClassification attributeClassification;
|
||||
|
||||
private final SimpleDomainType<B> valueType;
|
||||
private final DomainType<B> valueType;
|
||||
private transient Member member;
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
|
@ -43,7 +44,7 @@ public abstract class AbstractAttribute<D,J,B> implements PersistentAttribute<D,
|
|||
String name,
|
||||
JavaType<J> attributeJtd,
|
||||
AttributeClassification attributeClassification,
|
||||
SimpleDomainType<B> valueType,
|
||||
DomainType<B> valueType,
|
||||
Member member,
|
||||
MetadataContext metadataContext) {
|
||||
this.declaringType = declaringType;
|
||||
|
@ -64,7 +65,7 @@ public abstract class AbstractAttribute<D,J,B> implements PersistentAttribute<D,
|
|||
return attributeJtd.getJavaTypeClass();
|
||||
}
|
||||
|
||||
public SimpleDomainType<B> getSqmPathType() {
|
||||
public DomainType<B> getSqmPathType() {
|
||||
return valueType;
|
||||
}
|
||||
|
||||
|
@ -94,7 +95,7 @@ public abstract class AbstractAttribute<D,J,B> implements PersistentAttribute<D,
|
|||
}
|
||||
|
||||
@Override
|
||||
public SimpleDomainType<?> getValueGraphType() {
|
||||
public DomainType<?> getValueGraphType() {
|
||||
return valueType;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,11 @@ public abstract class AbstractSqmPathSource<J> implements SqmPathSource<J> {
|
|||
this.jpaBindableType = jpaBindableType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<J> getBindableJavaType() {
|
||||
return domainType.getBindableJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPathName() {
|
||||
return localPathName;
|
||||
|
@ -46,9 +51,4 @@ public abstract class AbstractSqmPathSource<J> implements SqmPathSource<J> {
|
|||
public JavaType<J> getExpressableJavaTypeDescriptor() {
|
||||
return domainType.getExpressableJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<J> getBindableJavaType() {
|
||||
return getExpressableJavaTypeDescriptor().getJavaTypeClass();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class AnyMappingDomainTypeImpl<T> implements AnyMappingDomainType<T> {
|
|||
private final AnyType anyType;
|
||||
private final JavaType<T> baseJtd;
|
||||
|
||||
public AnyMappingDomainTypeImpl(AnyType anyType, JavaType baseJtd) {
|
||||
public AnyMappingDomainTypeImpl(AnyType anyType, JavaType<T> baseJtd) {
|
||||
this.anyType = anyType;
|
||||
this.baseJtd = baseJtd;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.metamodel.model.domain.internal;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.metamodel.UnsupportedMappingException;
|
||||
import org.hibernate.metamodel.model.domain.AnyMappingDomainType;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
|
@ -58,15 +58,4 @@ public class AnyMappingSqmPathSource<J> extends AbstractSqmPathSource<J> impleme
|
|||
}
|
||||
return new SqmAnyValuedSimplePath<>( navigablePath, this, lhs, lhs.nodeBuilder() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceType getPersistenceType() {
|
||||
// todo (6.0): no idea what is best here
|
||||
return PersistenceType.EMBEDDABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<J> getJavaType() {
|
||||
return getBindableJavaType();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ import org.hibernate.mapping.IndexedConsumer;
|
|||
import org.hibernate.metamodel.UnsupportedMappingException;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.metamodel.model.domain.TupleType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.sql.ast.Clause;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
|
@ -26,8 +26,10 @@ import org.hibernate.type.descriptor.java.ObjectArrayJavaTypeDescriptor;
|
|||
/**
|
||||
* @author Christian Beikov
|
||||
*/
|
||||
public class ArrayTupleType implements TupleType<Object[]>, AllowableParameterType<Object[]>, AllowableFunctionReturnType<Object[]>,
|
||||
MappingModelExpressable {
|
||||
public class ArrayTupleType implements TupleType<Object[]>,
|
||||
AllowableParameterType<Object[]>,
|
||||
AllowableFunctionReturnType<Object[]>,
|
||||
MappingModelExpressable<Object[]> {
|
||||
|
||||
private final ObjectArrayJavaTypeDescriptor javaTypeDescriptor;
|
||||
private final SqmExpressable<?>[] components;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
package org.hibernate.metamodel.model.domain.internal;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath;
|
||||
|
|
|
@ -61,6 +61,4 @@ public class BasicTypeImpl<J> implements BasicDomainType<J>, Serializable {
|
|||
throws SQLException {
|
||||
throw new NotYetImplementedFor6Exception( getClass() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ package org.hibernate.metamodel.model.domain.internal;
|
|||
|
||||
import org.hibernate.metamodel.mapping.EntityDiscriminatorMapping;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
|
|
|
@ -10,10 +10,10 @@ import java.io.Serializable;
|
|||
|
||||
import org.hibernate.graph.internal.SubGraphImpl;
|
||||
import org.hibernate.graph.spi.SubGraphImplementor;
|
||||
import org.hibernate.metamodel.ManagedTypeRepresentationStrategy;
|
||||
import org.hibernate.metamodel.model.domain.AbstractManagedType;
|
||||
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
|
||||
import org.hibernate.metamodel.model.domain.JpaMetamodel;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@ import org.hibernate.type.descriptor.java.JavaType;
|
|||
*/
|
||||
public class EmbeddableTypeImpl<J>
|
||||
extends AbstractManagedType<J>
|
||||
implements EmbeddableDomainType<J>, Serializable {
|
||||
implements EmbeddableDomainType<J>, AllowableParameterType<J>, Serializable {
|
||||
|
||||
private final boolean isDynamic;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.metamodel.model.domain.internal;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
|
@ -33,16 +33,6 @@ public class EmbeddedSqmPathSource<J>
|
|||
return (EmbeddableDomainType<J>) super.getSqmPathType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceType getPersistenceType() {
|
||||
return PersistenceType.EMBEDDABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<J> getJavaType() {
|
||||
return getBindableJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmPathSource<?> findSubPathSource(String name) {
|
||||
return (SqmPathSource<?>) getSqmPathType().findAttribute( name );
|
||||
|
|
|
@ -15,8 +15,6 @@ import org.hibernate.query.sqm.tree.SqmJoinType;
|
|||
import org.hibernate.query.sqm.tree.domain.SqmEntityValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPluralPartJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmSingularJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmFrom;
|
||||
|
||||
/**
|
||||
|
|
|
@ -145,11 +145,6 @@ public class EntityTypeImpl<J>
|
|||
return BindableType.ENTITY_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<J> getBindableJavaType() {
|
||||
return getJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceType getPersistenceType() {
|
||||
return PersistenceType.ENTITY;
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.hibernate.metamodel.internal.JpaMetaModelPopulationSetting;
|
|||
import org.hibernate.metamodel.internal.JpaStaticMetaModelPopulationSetting;
|
||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
||||
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.metamodel.model.domain.JpaMetamodel;
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.hibernate.metamodel.UnsupportedMappingException;
|
|||
import org.hibernate.metamodel.internal.AttributeFactory;
|
||||
import org.hibernate.metamodel.internal.MetadataContext;
|
||||
import org.hibernate.metamodel.internal.PluralAttributeMetadata;
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.metamodel.model.domain.ManagedDomainType;
|
||||
import org.hibernate.metamodel.model.domain.PersistentAttribute;
|
||||
import org.hibernate.metamodel.model.domain.SimpleDomainType;
|
||||
|
@ -35,8 +36,8 @@ public class PluralAttributeBuilder<D, C, E, K> {
|
|||
private final AttributeClassification attributeClassification;
|
||||
private final CollectionClassification collectionClassification;
|
||||
|
||||
private final SimpleDomainType<E> elementType;
|
||||
private final SimpleDomainType<K> listIndexOrMapKeyType;
|
||||
private final DomainType<E> elementType;
|
||||
private final DomainType<K> listIndexOrMapKeyType;
|
||||
|
||||
private final ManagedDomainType<D> declaringType;
|
||||
|
||||
|
@ -47,8 +48,8 @@ public class PluralAttributeBuilder<D, C, E, K> {
|
|||
JavaType<C> collectionJtd,
|
||||
AttributeClassification attributeClassification,
|
||||
CollectionClassification collectionClassification,
|
||||
SimpleDomainType<E> elementType,
|
||||
SimpleDomainType<K> listIndexOrMapKeyType,
|
||||
DomainType<E> elementType,
|
||||
DomainType<K> listIndexOrMapKeyType,
|
||||
ManagedDomainType<D> declaringType,
|
||||
Property property,
|
||||
Member member) {
|
||||
|
@ -62,6 +63,7 @@ public class PluralAttributeBuilder<D, C, E, K> {
|
|||
this.member = member;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public static <Y, X> PersistentAttribute<X, Y> build(
|
||||
PluralAttributeMetadata<?,Y,?> attributeMetadata,
|
||||
MetadataContext metadataContext) {
|
||||
|
@ -70,7 +72,6 @@ public class PluralAttributeBuilder<D, C, E, K> {
|
|||
.getJavaTypeDescriptorRegistry()
|
||||
.getDescriptor( attributeMetadata.getJavaType() );
|
||||
|
||||
//noinspection unchecked
|
||||
final PluralAttributeBuilder builder = new PluralAttributeBuilder(
|
||||
attributeJtd,
|
||||
attributeMetadata.getAttributeClassification(),
|
||||
|
@ -86,43 +87,34 @@ public class PluralAttributeBuilder<D, C, E, K> {
|
|||
);
|
||||
|
||||
if ( Map.class.equals( attributeJtd.getJavaTypeClass() ) ) {
|
||||
//noinspection unchecked
|
||||
return new MapAttributeImpl<>( builder, metadataContext );
|
||||
return new MapAttributeImpl( builder, metadataContext );
|
||||
}
|
||||
else if ( Set.class.equals( attributeJtd.getJavaTypeClass() ) ) {
|
||||
//noinspection unchecked
|
||||
return new SetAttributeImpl<>( builder, metadataContext );
|
||||
return new SetAttributeImpl( builder, metadataContext );
|
||||
}
|
||||
else if ( List.class.equals( attributeJtd.getJavaTypeClass() ) ) {
|
||||
//noinspection unchecked
|
||||
return new ListAttributeImpl<>( builder, metadataContext );
|
||||
return new ListAttributeImpl( builder, metadataContext );
|
||||
}
|
||||
else if ( Collection.class.equals( attributeJtd.getJavaTypeClass() ) ) {
|
||||
//noinspection unchecked
|
||||
return new BagAttributeImpl<>( builder, metadataContext );
|
||||
return new BagAttributeImpl( builder, metadataContext );
|
||||
}
|
||||
|
||||
//apply loose rules
|
||||
if ( attributeJtd.getJavaTypeClass().isArray() ) {
|
||||
//noinspection unchecked
|
||||
return new ListAttributeImpl<>( builder, metadataContext );
|
||||
return new ListAttributeImpl( builder, metadataContext );
|
||||
}
|
||||
|
||||
if ( Map.class.isAssignableFrom( attributeJtd.getJavaTypeClass() ) ) {
|
||||
//noinspection unchecked
|
||||
return new MapAttributeImpl<>( builder, metadataContext );
|
||||
return new MapAttributeImpl( builder, metadataContext );
|
||||
}
|
||||
else if ( Set.class.isAssignableFrom( attributeJtd.getJavaTypeClass() ) ) {
|
||||
//noinspection unchecked
|
||||
return new SetAttributeImpl<>( builder, metadataContext );
|
||||
return new SetAttributeImpl( builder, metadataContext );
|
||||
}
|
||||
else if ( List.class.isAssignableFrom( attributeJtd.getJavaTypeClass() ) ) {
|
||||
//noinspection unchecked
|
||||
return new ListAttributeImpl<>( builder, metadataContext );
|
||||
return new ListAttributeImpl( builder, metadataContext );
|
||||
}
|
||||
else if ( Collection.class.isAssignableFrom( attributeJtd.getJavaTypeClass() ) ) {
|
||||
//noinspection unchecked
|
||||
return new BagAttributeImpl<>( builder, metadataContext );
|
||||
return new BagAttributeImpl( builder, metadataContext );
|
||||
}
|
||||
|
||||
throw new UnsupportedMappingException( "Unknown collection: " + attributeJtd.getJavaType() );
|
||||
|
@ -132,7 +124,7 @@ public class PluralAttributeBuilder<D, C, E, K> {
|
|||
PluralAttributeMetadata<?,?,?> attributeMetadata,
|
||||
MetadataContext metadataContext) {
|
||||
if ( Map.class.isAssignableFrom( attributeMetadata.getJavaType() ) ) {
|
||||
return determineSimpleType( attributeMetadata.getMapKeyValueContext(), metadataContext );
|
||||
return (SimpleDomainType<?>) determineSimpleType( attributeMetadata.getMapKeyValueContext(), metadataContext );
|
||||
}
|
||||
|
||||
if ( List.class.isAssignableFrom( attributeMetadata.getJavaType() )
|
||||
|
@ -155,7 +147,7 @@ public class PluralAttributeBuilder<D, C, E, K> {
|
|||
return collectionClassification;
|
||||
}
|
||||
|
||||
public SimpleDomainType<K> getListIndexOrMapKeyType() {
|
||||
public DomainType<K> getListIndexOrMapKeyType() {
|
||||
return listIndexOrMapKeyType;
|
||||
}
|
||||
|
||||
|
@ -163,7 +155,7 @@ public class PluralAttributeBuilder<D, C, E, K> {
|
|||
return collectionJtd;
|
||||
}
|
||||
|
||||
public SimpleDomainType<E> getValueType() {
|
||||
public DomainType<E> getValueType() {
|
||||
return elementType;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.hibernate.graph.spi.GraphHelper;
|
|||
import org.hibernate.metamodel.AttributeClassification;
|
||||
import org.hibernate.metamodel.internal.MetadataContext;
|
||||
import org.hibernate.metamodel.model.domain.AnyMappingDomainType;
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.metamodel.model.domain.ManagedDomainType;
|
||||
import org.hibernate.metamodel.model.domain.SimpleDomainType;
|
||||
import org.hibernate.metamodel.model.domain.SingularPersistentAttribute;
|
||||
|
@ -48,7 +49,7 @@ public class SingularAttributeImpl<D,J>
|
|||
ManagedDomainType<D> declaringType,
|
||||
String name,
|
||||
AttributeClassification attributeClassification,
|
||||
SimpleDomainType<J> attributeType,
|
||||
DomainType<J> attributeType,
|
||||
Member member,
|
||||
boolean isIdentifier,
|
||||
boolean isVersion,
|
||||
|
|
|
@ -11,8 +11,8 @@ import java.sql.Types;
|
|||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.model.domain.AllowableOutputParameterType;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableOutputParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.procedure.spi.FunctionReturnImplementor;
|
||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||
import org.hibernate.procedure.spi.ProcedureCallImplementor;
|
||||
|
|
|
@ -14,7 +14,7 @@ import jakarta.persistence.ParameterMode;
|
|||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.procedure.ProcedureCall;
|
||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||
import org.hibernate.procedure.spi.ParameterStrategy;
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.hibernate.graph.spi.RootGraphImplementor;
|
|||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.procedure.NoSuchParameterException;
|
||||
import org.hibernate.procedure.ParameterStrategyException;
|
||||
|
@ -45,6 +44,7 @@ import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
|||
import org.hibernate.procedure.spi.ParameterStrategy;
|
||||
import org.hibernate.procedure.spi.ProcedureCallImplementor;
|
||||
import org.hibernate.procedure.spi.ProcedureParameterImplementor;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.Query;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
import org.hibernate.query.internal.QueryOptionsImpl;
|
||||
|
@ -60,6 +60,7 @@ import org.hibernate.query.spi.QueryOptionsAdapter;
|
|||
import org.hibernate.query.spi.QueryParameterBinding;
|
||||
import org.hibernate.query.spi.QueryParameterBindings;
|
||||
import org.hibernate.query.spi.ScrollableResultsImplementor;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.result.NoMoreReturnsException;
|
||||
import org.hibernate.result.Output;
|
||||
import org.hibernate.result.ResultSetOutput;
|
||||
|
@ -146,7 +147,7 @@ public class ProcedureCallImpl<R>
|
|||
* @param procedureName The name of the procedure to call
|
||||
* @param resultClasses The classes making up the result
|
||||
*/
|
||||
public ProcedureCallImpl(SharedSessionContractImplementor session, String procedureName, Class... resultClasses) {
|
||||
public ProcedureCallImpl(SharedSessionContractImplementor session, String procedureName, Class<?>... resultClasses) {
|
||||
super( session );
|
||||
|
||||
assert resultClasses != null && resultClasses.length > 0;
|
||||
|
@ -455,16 +456,29 @@ public class ProcedureCallImpl<R>
|
|||
|
||||
@Override
|
||||
public <T> ProcedureParameter<T> registerParameter(int position, Class<T> javaType, ParameterMode mode) {
|
||||
final AllowableParameterType<T> parameterType = getSessionFactory().getDomainModel().resolveQueryParameterType(
|
||||
javaType
|
||||
);
|
||||
final AllowableParameterType<T> parameterType = getSessionFactory()
|
||||
.getDomainModel()
|
||||
.resolveQueryParameterType( javaType );
|
||||
|
||||
final Class<T> expressableJavaType;
|
||||
if ( parameterType == null ) {
|
||||
expressableJavaType = null;
|
||||
}
|
||||
else {
|
||||
final SqmExpressable<T> sqmExpressable = parameterType.resolveExpressable( getSessionFactory() );
|
||||
assert sqmExpressable != null;
|
||||
|
||||
expressableJavaType = sqmExpressable.getExpressableJavaTypeDescriptor().getJavaTypeClass();
|
||||
}
|
||||
|
||||
final ProcedureParameterImpl<T> procedureParameter = new ProcedureParameterImpl<>(
|
||||
position,
|
||||
mode,
|
||||
parameterType == null ? javaType : parameterType.getJavaType(),
|
||||
expressableJavaType,
|
||||
parameterType
|
||||
);
|
||||
registerParameter( procedureParameter );
|
||||
|
||||
return procedureParameter;
|
||||
}
|
||||
|
||||
|
@ -486,25 +500,24 @@ public class ProcedureCallImpl<R>
|
|||
return procedureParameter;
|
||||
}
|
||||
|
||||
private void registerParameter(ProcedureParameterImplementor parameter) {
|
||||
private void registerParameter(ProcedureParameterImplementor<?> parameter) {
|
||||
getParameterMetadata().registerParameter( parameter );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureParameterImplementor getParameterRegistration(int position) {
|
||||
public ProcedureParameterImplementor<?> getParameterRegistration(int position) {
|
||||
return getParameterMetadata().getQueryParameter( position );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> ProcedureParameterImplementor<T> registerParameter(String name, Class<T> javaType, ParameterMode mode) {
|
||||
final AllowableParameterType<T> parameterType = getSessionFactory().getDomainModel().resolveQueryParameterType(
|
||||
javaType
|
||||
);
|
||||
final ProcedureParameterImpl parameter = new ProcedureParameterImpl(
|
||||
final ProcedureParameterImpl<T> parameter = new ProcedureParameterImpl<>(
|
||||
name,
|
||||
mode,
|
||||
parameterType.getJavaType(),
|
||||
parameterType.getBindableJavaType(),
|
||||
parameterType
|
||||
);
|
||||
|
||||
|
@ -514,7 +527,6 @@ public class ProcedureCallImpl<R>
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> ProcedureParameterImplementor<T> registerParameter(
|
||||
String name,
|
||||
BasicTypeReference<T> typeReference,
|
||||
|
@ -522,7 +534,7 @@ public class ProcedureCallImpl<R>
|
|||
final BasicType<T> basicType = getSessionFactory().getTypeConfiguration()
|
||||
.getBasicTypeRegistry()
|
||||
.resolve( typeReference );
|
||||
final ProcedureParameterImpl parameter = new ProcedureParameterImpl(
|
||||
final ProcedureParameterImpl<T> parameter = new ProcedureParameterImpl<>(
|
||||
name,
|
||||
mode,
|
||||
basicType.getJavaType(),
|
||||
|
@ -535,12 +547,12 @@ public class ProcedureCallImpl<R>
|
|||
}
|
||||
|
||||
@Override
|
||||
public ProcedureParameterImplementor getParameterRegistration(String name) {
|
||||
public ProcedureParameterImplementor<?> getParameterRegistration(String name) {
|
||||
return getParameterMetadata().getQueryParameter( name );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public List getRegisteredParameters() {
|
||||
return getParameterMetadata().getRegistrationsAsList() ;
|
||||
}
|
||||
|
@ -784,7 +796,7 @@ public class ProcedureCallImpl<R>
|
|||
|
||||
parameterMetadata.visitRegistrations(
|
||||
queryParameter -> {
|
||||
final ProcedureParameterImplementor procedureParameter = (ProcedureParameterImplementor) queryParameter;
|
||||
final ProcedureParameterImplementor<?> procedureParameter = (ProcedureParameterImplementor<?>) queryParameter;
|
||||
mementos.add(
|
||||
new NamedCallableQueryMementoImpl.ParameterMementoImpl(
|
||||
procedureParameter.getPosition(),
|
||||
|
@ -1114,50 +1126,6 @@ public class ProcedureCallImpl<R>
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> ProcedureCallImplementor<R> setParameter(String name, P value, BasicTypeReference<P> type) {
|
||||
super.setParameter( name, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> ProcedureCallImplementor<R> setParameter(int position, P value, BasicTypeReference<P> type) {
|
||||
super.setParameter( position, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> ProcedureCallImplementor<R> setParameter(QueryParameter<P> parameter, P val, BasicTypeReference<P> type) {
|
||||
super.setParameter( parameter, val, type );
|
||||
return this;
|
||||
}
|
||||
// @Override
|
||||
// public ProcedureCallImplementor<R> setParameter(int position, Object value, Type type) {
|
||||
// super.setParameter( position, value, type );
|
||||
// return this;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public <P> ProcedureCallImplementor<R> setParameter(
|
||||
QueryParameter<P> parameter,
|
||||
P value,
|
||||
TemporalType temporalPrecision) {
|
||||
super.setParameter( parameter, value, temporalPrecision );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(String name, Object value, TemporalType temporalPrecision) {
|
||||
super.setParameter( name, value, temporalPrecision );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(int position, Object value, TemporalType temporalPrecision) {
|
||||
super.setParameter( position, value, temporalPrecision );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcedureCallImplementor<R> setParameter(
|
||||
Parameter<Calendar> parameter,
|
||||
|
@ -1198,8 +1166,7 @@ public class ProcedureCallImpl<R>
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Stream getResultStream() {
|
||||
public Stream<R> getResultStream() {
|
||||
return getResultList().stream();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@ import java.util.function.BiConsumer;
|
|||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.cache.spi.QueryKey;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.procedure.spi.ProcedureParameterBindingImplementor;
|
||||
import org.hibernate.procedure.spi.ProcedureParameterImplementor;
|
||||
import org.hibernate.query.procedure.ProcedureParameterBinding;
|
||||
import org.hibernate.query.spi.QueryParameterBinding;
|
||||
import org.hibernate.query.spi.QueryParameterBindingTypeResolver;
|
||||
import org.hibernate.query.spi.QueryParameterBindings;
|
||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||
|
||||
|
@ -26,15 +26,15 @@ import org.hibernate.query.spi.QueryParameterImplementor;
|
|||
*/
|
||||
public class ProcedureParamBindings implements QueryParameterBindings {
|
||||
private final ProcedureParameterMetadataImpl parameterMetadata;
|
||||
private final QueryParameterBindingTypeResolver typeResolver;
|
||||
private final SessionFactoryImplementor sessionFactory;
|
||||
|
||||
private final Map<ProcedureParameterImplementor<?>, ProcedureParameterBindingImplementor<?>> bindingMap = new HashMap<>();
|
||||
|
||||
public ProcedureParamBindings(
|
||||
ProcedureParameterMetadataImpl parameterMetadata,
|
||||
QueryParameterBindingTypeResolver typeResolver) {
|
||||
SessionFactoryImplementor sessionFactory) {
|
||||
this.parameterMetadata = parameterMetadata;
|
||||
this.typeResolver = typeResolver;
|
||||
this.sessionFactory = sessionFactory;
|
||||
}
|
||||
|
||||
public ProcedureParameterMetadataImpl getParameterMetadata() {
|
||||
|
@ -61,7 +61,7 @@ public class ProcedureParamBindings implements QueryParameterBindings {
|
|||
throw new IllegalArgumentException( "Passed parameter is not registered with this query" );
|
||||
}
|
||||
|
||||
binding = new ProcedureParameterBindingImpl<>( procParam, typeResolver );
|
||||
binding = new ProcedureParameterBindingImpl<>( procParam, sessionFactory );
|
||||
bindingMap.put( procParam, binding );
|
||||
}
|
||||
|
||||
|
|
|
@ -6,12 +6,11 @@
|
|||
*/
|
||||
package org.hibernate.procedure.internal;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.internal.QueryParameterBindingImpl;
|
||||
import org.hibernate.query.procedure.ProcedureParameterBinding;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.procedure.spi.ProcedureParameterBindingImplementor;
|
||||
import org.hibernate.procedure.spi.ProcedureParameterImplementor;
|
||||
import org.hibernate.query.spi.QueryParameterBindingTypeResolver;
|
||||
import org.hibernate.query.internal.QueryParameterBindingImpl;
|
||||
import org.hibernate.query.procedure.ProcedureParameterBinding;
|
||||
|
||||
/**
|
||||
* Implementation of the {@link ProcedureParameterBinding} contract.
|
||||
|
@ -23,14 +22,7 @@ public class ProcedureParameterBindingImpl<T>
|
|||
implements ProcedureParameterBindingImplementor<T> {
|
||||
public ProcedureParameterBindingImpl(
|
||||
ProcedureParameterImplementor<T> queryParameter,
|
||||
QueryParameterBindingTypeResolver typeResolver) {
|
||||
super( queryParameter, typeResolver, true );
|
||||
}
|
||||
|
||||
public ProcedureParameterBindingImpl(
|
||||
AllowableParameterType<T> bindType,
|
||||
ProcedureParameterImplementor<T> queryParameter,
|
||||
QueryParameterBindingTypeResolver typeResolver) {
|
||||
super( queryParameter, typeResolver, bindType, true );
|
||||
SessionFactoryImplementor sessionFactory) {
|
||||
super( queryParameter, sessionFactory, true );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,12 +15,12 @@ import org.hibernate.NotYetImplementedFor6Exception;
|
|||
import org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData;
|
||||
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||
import org.hibernate.procedure.spi.ParameterStrategy;
|
||||
import org.hibernate.procedure.spi.ProcedureCallImplementor;
|
||||
import org.hibernate.procedure.spi.ProcedureParameterImplementor;
|
||||
import org.hibernate.query.AbstractQueryParameter;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.internal.BindingTypeHelper;
|
||||
import org.hibernate.query.spi.QueryParameterBinding;
|
||||
import org.hibernate.sql.exec.internal.JdbcCallParameterExtractorImpl;
|
||||
|
@ -30,10 +30,8 @@ import org.hibernate.sql.exec.internal.JdbcParameterImpl;
|
|||
import org.hibernate.sql.exec.spi.ExecutionContext;
|
||||
import org.hibernate.sql.exec.spi.JdbcCallParameterRegistration;
|
||||
import org.hibernate.sql.exec.spi.JdbcParameterBinder;
|
||||
import org.hibernate.sql.exec.spi.JdbcParameterBindings;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.ProcedureParameterNamedBinder;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import jakarta.persistence.ParameterMode;
|
||||
|
||||
|
@ -118,13 +116,12 @@ public class ProcedureParameterImpl<T> extends AbstractQueryParameter<T> impleme
|
|||
int startIndex,
|
||||
ProcedureCallImplementor<?> procedureCall) {
|
||||
final QueryParameterBinding<T> binding = procedureCall.getParameterBindings().getBinding( this );
|
||||
final TypeConfiguration typeConfiguration = procedureCall.getSession().getFactory().getTypeConfiguration();
|
||||
final AllowableParameterType<T> typeToUse = BindingTypeHelper.INSTANCE.resolveTemporalPrecision(
|
||||
binding == null || binding.getExplicitTemporalPrecision() == null
|
||||
? null
|
||||
: binding.getExplicitTemporalPrecision(),
|
||||
getHibernateType(),
|
||||
typeConfiguration
|
||||
procedureCall.getSession().getFactory()
|
||||
);
|
||||
|
||||
final String name;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.query;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||
|
||||
/**
|
||||
|
@ -57,6 +56,6 @@ public abstract class AbstractQueryParameter<T> implements QueryParameterImpleme
|
|||
|
||||
@Override
|
||||
public Class<T> getParameterType() {
|
||||
return anticipatedType.getJavaType();
|
||||
return anticipatedType.getBindableJavaType();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
|
||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
*/
|
||||
package org.hibernate.metamodel.model.domain;
|
||||
package org.hibernate.query;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.SimpleDomainType;
|
||||
|
||||
/**
|
||||
* Specialization of DomainType for types that can be used as function returns
|
|
@ -4,12 +4,13 @@
|
|||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
|
||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
*/
|
||||
package org.hibernate.metamodel.model.domain;
|
||||
package org.hibernate.query;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
|
||||
/**
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
|
||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
*/
|
||||
package org.hibernate.query;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.metamodel.ManagedType;
|
||||
|
||||
/**
|
||||
* Types that can be used to handle binding {@link org.hibernate.query.Query} parameters
|
||||
*
|
||||
* @see org.hibernate.type.BasicTypeReference
|
||||
* @see org.hibernate.type.StandardBasicTypes
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Incubating
|
||||
public interface AllowableParameterType<J> {
|
||||
/**
|
||||
* The expected Java type
|
||||
*/
|
||||
Class<J> getBindableJavaType();
|
||||
|
||||
static <T> AllowableParameterType<? extends T> parameterType(Class<T> type) {
|
||||
throw new NotYetImplementedFor6Exception( "AllowableParameterType#parameterType" );
|
||||
}
|
||||
|
||||
static <T> AllowableParameterType<? extends T> parameterType(Class<?> javaType, AttributeConverter<T,?> converter) {
|
||||
throw new NotYetImplementedFor6Exception( "AllowableParameterType#parameterType" );
|
||||
}
|
||||
|
||||
static <T> AllowableParameterType<? extends T> parameterType(Class<?> javaType, Class<? extends AttributeConverter<T,?>> converter) {
|
||||
throw new NotYetImplementedFor6Exception( "AllowableParameterType#parameterType" );
|
||||
}
|
||||
|
||||
static <T> AllowableParameterType<? extends T> parameterType(ManagedType<T> managedType) {
|
||||
throw new NotYetImplementedFor6Exception( "AllowableParameterType#parameterType" );
|
||||
}
|
||||
|
||||
static <T> AllowableParameterType<? extends T> parameterType(jakarta.persistence.metamodel.Bindable<T> jpaBindable) {
|
||||
throw new NotYetImplementedFor6Exception( "AllowableParameterType#parameterType" );
|
||||
}
|
||||
|
||||
static <T> AllowableParameterType<? extends T> parameterType(org.hibernate.metamodel.mapping.Bindable bindable) {
|
||||
throw new NotYetImplementedFor6Exception( "AllowableParameterType#parameterType" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve this parameter type to the corresponding SqmExpressable
|
||||
*
|
||||
* @todo (6.0) - use SessionFactory (API) here instead - we'll just cast "below"
|
||||
*/
|
||||
SqmExpressable<J> resolveExpressable(SessionFactoryImplementor sessionFactory);
|
||||
}
|
|
@ -28,7 +28,6 @@ import org.hibernate.LockOptions;
|
|||
import org.hibernate.MappingException;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.transform.ResultTransformer;
|
||||
import org.hibernate.type.BasicTypeReference;
|
||||
|
@ -570,161 +569,114 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
|
|||
@Override @SuppressWarnings("deprecation")
|
||||
NativeQuery<T> setResultTransformer(ResultTransformer transformer);
|
||||
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Object value);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Object value);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, LocalDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, ZonedDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, OffsetDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, LocalDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, ZonedDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, OffsetDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(Parameter<P> param, P value);
|
||||
|
||||
|
||||
// @Override
|
||||
// NativeQuery<T> setParameter(String name, Object val, Type type);
|
||||
//
|
||||
// @Override
|
||||
// NativeQuery<T> setParameter(int position, Object val, Type type);
|
||||
//
|
||||
// @Override
|
||||
// <P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, Type type);
|
||||
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Object val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Object val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(
|
||||
Parameter<Calendar> param,
|
||||
Calendar value,
|
||||
TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<P> values);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values);
|
||||
|
||||
// @Override
|
||||
// default NativeQuery<T> setParameterList(String name, Collection values, Type type) {
|
||||
// return setParameterList( name, values, (AllowableParameterType) type );
|
||||
// }
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(String name, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
// @Override
|
||||
// NativeQuery<T> setParameterList(String name, Object[] values, Type type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(String name, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(String name, Object[] values);
|
||||
<P> NativeQuery<T> setParameter(String name, P val, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(String name, P val, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Object value);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(int position, P val, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(int position, P val, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(String name, P val, BasicTypeReference<P> type);
|
||||
<P> NativeQuery<T> setParameter(Parameter<P> param, P value);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(int position, P val, BasicTypeReference<P> type);
|
||||
NativeQuery<T> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, BasicTypeReference<P> type);
|
||||
NativeQuery<T> setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values);
|
||||
NativeQuery<T> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(String name, Collection<? extends P> values, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(String name, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(String name, Object[] values);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(String name, P[] values, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(String name, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(int position, Collection<? extends P> values, Class<P> type);
|
||||
|
||||
// @Override
|
||||
// NativeQuery<T> setParameterList(int position, Collection values, Type type);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
// @Override
|
||||
// NativeQuery<T> setParameterList(int position, Object[] values, Type type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(int position, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
|
||||
<P> NativeQuery<T> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> javaType);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setParameterList(int position, Object[] values);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(int position, P[] values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(int position, P[] values, AllowableParameterType<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, P[] values);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
NativeQuery<T> setProperties(Object bean);
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.function.Consumer;
|
|||
import jakarta.persistence.Parameter;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
package org.hibernate.query;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
@ -17,11 +14,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
import jakarta.persistence.FlushModeType;
|
||||
import jakarta.persistence.LockModeType;
|
||||
import jakarta.persistence.Parameter;
|
||||
import jakarta.persistence.TemporalType;
|
||||
import jakarta.persistence.TypedQuery;
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.FlushMode;
|
||||
|
@ -35,10 +27,14 @@ import org.hibernate.SharedSessionContract;
|
|||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.graph.GraphSemantic;
|
||||
import org.hibernate.graph.RootGraph;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.spi.QueryOptions;
|
||||
import org.hibernate.transform.ResultTransformer;
|
||||
import org.hibernate.type.BasicTypeReference;
|
||||
|
||||
import jakarta.persistence.FlushModeType;
|
||||
import jakarta.persistence.LockModeType;
|
||||
import jakarta.persistence.Parameter;
|
||||
import jakarta.persistence.TemporalType;
|
||||
import jakarta.persistence.TypedQuery;
|
||||
|
||||
/**
|
||||
* Represents an HQL/JPQL query or a compiled Criteria query. Also acts as the Hibernate
|
||||
|
@ -334,57 +330,116 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
|||
*/
|
||||
ParameterMetadata getParameterMetadata();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Bind the given argument to a named query parameter, inferring the
|
||||
* {@link AllowableParameterType}.
|
||||
* Bind the given argument to a named query parameter
|
||||
* <p>
|
||||
* If the type of the parameter cannot be inferred from the context in which
|
||||
* it occurs, {@link #setParameter(String, Object, AllowableParameterType)}
|
||||
* must be used instead.
|
||||
* it occurs, use one of the forms accept a "type".
|
||||
*
|
||||
* @param name the parameter name
|
||||
* @param value the argument, which might be null
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
* @see #setParameter(String, Object, Class)
|
||||
* @see #setParameter(String, Object, AllowableParameterType)
|
||||
*/
|
||||
@Override
|
||||
Query<R> setParameter(String name, Object value);
|
||||
|
||||
/**
|
||||
* Bind the given argument to a positional query parameter, inferring the
|
||||
* Bind the given argument to a named query parameter using the given
|
||||
* Class reference to attempt to determine the {@link AllowableParameterType}
|
||||
* to use. If unable to determine an appropriate {@link AllowableParameterType},
|
||||
* {@link #setParameter(String, Object)} is used
|
||||
*
|
||||
* @see AllowableParameterType#parameterType(Class)
|
||||
* @see #setParameter(String, Object, AllowableParameterType)
|
||||
*/
|
||||
<P> Query<R> setParameter(String name, P value, Class<P> type);
|
||||
|
||||
/**
|
||||
* Bind the given argument to a named query parameter using the given
|
||||
* {@link AllowableParameterType}.
|
||||
*
|
||||
* @see AllowableParameterType#parameterType
|
||||
*/
|
||||
<P> Query<R> setParameter(String name, P value, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind an {@link Instant} value to the named query parameter using just the portion
|
||||
* indicated by the given {@link TemporalType}.
|
||||
*/
|
||||
Query<R> setParameter(String name, Instant value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* {@link jakarta.persistence.Query} override
|
||||
*/
|
||||
@Override
|
||||
Query<R> setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* {@link jakarta.persistence.Query} override
|
||||
*/
|
||||
@Override
|
||||
Query<R> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Bind the given argument to a positional query parameter.
|
||||
* <p>
|
||||
* If the type of the parameter cannot be inferred from the context in which
|
||||
* it occurs, {@link #setParameter(int, Object, AllowableParameterType)}
|
||||
* must be used instead.
|
||||
* it occurs, use one of the forms accept a "type".
|
||||
*
|
||||
* @param position the positional parameter label
|
||||
* @param value the argument, which might be null
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
* @see #setParameter(int, Object, Class)
|
||||
* @see #setParameter(int, Object, AllowableParameterType)
|
||||
*/
|
||||
@Override
|
||||
Query<R> setParameter(int position, Object value);
|
||||
|
||||
/**
|
||||
* Bind the given argument to the query parameter represented by the given
|
||||
* {@link Parameter} object.
|
||||
* Bind the given argument to a positional query parameter using the given
|
||||
* Class reference to attempt to determine the {@link AllowableParameterType}
|
||||
* to use. If unable to determine an appropriate {@link AllowableParameterType},
|
||||
* {@link #setParameter(int, Object)} is used
|
||||
*
|
||||
* @param param the {@link Parameter}.
|
||||
* @param value the argument, which might be null
|
||||
* @see AllowableParameterType#parameterType(Class)
|
||||
* @see #setParameter(int, Object, AllowableParameterType)
|
||||
*/
|
||||
<P> Query<R> setParameter(int position, P value, Class<P> type);
|
||||
|
||||
/**
|
||||
* Bind the given argument to a positional query parameter using the given
|
||||
* {@link AllowableParameterType}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
* @see AllowableParameterType#parameterType
|
||||
*/
|
||||
<P> Query<R> setParameter(int position, P value, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind an {@link Instant} value to the positional query parameter using just the portion
|
||||
* indicated by the given {@link TemporalType}.
|
||||
*/
|
||||
Query<R> setParameter(int position, Instant value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* {@link jakarta.persistence.Query} override
|
||||
*/
|
||||
@Override
|
||||
<T> Query<R> setParameter(Parameter<T> param, T value);
|
||||
Query<R> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* {@link jakarta.persistence.Query} override
|
||||
*/
|
||||
@Override
|
||||
Query<R> setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* Bind an argument to the query parameter represented by the given
|
||||
* {@link QueryParameter}, inferring the {@link AllowableParameterType}.
|
||||
* {@link QueryParameter}.
|
||||
* <p>
|
||||
* If the type of the parameter cannot be inferred from the context in which
|
||||
* it occurs, {@link #setParameter(QueryParameter, Object, AllowableParameterType)}
|
||||
* must be used instead.
|
||||
* it occurs, use on of the forms accept a "type".
|
||||
*
|
||||
* @see #setParameter(QueryParameter, Object, AllowableParameterType)
|
||||
*
|
||||
* @param parameter the query parameter memento
|
||||
* @param value the argument, which might be null
|
||||
|
@ -394,140 +449,205 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
|||
<T> Query<R> setParameter(QueryParameter<T> parameter, T value);
|
||||
|
||||
/**
|
||||
* Bind the given argument to a named query parameter using the given
|
||||
* {@link AllowableParameterType}.
|
||||
* Bind an argument to the query parameter represented by the given
|
||||
* {@link QueryParameter} using the given Class reference to attempt to
|
||||
* determine the {@link AllowableParameterType} to use. If unable to determine
|
||||
* an appropriate {@link AllowableParameterType}, {@link #setParameter(QueryParameter, Object)} is used
|
||||
*
|
||||
* @param name the name of the parameter
|
||||
* @param parameter the query parameter memento
|
||||
* @param value the argument, which might be null
|
||||
* @param type an {@link AllowableParameterType} representing the type of the parameter
|
||||
* @param type a {@link AllowableParameterType} representing the type of the parameter
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*
|
||||
* @see AllowableParameterType#parameterType(Class)
|
||||
* @see #setParameter(QueryParameter, Object, AllowableParameterType)
|
||||
*/
|
||||
<P> Query<R> setParameter(String name, P value, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind the given argument to a positional query parameter using the given
|
||||
* {@link AllowableParameterType}.
|
||||
*
|
||||
* @param position the positional parameter label
|
||||
* @param value the argument, which might be null
|
||||
* @param type an {@link AllowableParameterType} representing the type of the parameter
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameter(int position, P value, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind the given argument to a named query parameter using the given
|
||||
* {@link BasicTypeReference}.
|
||||
*
|
||||
* @param name the name of the parameter
|
||||
* @param value the argument, which might be null
|
||||
* @param type a {@link BasicTypeReference} representing the type of the parameter
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameter(String name, P value, BasicTypeReference<P> type);
|
||||
|
||||
/**
|
||||
* Bind the given argument to a positional query parameter using the given
|
||||
* {@link BasicTypeReference}.
|
||||
*
|
||||
* @param position the positional parameter label
|
||||
* @param value the argument, which might be null
|
||||
* @param type a {@link BasicTypeReference} representing the type of the parameter
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameter(int position, P value, BasicTypeReference<P> type);
|
||||
<P> Query<R> setParameter(QueryParameter<P> parameter, P value, Class<P> type);
|
||||
|
||||
/**
|
||||
* Bind an argument to the query parameter represented by the given
|
||||
* {@link QueryParameter} using the given {@link AllowableParameterType}.
|
||||
*
|
||||
* @param parameter the query parameter memento
|
||||
* @param value the argument, which might be null
|
||||
* @param val the argument, which might be null
|
||||
* @param type an {@link AllowableParameterType} representing the type of the parameter
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameter(QueryParameter<P> parameter, P value, AllowableParameterType<P> type);
|
||||
<P> Query<R> setParameter(QueryParameter<P> parameter, P val, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind an argument to the query parameter represented by the given
|
||||
* {@link QueryParameter} using the given {@link BasicTypeReference}.
|
||||
*
|
||||
* @param parameter the query parameter memento
|
||||
* @param val the argument, which might be null
|
||||
* @param type an {@link BasicTypeReference} representing the type of the parameter
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
* {@link jakarta.persistence.Query} override
|
||||
*/
|
||||
<P> Query<R> setParameter(QueryParameter<P> parameter, P val, BasicTypeReference<P> type);
|
||||
@Override
|
||||
<T> Query<R> setParameter(Parameter<T> param, T value);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a named query parameter, inferring the
|
||||
* {@link AllowableParameterType}. This is used for binding a list of
|
||||
* values to an expression such as {@code entity.field in (:values)}.
|
||||
* <p>
|
||||
* The type of the parameter is inferred from the context in which it
|
||||
* occurs, and from the type of the first given argument.
|
||||
* {@link jakarta.persistence.Query} override
|
||||
*/
|
||||
@Override
|
||||
Query<R> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* {@link jakarta.persistence.Query} override
|
||||
*/
|
||||
@Override
|
||||
Query<R> setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a named query parameter.
|
||||
* <p/>
|
||||
* The "type mapping" for the binding is inferred from the type of
|
||||
* the first collection element
|
||||
*
|
||||
* @param name the name of the parameter
|
||||
* @param values a collection of arguments
|
||||
* @see #setParameterList(java.lang.String, java.util.Collection, org.hibernate.query.AllowableParameterType)
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
Query<R> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter, inferring
|
||||
* the {@link AllowableParameterType}. This is used for binding a list
|
||||
* of values to an expression such as {@code entity.field in (?1)}.
|
||||
* <p>
|
||||
* The type of the parameter is inferred from the context in which it
|
||||
* occurs, and from the type of the first given argument.
|
||||
* Bind multiple arguments to a named query parameter using the given
|
||||
* Class reference to attempt to determine the {@link AllowableParameterType}
|
||||
* to use. If unable to determine an appropriate {@link AllowableParameterType},
|
||||
* {@link #setParameterList(String, Collection)} is used
|
||||
*
|
||||
* @param position the parameter positional label
|
||||
* @param values a collection of arguments
|
||||
* @see AllowableParameterType#parameterType(Class)
|
||||
* @see #setParameterList(java.lang.String, java.util.Collection, org.hibernate.query.AllowableParameterType)
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
Query<R> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values);
|
||||
<P> Query<R> setParameterList(String name, Collection<? extends P> values, Class<P> javaType);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a named query parameter, inferring the
|
||||
* {@link AllowableParameterType}. This is used for binding a list of
|
||||
* values to an expression such as {@code entity.field in (:values)}.
|
||||
* <p>
|
||||
* The type of the parameter is inferred from the context in which it
|
||||
* occurs, and from the type of the first given argument.
|
||||
* Bind multiple arguments to a named query parameter using the passed type-mapping.
|
||||
*
|
||||
* @param name the name of the parameter
|
||||
* @param values an array of arguments
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(String name, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a named query parameter.
|
||||
* <p/>
|
||||
* The "type mapping" for the binding is inferred from the type of
|
||||
* the first collection element
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
Query<R> setParameterList(String name, Object[] values);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter, inferring
|
||||
* the {@link AllowableParameterType}. This is used for binding a list
|
||||
* of values to an expression such as {@code entity.field in (?1)}.
|
||||
* <p>
|
||||
* The type of the parameter is inferred from the context in which it
|
||||
* occurs, and from the type of the first given argument.
|
||||
* Bind multiple arguments to a named query parameter using the given
|
||||
* Class reference to attempt to determine the {@link AllowableParameterType}
|
||||
* to use. If unable to determine an appropriate {@link AllowableParameterType},
|
||||
* {@link #setParameterList(String, Collection)} is used
|
||||
*
|
||||
* @param position the positional parameter label
|
||||
* @param values an array of arguments
|
||||
* @see AllowableParameterType#parameterType(Class)
|
||||
* @see #setParameterList(java.lang.String, Object[], org.hibernate.query.AllowableParameterType)
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(String name, P[] values, Class<P> javaType);
|
||||
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a named query parameter using the passed type-mapping.
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(String name, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter.
|
||||
* <p/>
|
||||
* The "type mapping" for the binding is inferred from the type of
|
||||
* the first collection element
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
Query<R> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter using the given
|
||||
* Class reference to attempt to determine the {@link AllowableParameterType}
|
||||
* to use. If unable to determine an appropriate {@link AllowableParameterType},
|
||||
* {@link #setParameterList(String, Collection)} is used
|
||||
*
|
||||
* @see AllowableParameterType#parameterType(Class)
|
||||
* @see #setParameterList(int, Collection, org.hibernate.query.AllowableParameterType)
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(int position, Collection<? extends P> values, Class<P> javaType);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter using the passed type-mapping.
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter.
|
||||
* <p/>
|
||||
* The "type mapping" for the binding is inferred from the type of
|
||||
* the first collection element
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
Query<R> setParameterList(int position, Object[] values);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter using the given
|
||||
* Class reference to attempt to determine the {@link AllowableParameterType}
|
||||
* to use. If unable to determine an appropriate {@link AllowableParameterType},
|
||||
* {@link #setParameterList(String, Collection)} is used
|
||||
*
|
||||
* @see AllowableParameterType#parameterType(Class)
|
||||
* @see #setParameterList(int, Object[], org.hibernate.query.AllowableParameterType)
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(int position, P[] values, Class<P> javaType);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter using the passed type-mapping.
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(int position, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to the query parameter represented by the
|
||||
* given {@link QueryParameter}, inferring the {@link AllowableParameterType}.
|
||||
* given {@link QueryParameter}.
|
||||
* <p>
|
||||
* The type of the parameter is inferred from the context in which it
|
||||
* occurs, and from the type of the first given argument.
|
||||
|
@ -537,92 +657,84 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(QueryParameter<P> parameter, Collection<P> values);
|
||||
<P> Query<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a named query parameter, inferring the
|
||||
* {@link AllowableParameterType}. This is used for binding a list of
|
||||
* values to an expression such as {@code entity.field in (:values)}.
|
||||
* Bind multiple arguments to the query parameter represented by the
|
||||
* given {@link QueryParameter} using the given Class reference to attempt
|
||||
* to determine the {@link AllowableParameterType} to use. If unable to
|
||||
* determine an appropriate {@link AllowableParameterType},
|
||||
* {@link #setParameterList(String, Collection)} is used
|
||||
*
|
||||
* @see AllowableParameterType#parameterType(Class)
|
||||
* @see #setParameterList(QueryParameter, java.util.Collection, org.hibernate.query.AllowableParameterType)
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to the query parameter represented by the
|
||||
* given {@link QueryParameter}, inferring the {@link AllowableParameterType}.
|
||||
*
|
||||
* Bind multiple arguments to a named query parameter.
|
||||
* <p/>
|
||||
* The "type mapping" for the binding is inferred from the type of
|
||||
* the first collection element
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to the query parameter represented by the
|
||||
* given {@link QueryParameter}
|
||||
* <p>
|
||||
* The type of the parameter is inferred from the context in which it
|
||||
* occurs, and from the type represented by the given class object.
|
||||
* The type of the parameter is inferred between the context in which it
|
||||
* occurs, the type associated with the QueryParameter and the type of
|
||||
* the first given argument.
|
||||
*
|
||||
* @param name the name of the parameter
|
||||
* @param parameter the parameter memento
|
||||
* @param values a collection of arguments
|
||||
* @param type the Java class of the arguments
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(String name, Collection<? extends P> values, Class<P> type);
|
||||
<P> Query<R> setParameterList(QueryParameter<P> parameter, P[] values);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter, inferring
|
||||
* the {@link AllowableParameterType}. This is used for binding a list
|
||||
* of values to an expression such as {@code entity.field in (?1)}.
|
||||
* <p>
|
||||
* The type of the parameter is inferred from the context in which it
|
||||
* occurs, and from the type represented by the given class object.
|
||||
* Bind multiple arguments to the query parameter represented by the
|
||||
* given {@link QueryParameter} using the given Class reference to attempt
|
||||
* to determine the {@link AllowableParameterType} to use. If unable to
|
||||
* determine an appropriate {@link AllowableParameterType},
|
||||
* {@link #setParameterList(String, Collection)} is used
|
||||
*
|
||||
* @param position the positional parameter label
|
||||
* @param values a collection of arguments
|
||||
* @param type the Java class of the arguments
|
||||
* @see AllowableParameterType#parameterType(Class)
|
||||
* @see #setParameterList(QueryParameter, Object[], org.hibernate.query.AllowableParameterType)
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(int position, Collection<? extends P> values, Class<P> type);
|
||||
<P> Query<R> setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a named query parameter, using the given
|
||||
* {@link AllowableParameterType}. This is used for binding a list of
|
||||
* values to an expression such as {@code entity.field in (?1)}.
|
||||
* Bind multiple arguments to the query parameter represented by the
|
||||
* given {@link QueryParameter}, inferring the {@link AllowableParameterType}.
|
||||
*
|
||||
* @param name the name of the parameter
|
||||
* @param values a collection of arguments
|
||||
* @param type an {@link AllowableParameterType} representing the type of the parameter
|
||||
* Bind multiple arguments to a named query parameter.
|
||||
* <p/>
|
||||
* The "type mapping" for the binding is inferred from the type of
|
||||
* the first collection element
|
||||
*
|
||||
* @apiNote This is used for binding a list of values to an expression such as {@code entity.field in (:values)}.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(String name, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter, using the
|
||||
* given {@link AllowableParameterType}. This is used for binding a list
|
||||
* of values to an expression such as {@code entity.field in (?1)}.
|
||||
*
|
||||
* @param position the positional parameter label
|
||||
* @param values a collection of arguments
|
||||
* @param type an {@link AllowableParameterType} representing the type of the parameter
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
<P> Query<R> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a named query parameter, using the given
|
||||
* {@link AllowableParameterType}. This is used for binding a list of
|
||||
* values to an expression such as {@code entity.field in (?1)}.
|
||||
*
|
||||
* @param name the name of the parameter
|
||||
* @param values an array of arguments
|
||||
* @param type an {@link AllowableParameterType} representing the type of the parameter
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
Query<R> setParameterList(String name, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
|
||||
|
||||
/**
|
||||
* Bind multiple arguments to a positional query parameter, using the
|
||||
* given {@link AllowableParameterType}. This is used for binding a list
|
||||
* of values to an expression such as {@code entity.field in (?1)}.
|
||||
*
|
||||
* @param position the positional parameter label
|
||||
* @param values an array of arguments
|
||||
* @param type an {@link AllowableParameterType} representing the type of the parameter
|
||||
*
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
Query<R> setParameterList(int position, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
|
||||
<P> Query<R> setParameterList(QueryParameter<P> parameter, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
/**
|
||||
* Bind the property values of the given bean to named parameters of the query,
|
||||
|
@ -646,6 +758,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
|||
*/
|
||||
Query<R> setProperties(@SuppressWarnings("rawtypes") Map bean);
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// covariant overrides - CommonQueryContract
|
||||
|
||||
|
@ -670,6 +783,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
|||
@Override
|
||||
Query<R> setReadOnly(boolean readOnly);
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// covariant overrides - jakarta.persistence.Query/TypedQuery
|
||||
|
||||
|
@ -688,6 +802,7 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
|||
@Override
|
||||
Query<R> setLockMode(LockModeType lockMode);
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// deprecated methods
|
||||
|
||||
|
@ -702,181 +817,4 @@ public interface Query<R> extends TypedQuery<R>, CommonQueryContract {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind a positional query parameter as some form of date/time using
|
||||
* the indicated temporal-type.
|
||||
*
|
||||
* @param position the position of the parameter in the query string
|
||||
* @param val the possibly-null parameter value
|
||||
* @param temporalType the temporal-type to use in binding the date/time
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*
|
||||
* @deprecated use {@link #setParameter(int, Object)}
|
||||
* passing a {@link java.time.LocalDate}, {@link java.time.LocalTime},
|
||||
* or {@link java.time.LocalDateTime}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(int position, Object val, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* Bind a named query parameter as some form of date/time using
|
||||
* the indicated temporal-type.
|
||||
*
|
||||
* @param name the parameter name
|
||||
* @param val the possibly-null parameter value
|
||||
* @param temporalType the temporal-type to use in binding the date/time
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*
|
||||
* @deprecated use {@link #setParameter(String, Object)}
|
||||
* passing a {@link java.time.LocalDate}, {@link java.time.LocalTime},
|
||||
* or {@link java.time.LocalDateTime}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(String name, Object val, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* Bind a query parameter as some form of date/time using the indicated
|
||||
* temporal-type.
|
||||
*
|
||||
* @param parameter The query parameter memento
|
||||
* @param val the possibly-null parameter value
|
||||
* @param temporalType the temporal-type to use in binding the date/time
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*
|
||||
* @deprecated use {@link #setParameter(int, Object)}
|
||||
* passing a {@link java.time.LocalDate}, {@link java.time.LocalTime},
|
||||
* or {@link java.time.LocalDateTime}
|
||||
*/
|
||||
@Deprecated
|
||||
<P> Query<R> setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(Parameter, Object)}
|
||||
*/
|
||||
@Override @Deprecated
|
||||
Query<R> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(Parameter, Object)},
|
||||
* passing a {@link java.time.LocalDate}, {@link java.time.LocalTime},
|
||||
* or {@link java.time.LocalDateTime}
|
||||
*/
|
||||
@Override @Deprecated
|
||||
Query<R> setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(String, Object)},
|
||||
* passing a {@link java.time.LocalDate}, {@link java.time.LocalTime},
|
||||
* or {@link java.time.LocalDateTime}
|
||||
*/
|
||||
@Override @Deprecated
|
||||
Query<R> setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(String, Object)}
|
||||
* passing a {@link java.time.LocalDate}, {@link java.time.LocalTime},
|
||||
* or {@link java.time.LocalDateTime}
|
||||
*/
|
||||
@Override @Deprecated
|
||||
Query<R> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(int, Object)}
|
||||
* passing a {@link java.time.LocalDate}, {@link java.time.LocalTime},
|
||||
* or {@link java.time.LocalDateTime}
|
||||
*/
|
||||
@Override @Deprecated
|
||||
Query<R> setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(int, Object)}
|
||||
* passing a {@link java.time.LocalDate}, {@link java.time.LocalTime},
|
||||
* or {@link java.time.LocalDateTime}
|
||||
*/
|
||||
@Override @Deprecated
|
||||
Query<R> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(Parameter, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(Parameter, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(
|
||||
Parameter<LocalDateTime> param,
|
||||
LocalDateTime value,
|
||||
TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(Parameter, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(
|
||||
Parameter<ZonedDateTime> param,
|
||||
ZonedDateTime value,
|
||||
TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(Parameter, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(
|
||||
Parameter<OffsetDateTime> param,
|
||||
OffsetDateTime value,
|
||||
TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(String, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(String name, Instant value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(String, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(String name, LocalDateTime value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(String, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(String name, ZonedDateTime value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(String, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(String name, OffsetDateTime value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(int, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(int position, Instant value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(int, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(int position, LocalDateTime value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(int, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(int position, ZonedDateTime value, TemporalType temporalType);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setParameter(int, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
Query<R> setParameter(int position, OffsetDateTime value, TemporalType temporalType);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
package org.hibernate.query;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
|
||||
/**
|
||||
* Represents a parameter defined in the source (HQL/JPQL or criteria) query.
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
package org.hibernate.query;
|
||||
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.type.BasicTypeReference;
|
||||
|
||||
/**
|
||||
* Can be used to bind query parameter values. Allows to provide additional details about the
|
||||
* Can be used to bind query parameter values. Allows providing additional details about the
|
||||
* parameter value/binding.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
|
|
|
@ -406,65 +406,6 @@ public interface HibernateCriteriaBuilder extends CriteriaBuilder {
|
|||
@Override
|
||||
<R> JpaSearchedCase<R> selectCase();
|
||||
|
||||
/**
|
||||
* Create a tuple, as in a composite value, usable in any
|
||||
* part of the query.
|
||||
*
|
||||
* @apiNote This is different from the purely JPA form
|
||||
* {@link CriteriaBuilder#tuple} which is intended only for use as
|
||||
* the selection in a root query.
|
||||
*
|
||||
* @param tupleType The Java type
|
||||
* @param expressions The individual expressions making up the tuple
|
||||
*/
|
||||
<R> JpaCompoundSelection<R> tuple(
|
||||
Class<R> tupleType,
|
||||
JpaExpression<?>... expressions);
|
||||
|
||||
/**
|
||||
* Create a tuple, as in a composite value, usable in any
|
||||
* part of the query.
|
||||
*
|
||||
* @apiNote This is different from the purely JPA form
|
||||
* {@link CriteriaBuilder#tuple} which is intended only for use as
|
||||
* the selection in a root query.
|
||||
*@param tupleType The Java type
|
||||
* @param expressions The individual expressions making up the tuple
|
||||
*/
|
||||
<R> JpaCompoundSelection<R> tuple(
|
||||
Class<R> tupleType,
|
||||
List<? extends JpaExpression<?>> expressions);
|
||||
|
||||
/**
|
||||
* Create a tuple, as in a composite value, usable in any
|
||||
* part of the query.
|
||||
*
|
||||
* @apiNote This is different from the purely JPA form
|
||||
* {@link CriteriaBuilder#tuple} which is intended only for use as
|
||||
* the selection in a root query.
|
||||
*
|
||||
* @param tupleType The metamodel DomainType descriptor to apply to the tuple
|
||||
* @param expressions The individual expressions making up the tuple
|
||||
*/
|
||||
<R> JpaCompoundSelection<R> tuple(
|
||||
DomainType<R> tupleType,
|
||||
JpaExpression<?>... expressions);
|
||||
|
||||
/**
|
||||
* Create a tuple, as in a composite value, usable in any
|
||||
* part of the query.
|
||||
*
|
||||
* @apiNote This is different from the purely JPA form
|
||||
* {@link CriteriaBuilder#tuple} which is intended only for use as
|
||||
* the selection in a root query.
|
||||
*
|
||||
* @param tupleType The metamodel DomainType descriptor to apply to the tuple
|
||||
* @param expressions The individual expressions making up the tuple
|
||||
*/
|
||||
<R> JpaCompoundSelection<R> tuple(
|
||||
DomainType<R> tupleType,
|
||||
List<? extends JpaExpression<?>> expressions);
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Predicates
|
||||
|
|
|
@ -47,7 +47,7 @@ import org.hibernate.internal.util.collections.Stack;
|
|||
import org.hibernate.internal.util.collections.StandardStack;
|
||||
import org.hibernate.metamodel.CollectionClassification;
|
||||
import org.hibernate.metamodel.mapping.CollectionPart;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.internal;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
|
||||
/**
|
||||
|
@ -31,11 +31,14 @@ public abstract class AbstractQueryParameterImpl<T> implements QueryParameter<T>
|
|||
|
||||
public void setHibernateType(AllowableParameterType<?> expectedType) {
|
||||
//noinspection unchecked
|
||||
this.expectedType = (AllowableParameterType) expectedType;
|
||||
this.expectedType = (AllowableParameterType<T>) expectedType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> getParameterType() {
|
||||
return expectedType == null ? null : expectedType.getExpressableJavaTypeDescriptor().getJavaTypeClass();
|
||||
if ( expectedType == null ) {
|
||||
return null;
|
||||
}
|
||||
return expectedType.getBindableJavaType();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,14 +11,17 @@ import java.time.OffsetDateTime;
|
|||
import java.time.OffsetTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Calendar;
|
||||
import jakarta.persistence.TemporalType;
|
||||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import jakarta.persistence.TemporalType;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
|
@ -34,21 +37,25 @@ public class BindingTypeHelper {
|
|||
public <T> AllowableParameterType<T> resolveTemporalPrecision(
|
||||
TemporalType precision,
|
||||
AllowableParameterType<T> declaredParameterType,
|
||||
TypeConfiguration typeConfiguration) {
|
||||
SessionFactoryImplementor sessionFactory) {
|
||||
if ( precision != null ) {
|
||||
if ( !( declaredParameterType.getExpressableJavaTypeDescriptor() instanceof TemporalJavaTypeDescriptor ) ) {
|
||||
final SqmExpressable<T> sqmExpressable = declaredParameterType.resolveExpressable( sessionFactory );
|
||||
if ( !( sqmExpressable.getExpressableJavaTypeDescriptor() instanceof TemporalJavaTypeDescriptor ) ) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Cannot treat non-temporal parameter type with temporal precision"
|
||||
);
|
||||
}
|
||||
final TemporalJavaTypeDescriptor<T> temporalJtd = (TemporalJavaTypeDescriptor<T>) declaredParameterType.getExpressableJavaTypeDescriptor();
|
||||
|
||||
final TemporalJavaTypeDescriptor<T> temporalJtd = (TemporalJavaTypeDescriptor<T>) sqmExpressable.getExpressableJavaTypeDescriptor();
|
||||
if ( temporalJtd.getPrecision() != precision ) {
|
||||
final TypeConfiguration typeConfiguration = sessionFactory.getTypeConfiguration();
|
||||
return typeConfiguration.getBasicTypeRegistry().resolve(
|
||||
temporalJtd.resolveTypeForPrecision( precision, typeConfiguration ),
|
||||
TemporalJavaTypeDescriptor.resolveJdbcTypeCode( precision )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return declaredParameterType;
|
||||
}
|
||||
|
||||
|
@ -78,12 +85,12 @@ public class BindingTypeHelper {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public AllowableParameterType resolveTimestampTemporalTypeVariant(
|
||||
Class javaType,
|
||||
AllowableParameterType baseType,
|
||||
TypeConfiguration typeConfiguration) {
|
||||
//noinspection unchecked
|
||||
if ( baseType.getExpressableJavaTypeDescriptor().getJavaTypeClass().isAssignableFrom( javaType ) ) {
|
||||
if ( baseType.getBindableJavaType().isAssignableFrom( javaType ) ) {
|
||||
return baseType;
|
||||
}
|
||||
|
||||
|
@ -118,7 +125,7 @@ public class BindingTypeHelper {
|
|||
Class<?> javaType,
|
||||
AllowableParameterType<?> baseType,
|
||||
TypeConfiguration typeConfiguration) {
|
||||
if ( baseType.getExpressableJavaTypeDescriptor().getJavaTypeClass().isAssignableFrom( javaType ) ) {
|
||||
if ( baseType.getBindableJavaType().isAssignableFrom( javaType ) ) {
|
||||
return baseType;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hibernate.QueryException;
|
|||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
import org.hibernate.internal.util.compare.ComparableComparator;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
import org.hibernate.query.spi.ParameterMetadataImplementor;
|
||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||
|
|
|
@ -8,21 +8,23 @@ package org.hibernate.query.internal;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import jakarta.persistence.TemporalType;
|
||||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
import org.hibernate.query.spi.QueryParameterBinding;
|
||||
import org.hibernate.query.spi.QueryParameterBindingTypeResolver;
|
||||
import org.hibernate.query.spi.QueryParameterBindingValidator;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.type.descriptor.java.CoercionException;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import jakarta.persistence.TemporalType;
|
||||
|
||||
/**
|
||||
* The standard Hibernate QueryParameterBinding implementation
|
||||
*
|
||||
|
@ -30,7 +32,7 @@ import org.hibernate.type.spi.TypeConfiguration;
|
|||
*/
|
||||
public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, JavaType.CoercionContext {
|
||||
private final QueryParameter<T> queryParameter;
|
||||
private final QueryParameterBindingTypeResolver typeResolver;
|
||||
private final SessionFactoryImplementor sessionFactory;
|
||||
private final boolean isBindingValidationRequired;
|
||||
|
||||
private boolean isBound;
|
||||
|
@ -43,25 +45,29 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
private T bindValue;
|
||||
private Collection<? extends T> bindValues;
|
||||
|
||||
// todo (6.0) : add TemporalType to QueryParameter and use to default precision here
|
||||
|
||||
public QueryParameterBindingImpl(
|
||||
/**
|
||||
* Used by {@link org.hibernate.procedure.ProcedureCall}
|
||||
*/
|
||||
protected QueryParameterBindingImpl(
|
||||
QueryParameter<T> queryParameter,
|
||||
QueryParameterBindingTypeResolver typeResolver,
|
||||
SessionFactoryImplementor sessionFactory,
|
||||
boolean isBindingValidationRequired) {
|
||||
this.queryParameter = queryParameter;
|
||||
this.typeResolver = typeResolver;
|
||||
this.sessionFactory = sessionFactory;
|
||||
this.isBindingValidationRequired = isBindingValidationRequired;
|
||||
this.bindType = queryParameter.getHibernateType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by Query (SQM) and NativeQuery
|
||||
*/
|
||||
public QueryParameterBindingImpl(
|
||||
QueryParameter<T> queryParameter,
|
||||
QueryParameterBindingTypeResolver typeResolver,
|
||||
SessionFactoryImplementor sessionFactory,
|
||||
AllowableParameterType<T> bindType,
|
||||
boolean isBindingValidationRequired) {
|
||||
this.queryParameter = queryParameter;
|
||||
this.typeResolver = typeResolver;
|
||||
this.sessionFactory = sessionFactory;
|
||||
this.isBindingValidationRequired = isBindingValidationRequired;
|
||||
this.bindType = bindType;
|
||||
}
|
||||
|
@ -108,10 +114,10 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
if ( ! getTypeConfiguration().getSessionFactory().getJpaMetamodel().getJpaCompliance().isLoadByIdComplianceEnabled() ) {
|
||||
try {
|
||||
if ( bindType != null ) {
|
||||
value = bindType.getExpressableJavaTypeDescriptor().coerce( value, this );
|
||||
value = coerce( value, bindType );
|
||||
}
|
||||
else if ( queryParameter.getHibernateType() != null ) {
|
||||
value = queryParameter.getHibernateType().getExpressableJavaTypeDescriptor().coerce( value, this );
|
||||
value = coerce( value, queryParameter.getHibernateType() );
|
||||
}
|
||||
}
|
||||
catch (CoercionException ce) {
|
||||
|
@ -119,7 +125,7 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
String.format(
|
||||
"Parameter value [%s] did not match expected type [%s ]",
|
||||
value,
|
||||
bindType.getTypeName()
|
||||
bindType
|
||||
),
|
||||
ce
|
||||
);
|
||||
|
@ -136,6 +142,17 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
bindValue( value );
|
||||
}
|
||||
|
||||
private T coerce(T value, AllowableParameterType<T> parameterType) {
|
||||
if ( value == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final SqmExpressable<T> sqmExpressable = parameterType.resolveExpressable( sessionFactory );
|
||||
assert sqmExpressable != null;
|
||||
|
||||
return sqmExpressable.getExpressableJavaTypeDescriptor().coerce( value, this );
|
||||
}
|
||||
|
||||
private boolean handleAsMultiValue(T value) {
|
||||
if ( ! queryParameter.allowsMultiValuedBinding() ) {
|
||||
return false;
|
||||
|
@ -164,7 +181,7 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
|
||||
if ( bindType == null ) {
|
||||
if ( value != null ) {
|
||||
this.bindType = typeResolver.resolveParameterBindType( value );
|
||||
this.bindType = sessionFactory.resolveParameterBindType( value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,10 +197,10 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
}
|
||||
|
||||
if ( bindType != null ) {
|
||||
value = bindType.getExpressableJavaTypeDescriptor().coerce( value, this );
|
||||
value = coerce( value, bindType );
|
||||
}
|
||||
else if ( queryParameter.getHibernateType() != null ) {
|
||||
value = queryParameter.getHibernateType().getExpressableJavaTypeDescriptor().coerce( value, this );
|
||||
value = coerce( value, queryParameter.getHibernateType() );
|
||||
}
|
||||
|
||||
if ( isBindingValidationRequired ) {
|
||||
|
@ -206,14 +223,14 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
if ( ! getTypeConfiguration().getSessionFactory().getJpaMetamodel().getJpaCompliance().isLoadByIdComplianceEnabled() ) {
|
||||
if ( bindType != null ) {
|
||||
try {
|
||||
value = bindType.getExpressableJavaTypeDescriptor().coerce( value, this );
|
||||
value = coerce( value, bindType );
|
||||
}
|
||||
catch (CoercionException ex) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"Parameter value [%s] did not match expected type [%s (%s)]",
|
||||
value,
|
||||
bindType.getTypeName(),
|
||||
bindType,
|
||||
temporalTypePrecision == null ? "n/a" : temporalTypePrecision.name()
|
||||
),
|
||||
ex
|
||||
|
@ -221,7 +238,7 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
}
|
||||
}
|
||||
else if ( queryParameter.getHibernateType() != null ) {
|
||||
value = queryParameter.getHibernateType().getExpressableJavaTypeDescriptor().coerce( value, this );
|
||||
value = coerce( value, queryParameter.getHibernateType() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,7 +278,7 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
}
|
||||
|
||||
if ( bindType == null && value != null ) {
|
||||
this.bindType = typeResolver.resolveParameterBindType( value );
|
||||
this.bindType = sessionFactory.resolveParameterBindType( value );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -284,18 +301,24 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
}
|
||||
|
||||
private void setExplicitTemporalPrecision(TemporalType temporalTypePrecision) {
|
||||
// todo (6.0): what to do with converted attributes?
|
||||
if ( bindType == null || bindType.getExpressableJavaTypeDescriptor() instanceof TemporalJavaTypeDescriptor<?> ) {
|
||||
if ( bindType == null || determineJavaType( bindType ) instanceof TemporalJavaTypeDescriptor<?> ) {
|
||||
this.bindType = BindingTypeHelper.INSTANCE.resolveTemporalPrecision(
|
||||
temporalTypePrecision,
|
||||
bindType,
|
||||
getTypeConfiguration()
|
||||
sessionFactory
|
||||
);
|
||||
}
|
||||
|
||||
this.explicitTemporalPrecision = temporalTypePrecision;
|
||||
}
|
||||
|
||||
private JavaType<T> determineJavaType(AllowableParameterType<T> bindType) {
|
||||
final SqmExpressable<T> sqmExpressable = bindType.resolveExpressable( sessionFactory );
|
||||
assert sqmExpressable != null;
|
||||
|
||||
return sqmExpressable.getExpressableJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MappingModelExpressable<T> getType() {
|
||||
return type;
|
||||
|
@ -304,7 +327,7 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
@Override @SuppressWarnings("unchecked")
|
||||
public boolean setType(MappingModelExpressable<T> type) {
|
||||
this.type = type;
|
||||
if ( bindType == null || bindType.getJavaType() == Object.class ) {
|
||||
if ( bindType == null || bindType.getBindableJavaType() == Object.class ) {
|
||||
if ( type instanceof AllowableParameterType<?> ) {
|
||||
final boolean changed = bindType != null && type != bindType;
|
||||
this.bindType = (AllowableParameterType<T>) type;
|
||||
|
@ -323,19 +346,19 @@ public class QueryParameterBindingImpl<T> implements QueryParameterBinding<T>, J
|
|||
}
|
||||
|
||||
private void validate(T value) {
|
||||
QueryParameterBindingValidator.INSTANCE.validate( getBindType(), value );
|
||||
QueryParameterBindingValidator.INSTANCE.validate( getBindType(), value, sessionFactory );
|
||||
}
|
||||
|
||||
private void validate(T value, AllowableParameterType<?> clarifiedType) {
|
||||
QueryParameterBindingValidator.INSTANCE.validate( clarifiedType, value );
|
||||
QueryParameterBindingValidator.INSTANCE.validate( clarifiedType, value, sessionFactory );
|
||||
}
|
||||
|
||||
private void validate(T value, TemporalType clarifiedTemporalType) {
|
||||
QueryParameterBindingValidator.INSTANCE.validate( getBindType(), value, clarifiedTemporalType );
|
||||
QueryParameterBindingValidator.INSTANCE.validate( getBindType(), value, clarifiedTemporalType, sessionFactory );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeConfiguration getTypeConfiguration() {
|
||||
return typeResolver.getTypeConfiguration();
|
||||
return sessionFactory.getTypeConfiguration();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ public class QueryParameterBindingsImpl implements QueryParameterBindings {
|
|||
else if ( binding.getBindValue() != null ) {
|
||||
return typeConfiguration.getBasicTypeForJavaType( binding.getBindValue().getClass() );
|
||||
}
|
||||
return typeConfiguration.getBasicTypeForJavaType( binding.getBindType().getJavaType() );
|
||||
return typeConfiguration.getBasicTypeForJavaType( binding.getBindType().getBindableJavaType() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ package org.hibernate.query.internal;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.AbstractQueryParameter;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.query.internal;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.AbstractQueryParameter;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,11 +7,21 @@
|
|||
package org.hibernate.query.spi;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.ScrollMode;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.Query;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
|
||||
import jakarta.persistence.Parameter;
|
||||
import jakarta.persistence.TemporalType;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -34,4 +44,119 @@ public interface QueryImplementor<R> extends Query<R> {
|
|||
|
||||
@Override
|
||||
ScrollableResultsImplementor<R> scroll(ScrollMode scrollMode);
|
||||
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameter(String name, Object value);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameter(String name, P value, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameter(String name, P value, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameter(String name, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameter(int position, Object value);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameter(int position, P value, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameter(int position, P value, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameter(int position, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<T> QueryImplementor<R> setParameter(QueryParameter<T> parameter, T value);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameter(QueryParameter<P> parameter, P value, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameter(QueryParameter<P> parameter, P val, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
<T> QueryImplementor<R> setParameter(Parameter<T> param, T value);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameterList(String name, Collection values);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(String name, Collection<? extends P> values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(String name, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameterList(String name, Object[] values);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(String name, P[] values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(String name, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameterList(int position, Collection values);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(int position, Collection<? extends P> values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setParameterList(int position, Object[] values);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(int position, P[] values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(int position, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(QueryParameter<P> parameter, P[] values);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> QueryImplementor<R> setParameterList(QueryParameter<P> parameter, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setProperties(Object bean);
|
||||
|
||||
@Override
|
||||
QueryImplementor<R> setProperties(Map bean);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import jakarta.persistence.TemporalType;
|
|||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.spi;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,12 +9,15 @@ package org.hibernate.query.spi;
|
|||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import jakarta.persistence.TemporalType;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
|
||||
import jakarta.persistence.TemporalType;
|
||||
|
||||
/**
|
||||
* @author Andrea Boriero
|
||||
*/
|
||||
|
@ -25,49 +28,61 @@ public class QueryParameterBindingValidator {
|
|||
private QueryParameterBindingValidator() {
|
||||
}
|
||||
|
||||
public void validate(AllowableParameterType paramType, Object bind) {
|
||||
validate( paramType, bind, null );
|
||||
public void validate(AllowableParameterType<?> paramType, Object bind, SessionFactoryImplementor sessionFactory) {
|
||||
validate( paramType, bind, null, sessionFactory );
|
||||
}
|
||||
|
||||
public void validate(AllowableParameterType paramType, Object bind, TemporalType temporalType) {
|
||||
public void validate(
|
||||
AllowableParameterType<?> paramType,
|
||||
Object bind,
|
||||
TemporalType temporalPrecision,
|
||||
SessionFactoryImplementor sessionFactory) {
|
||||
if ( bind == null || paramType == null ) {
|
||||
// nothing we can check
|
||||
return;
|
||||
}
|
||||
|
||||
if ( paramType instanceof AttributeConverterTypeAdapter ) {
|
||||
final AttributeConverterTypeAdapter converterTypeAdapter = (AttributeConverterTypeAdapter) paramType;
|
||||
final JavaType domainJtd = converterTypeAdapter.getDomainJtd();
|
||||
final AttributeConverterTypeAdapter<?> converterTypeAdapter = (AttributeConverterTypeAdapter<?>) paramType;
|
||||
final JavaType<?> domainJtd = converterTypeAdapter.getDomainJtd();
|
||||
|
||||
if ( domainJtd.getJavaTypeClass().isInstance( bind ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final Class parameterType = paramType.getExpressableJavaTypeDescriptor().getJavaTypeClass();
|
||||
if ( parameterType == null ) {
|
||||
final Class<?> parameterJavaType;
|
||||
if ( paramType.getBindableJavaType() != null ) {
|
||||
parameterJavaType = paramType.getBindableJavaType();
|
||||
}
|
||||
else {
|
||||
final SqmExpressable<?> sqmExpressable = paramType.resolveExpressable( sessionFactory );
|
||||
parameterJavaType = sqmExpressable.getBindableJavaType();
|
||||
}
|
||||
|
||||
if ( parameterJavaType == null ) {
|
||||
// nothing we can check
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Collection.class.isInstance( bind ) && !Collection.class.isAssignableFrom( parameterType ) ) {
|
||||
if ( bind instanceof Collection && !Collection.class.isAssignableFrom( parameterJavaType ) ) {
|
||||
// we have a collection passed in where we are expecting a non-collection.
|
||||
// NOTE : this can happen in Hibernate's notion of "parameter list" binding
|
||||
// NOTE2 : the case of a collection value and an expected collection (if that can even happen)
|
||||
// will fall through to the main check.
|
||||
validateCollectionValuedParameterBinding( parameterType, (Collection) bind, temporalType );
|
||||
validateCollectionValuedParameterBinding( parameterJavaType, (Collection<?>) bind, temporalPrecision );
|
||||
}
|
||||
else if ( bind.getClass().isArray() ) {
|
||||
validateArrayValuedParameterBinding( parameterType, bind, temporalType );
|
||||
validateArrayValuedParameterBinding( parameterJavaType, bind, temporalPrecision );
|
||||
}
|
||||
else {
|
||||
if ( !isValidBindValue( parameterType, bind, temporalType ) ) {
|
||||
if ( !isValidBindValue( parameterJavaType, bind, temporalPrecision ) ) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"Parameter value [%s] did not match expected type [%s (%s)]",
|
||||
bind,
|
||||
parameterType.getName(),
|
||||
extractName( temporalType )
|
||||
parameterJavaType.getName(),
|
||||
extractName( temporalPrecision )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -79,8 +94,8 @@ public class QueryParameterBindingValidator {
|
|||
}
|
||||
|
||||
private void validateCollectionValuedParameterBinding(
|
||||
Class parameterType,
|
||||
Collection value,
|
||||
Class<?> parameterType,
|
||||
Collection<?> value,
|
||||
TemporalType temporalType) {
|
||||
// validate the elements...
|
||||
for ( Object element : value ) {
|
||||
|
@ -97,7 +112,7 @@ public class QueryParameterBindingValidator {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean isValidBindValue(Class expectedType, Object value, TemporalType temporalType) {
|
||||
private static boolean isValidBindValue(Class<?> expectedType, Object value, TemporalType temporalType) {
|
||||
if ( expectedType.isPrimitive() ) {
|
||||
if ( expectedType == boolean.class ) {
|
||||
return value instanceof Boolean;
|
||||
|
@ -137,16 +152,14 @@ public class QueryParameterBindingValidator {
|
|||
final boolean bindIsTemporal = value instanceof Date
|
||||
|| value instanceof Calendar;
|
||||
|
||||
if ( parameterDeclarationIsTemporal && bindIsTemporal ) {
|
||||
return true;
|
||||
}
|
||||
return parameterDeclarationIsTemporal && bindIsTemporal;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void validateArrayValuedParameterBinding(
|
||||
Class parameterType,
|
||||
Class<?> parameterType,
|
||||
Object value,
|
||||
TemporalType temporalType) {
|
||||
if ( !parameterType.isArray() ) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.spi;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
import org.hibernate.query.named.NamedQueryMemento;
|
||||
|
||||
|
@ -16,7 +16,7 @@ import org.hibernate.query.named.NamedQueryMemento;
|
|||
public interface QueryParameterImplementor<T> extends QueryParameter<T> {
|
||||
void disallowMultiValuedBinding();
|
||||
|
||||
void applyAnticipatedType(AllowableParameterType type);
|
||||
void applyAnticipatedType(AllowableParameterType<?> type);
|
||||
|
||||
NamedQueryMemento.ParameterMemento toMemento();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Collection;
|
|||
import jakarta.persistence.TemporalType;
|
||||
|
||||
import org.hibernate.Incubating;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.internal.QueryParameterBindingsImpl;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
|
|
@ -8,9 +8,6 @@ package org.hibernate.query.sql.internal;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
@ -44,8 +41,8 @@ import org.hibernate.internal.util.StringHelper;
|
|||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
import org.hibernate.jpa.internal.util.LockModeTypeHelper;
|
||||
import org.hibernate.jpa.spi.NativeQueryTupleTransformer;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.NativeQuery;
|
||||
import org.hibernate.query.ParameterMetadata;
|
||||
import org.hibernate.query.Query;
|
||||
|
@ -1208,17 +1205,8 @@ public class NativeQueryImpl<R>
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P value) {
|
||||
super.setParameter( parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(Parameter<P> parameter, P value) {
|
||||
super.setParameter( parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(String name, Object value) {
|
||||
|
@ -1227,199 +1215,14 @@ public class NativeQueryImpl<R>
|
|||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(int position, Object value) {
|
||||
super.setParameter( position, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @SuppressWarnings("unchecked")
|
||||
// public NativeQueryImplementor<R> setParameter(QueryParameter parameter, Object value, Type type) {
|
||||
// super.setParameter( parameter, value, type );
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NativeQueryImplementor<R> setParameter(String name, Object value, Type type) {
|
||||
// super.setParameter( name, value, type );
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NativeQueryImplementor<R> setParameter(int position, Object value, Type type) {
|
||||
// super.setParameter( position, value, type );
|
||||
// return this;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P value, TemporalType temporalType) {
|
||||
super.setParameter( parameter, value, temporalType );
|
||||
public <P> NativeQueryImplementor<R> setParameter(String name, P value, Class<P> javaType) {
|
||||
super.setParameter( name, value, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(String name, Object value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(int position, Object value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public NativeQueryImplementor<R> setParameterList(int position, Collection values, Type type) {
|
||||
// return setParameterList( position, values, ( AllowableParameterType) type );
|
||||
// }
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(String name, Collection<? extends P> values, AllowableParameterType<P> type) {
|
||||
super.setParameterList( name, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(
|
||||
int position, Collection<? extends P> values,
|
||||
AllowableParameterType<P> type) {
|
||||
super.setParameterList( position, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameterList(
|
||||
String name, Object[] values,
|
||||
@SuppressWarnings("rawtypes") AllowableParameterType type) {
|
||||
super.setParameterList( name, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameterList(
|
||||
int position, Object[] values,
|
||||
@SuppressWarnings("rawtypes") AllowableParameterType type) {
|
||||
super.setParameterList( position, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public NativeQueryImplementor<R> setParameterList(int position, Object[] values, Type type) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(String name, Instant value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(String name, LocalDateTime value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(String name, ZonedDateTime value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(String name, OffsetDateTime value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(int position, Instant value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(int position, LocalDateTime value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(int position, ZonedDateTime value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(int position, OffsetDateTime value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<P> values) {
|
||||
super.setParameterList( parameter, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values) {
|
||||
super.setParameterList( name, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public NativeQueryImplementor<R> setParameterList(String name, Collection values, Type type) {
|
||||
// super.setParameterList( name, values, type );
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NativeQueryImplementor<R> setParameterList(String name, Object[] values, Type type) {
|
||||
// super.setParameterList( name, values, type );
|
||||
// return this;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameterList(String name, Object[] values) {
|
||||
super.setParameterList( name, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(Parameter<Date> param, Date value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
public <P> NativeQueryImplementor<R> setParameter(String name, P value, AllowableParameterType<P> type) {
|
||||
super.setParameter( name, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1429,12 +1232,42 @@ public class NativeQueryImpl<R>
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(String name, Instant value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(String name, Date value, TemporalType temporalType) {
|
||||
super.setParameter( name, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(int position, Object value) {
|
||||
super.setParameter( position, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(int position, P value, Class<P> javaType) {
|
||||
super.setParameter( position, value, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(int position, P value, AllowableParameterType<P> type) {
|
||||
super.setParameter( position, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(int position, Instant value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(int position, Calendar value, TemporalType temporalType) {
|
||||
super.setParameter( position, value, temporalType );
|
||||
|
@ -1447,9 +1280,160 @@ public class NativeQueryImpl<R>
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override @SuppressWarnings("deprecation")
|
||||
public NativeQueryImplementor<R> setResultTransformer(ResultTransformer transformer) {
|
||||
super.setResultTransformer( transformer );
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P value) {
|
||||
super.setParameter( parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P value, Class<P> javaType) {
|
||||
super.setParameter( parameter, value, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P value, AllowableParameterType<P> type) {
|
||||
super.setParameter( parameter, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(Parameter<P> parameter, P value) {
|
||||
super.setParameter( parameter, value );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameter(Parameter<Date> param, Date value, TemporalType temporalType) {
|
||||
super.setParameter( param, value, temporalType );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values) {
|
||||
super.setParameterList( name, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(String name, Collection<? extends P> values, Class<P> javaType) {
|
||||
super.setParameterList( name, values, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(String name, Collection<? extends P> values, AllowableParameterType<P> type) {
|
||||
super.setParameterList( name, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameterList(String name, Object[] values) {
|
||||
super.setParameterList( name, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(String name, P[] values, Class<P> javaType) {
|
||||
super.setParameterList( name, values, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(String name, P[] values, AllowableParameterType<P> type) {
|
||||
super.setParameterList( name, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values) {
|
||||
super.setParameterList( position, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(int position, Collection<? extends P> values, Class<P> javaType) {
|
||||
super.setParameterList( position, values, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type) {
|
||||
super.setParameterList( position, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameterList(int position, Object[] values) {
|
||||
super.setParameterList( position, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(int position, P[] values, Class<P> javaType) {
|
||||
super.setParameterList( position, values, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(int position, P[] values, AllowableParameterType<P> type) {
|
||||
super.setParameterList( position, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values) {
|
||||
super.setParameterList( parameter, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType) {
|
||||
super.setParameterList( parameter, values, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, AllowableParameterType<P> type) {
|
||||
super.setParameterList( parameter, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, P[] values) {
|
||||
super.setParameterList( parameter, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType) {
|
||||
super.setParameterList( parameter, values, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, P[] values, AllowableParameterType<P> type) {
|
||||
super.setParameterList( parameter, values, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1465,6 +1449,23 @@ public class NativeQueryImpl<R>
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override @SuppressWarnings("deprecation")
|
||||
public NativeQueryImplementor<R> setResultTransformer(ResultTransformer transformer) {
|
||||
super.setResultTransformer( transformer );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setMaxResults(int maxResult) {
|
||||
super.setMaxResults( maxResult );
|
||||
|
@ -1477,65 +1478,6 @@ public class NativeQueryImpl<R>
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P value, AllowableParameterType<P> type) {
|
||||
super.setParameter( parameter, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(String name, P value, AllowableParameterType<P> type) {
|
||||
super.setParameter( name, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(int position, P value, AllowableParameterType<P> type) {
|
||||
super.setParameter( position, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(String name, P value, BasicTypeReference<P> type) {
|
||||
super.setParameter( name, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(int position, P value, BasicTypeReference<P> type) {
|
||||
super.setParameter( position, value, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P val, BasicTypeReference<P> type) {
|
||||
super.setParameter( parameter, val, type );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values) {
|
||||
super.setParameterList( position, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> setParameterList(int position, Object[] values) {
|
||||
super.setParameterList( position, values );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(String name, Collection<? extends P> values, Class<P> javaType) {
|
||||
super.setParameterList( name, values, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P> NativeQueryImplementor<R> setParameterList(int position, Collection<? extends P> values, Class<P> javaType) {
|
||||
super.setParameterList( position, values, javaType );
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -7,19 +7,10 @@
|
|||
package org.hibernate.query.sql.spi;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.FlushModeType;
|
||||
import jakarta.persistence.LockModeType;
|
||||
import jakarta.persistence.Parameter;
|
||||
import jakarta.persistence.TemporalType;
|
||||
import jakarta.persistence.metamodel.SingularAttribute;
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.FlushMode;
|
||||
|
@ -27,8 +18,8 @@ import org.hibernate.Incubating;
|
|||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.NativeQuery;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
import org.hibernate.query.ResultListTransformer;
|
||||
|
@ -36,7 +27,13 @@ import org.hibernate.query.TupleTransformer;
|
|||
import org.hibernate.query.named.NameableQuery;
|
||||
import org.hibernate.query.results.dynamic.DynamicResultBuilderEntityStandard;
|
||||
import org.hibernate.query.spi.QueryImplementor;
|
||||
import org.hibernate.type.BasicTypeReference;
|
||||
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.FlushModeType;
|
||||
import jakarta.persistence.LockModeType;
|
||||
import jakarta.persistence.Parameter;
|
||||
import jakarta.persistence.TemporalType;
|
||||
import jakarta.persistence.metamodel.SingularAttribute;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -193,191 +190,125 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
|
|||
NativeQueryImplementor<R> addQueryHint(String hint);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P val);
|
||||
NativeQueryImplementor<R> setTupleTransformer(@SuppressWarnings("rawtypes") TupleTransformer transformer);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameter(Parameter<P> param, P value);
|
||||
NativeQueryImplementor<R> setResultListTransformer(ResultListTransformer transformer);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(String name, Object val);
|
||||
|
||||
// @Override
|
||||
// default <P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P val, Type type) {
|
||||
// return setParameter( parameter, val, (AllowableParameterType) type );
|
||||
// }
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameter(String name, P val, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P val, AllowableParameterType<P> type);
|
||||
<P> NativeQueryImplementor<R> setParameter(String name, P val, Class<P> type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(String name, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(String name, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(int position, Object val);
|
||||
|
||||
// @Override
|
||||
// default NativeQueryImplementor<R> setParameter(String name, Object val, Type type) {
|
||||
// return setParameter( name, val, (AllowableParameterType) type );
|
||||
// }
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameter(String name, P val, AllowableParameterType<P> type);
|
||||
|
||||
// @Override
|
||||
// default NativeQueryImplementor<R> setParameter(int position, Object val, Type type) {
|
||||
// return setParameter( position, val, (AllowableParameterType) type );
|
||||
// }
|
||||
<P> NativeQueryImplementor<R> setParameter(int position, P val, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameter(int position, P val, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameter(String name, P val, BasicTypeReference<P> type);
|
||||
NativeQueryImplementor<R> setParameter(int position, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameter(int position, P val, BasicTypeReference<P> type);
|
||||
NativeQueryImplementor<R> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P val, BasicTypeReference<P> type);
|
||||
NativeQueryImplementor<R> setParameter(int position, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameter(
|
||||
QueryParameter<P> parameter,
|
||||
P val,
|
||||
TemporalType temporalType);
|
||||
<P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P val);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(String name, Object val, TemporalType temporalType);
|
||||
<P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P val, Class<P> type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(int position, Object val, TemporalType temporalType);
|
||||
<P> NativeQueryImplementor<R> setParameter(QueryParameter<P> parameter, P val, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(
|
||||
QueryParameter<P> parameter,
|
||||
Collection<P> values);
|
||||
<P> NativeQueryImplementor<R> setParameter(Parameter<P> param, P value);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameterList(String name, @SuppressWarnings("rawtypes") Collection values);
|
||||
|
||||
// @Override
|
||||
// default NativeQueryImplementor<R> setParameterList(String name, Collection values, Type type) {
|
||||
// return setParameterList( name, values, (AllowableParameterType) type );
|
||||
// }
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(String name, Collection<? extends P> values, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(String name, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
//
|
||||
// @Override
|
||||
// default NativeQueryImplementor<R> setParameterList(String name, Object[] values, Type type) {
|
||||
// return setParameterList( name, values, (AllowableParameterType) type );
|
||||
// }
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameterList(String name, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameterList(String name, Object[] values);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(String name, P[] values, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(String name, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(int position, Collection<? extends P> values, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameterList(int position, Object[] values);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(int position, P[] values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(int position, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, P[] values);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(QueryParameter<P> parameter, P[] values, AllowableParameterType<P> type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setProperties(Object bean);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setProperties(@SuppressWarnings("rawtypes") Map bean);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(
|
||||
Parameter<Date> param,
|
||||
Date value,
|
||||
TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(
|
||||
Parameter<Calendar> param,
|
||||
Calendar value,
|
||||
TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(String name, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(
|
||||
String name,
|
||||
Calendar value,
|
||||
TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(
|
||||
int position,
|
||||
Calendar value,
|
||||
TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(int position, Date value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(String name, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setTupleTransformer(@SuppressWarnings("rawtypes") TupleTransformer transformer);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setResultListTransformer(ResultListTransformer transformer);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(int position, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(String name, LocalDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(int position, LocalDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(String name, ZonedDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(int position, ZonedDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(String name, OffsetDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(int position, OffsetDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameterList(int position, @SuppressWarnings("rawtypes") Collection values);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(String name, Collection<? extends P> values, Class<P> type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(int position, Collection<? extends P> values, Class<P> type);
|
||||
|
||||
// @Override
|
||||
// NativeQueryImplementor<R> setParameterList(int position, Collection values, Type type);
|
||||
|
||||
@Override
|
||||
<P> NativeQueryImplementor<R> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type);
|
||||
|
||||
// @Override
|
||||
// NativeQueryImplementor<R> setParameterList(int position, Object[] values, Type type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameterList(int position, Object[] values, @SuppressWarnings("rawtypes") AllowableParameterType type);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> setParameterList(int position, Object[] values);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -16,23 +16,10 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import jakarta.persistence.Tuple;
|
||||
import jakarta.persistence.criteria.CollectionJoin;
|
||||
import jakarta.persistence.criteria.Expression;
|
||||
import jakarta.persistence.criteria.Join;
|
||||
import jakarta.persistence.criteria.ListJoin;
|
||||
import jakarta.persistence.criteria.MapJoin;
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import jakarta.persistence.criteria.Selection;
|
||||
import jakarta.persistence.criteria.SetJoin;
|
||||
import jakarta.persistence.criteria.Subquery;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.JpaMetamodel;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.query.SortOrder;
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.metamodel.model.domain.JpaMetamodel;
|
||||
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
|
||||
import org.hibernate.query.criteria.JpaCoalesce;
|
||||
import org.hibernate.query.criteria.JpaCompoundSelection;
|
||||
|
@ -50,6 +37,7 @@ import org.hibernate.query.sqm.tree.domain.SqmPath;
|
|||
import org.hibernate.query.sqm.tree.domain.SqmSetJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmSingularJoin;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmFunction;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmModifiedSubQueryExpression;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmTuple;
|
||||
import org.hibernate.query.sqm.tree.from.SqmRoot;
|
||||
|
@ -61,10 +49,22 @@ import org.hibernate.query.sqm.tree.select.SqmSortSpecification;
|
|||
import org.hibernate.query.sqm.tree.select.SqmSubQuery;
|
||||
import org.hibernate.query.sqm.tree.update.SqmUpdateStatement;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmFunction;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import jakarta.persistence.Tuple;
|
||||
import jakarta.persistence.criteria.CollectionJoin;
|
||||
import jakarta.persistence.criteria.Expression;
|
||||
import jakarta.persistence.criteria.Join;
|
||||
import jakarta.persistence.criteria.ListJoin;
|
||||
import jakarta.persistence.criteria.MapJoin;
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import jakarta.persistence.criteria.Selection;
|
||||
import jakarta.persistence.criteria.SetJoin;
|
||||
import jakarta.persistence.criteria.Subquery;
|
||||
|
||||
/**
|
||||
* Adapts the JPA CriteriaBuilder to generate SQM nodes.
|
||||
*
|
||||
|
@ -84,6 +84,22 @@ public interface NodeBuilder extends HibernateCriteriaBuilder {
|
|||
|
||||
QueryEngine getQueryEngine();
|
||||
|
||||
<R> SqmTuple<R> tuple(
|
||||
Class<R> tupleType,
|
||||
SqmExpression<?>... expressions);
|
||||
|
||||
<R> SqmTuple<R> tuple(
|
||||
Class<R> tupleType,
|
||||
List<? extends SqmExpression<?>> expressions);
|
||||
|
||||
<R> SqmTuple<R> tuple(
|
||||
SqmExpressable<R> tupleType,
|
||||
SqmExpression<?>... expressions);
|
||||
|
||||
<R> SqmTuple<R> tuple(
|
||||
SqmExpressable<R> tupleType,
|
||||
List<? extends SqmExpression<?>> expressions);
|
||||
|
||||
@Override
|
||||
SqmSelectStatement<Object> createQuery();
|
||||
|
||||
|
@ -404,26 +420,6 @@ public interface NodeBuilder extends HibernateCriteriaBuilder {
|
|||
@Override
|
||||
<R> JpaSearchedCase<R> selectCase();
|
||||
|
||||
@Override
|
||||
<R> SqmTuple<R> tuple(
|
||||
Class<R> tupleType,
|
||||
JpaExpression<?>... expressions);
|
||||
|
||||
@Override
|
||||
<R> SqmTuple<R> tuple(
|
||||
Class<R> tupleType,
|
||||
List<? extends JpaExpression<?>> expressions);
|
||||
|
||||
@Override
|
||||
<R> SqmTuple<R> tuple(
|
||||
DomainType<R> tupleType,
|
||||
JpaExpression<?>... expressions);
|
||||
|
||||
@Override
|
||||
<R> SqmTuple<R> tuple(
|
||||
DomainType<R> tupleType,
|
||||
List<? extends JpaExpression<?>> expressions);
|
||||
|
||||
@Override
|
||||
SqmPredicate and(Expression<Boolean> x, Expression<Boolean> y);
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm;
|
||||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
|
||||
|
@ -17,9 +19,14 @@ import org.hibernate.type.descriptor.java.JavaType;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface SqmExpressable<J> {
|
||||
public interface SqmExpressable<J> extends AllowableParameterType<J> {
|
||||
/**
|
||||
* The Java type descriptor for this expressable
|
||||
*/
|
||||
JavaType<J> getExpressableJavaTypeDescriptor();
|
||||
|
||||
@Override
|
||||
default SqmExpressable<J> resolveExpressable(SessionFactoryImplementor sessionFactory) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.produce.function.ArgumentTypesValidator;
|
||||
import org.hibernate.query.sqm.produce.function.FunctionParameterType;
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.sql.ast.SqlAstTranslator;
|
||||
import org.hibernate.sql.ast.spi.SqlAppender;
|
||||
import org.hibernate.sql.ast.tree.SqlAstNode;
|
||||
|
|
|
@ -17,8 +17,7 @@ import org.hibernate.mapping.Table;
|
|||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
||||
import org.hibernate.metamodel.mapping.SqlExpressable;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.sqm.sql.internal.DomainResultProducer;
|
||||
import org.hibernate.sql.ast.SqlAstTranslator;
|
||||
import org.hibernate.sql.ast.SqlAstWalker;
|
||||
|
@ -33,7 +32,6 @@ import org.hibernate.sql.results.graph.DomainResult;
|
|||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||
import org.hibernate.sql.results.internal.SqlSelectionImpl;
|
||||
import org.hibernate.type.descriptor.ValueExtractor;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ package org.hibernate.query.sqm.function;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||
import org.hibernate.metamodel.MappingMetamodel;
|
||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.function;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.spi.QueryEngine;
|
||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
|
|
|
@ -23,40 +23,26 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
import jakarta.persistence.Tuple;
|
||||
import jakarta.persistence.criteria.CollectionJoin;
|
||||
import jakarta.persistence.criteria.CriteriaQuery;
|
||||
import jakarta.persistence.criteria.Expression;
|
||||
import jakarta.persistence.criteria.Join;
|
||||
import jakarta.persistence.criteria.ListJoin;
|
||||
import jakarta.persistence.criteria.MapJoin;
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import jakarta.persistence.criteria.Selection;
|
||||
import jakarta.persistence.criteria.SetJoin;
|
||||
import jakarta.persistence.criteria.Subquery;
|
||||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.SessionFactoryRegistry;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.query.SetOperator;
|
||||
import org.hibernate.query.SortOrder;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.metamodel.model.domain.DomainType;
|
||||
import org.hibernate.metamodel.model.domain.JpaMetamodel;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.BinaryArithmeticOperator;
|
||||
import org.hibernate.query.ComparisonOperator;
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.query.SetOperator;
|
||||
import org.hibernate.query.SortOrder;
|
||||
import org.hibernate.query.TrimSpec;
|
||||
import org.hibernate.query.UnaryArithmeticOperator;
|
||||
import org.hibernate.query.criteria.JpaCoalesce;
|
||||
|
@ -131,8 +117,22 @@ import org.hibernate.service.ServiceRegistry;
|
|||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
import jakarta.persistence.Tuple;
|
||||
import jakarta.persistence.criteria.CollectionJoin;
|
||||
import jakarta.persistence.criteria.CriteriaQuery;
|
||||
import jakarta.persistence.criteria.Expression;
|
||||
import jakarta.persistence.criteria.Join;
|
||||
import jakarta.persistence.criteria.ListJoin;
|
||||
import jakarta.persistence.criteria.MapJoin;
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import jakarta.persistence.criteria.Selection;
|
||||
import jakarta.persistence.criteria.SetJoin;
|
||||
import jakarta.persistence.criteria.Subquery;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.hibernate.query.internal.QueryHelper.highestPrecedenceType;
|
||||
|
||||
|
@ -436,37 +436,33 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
|||
}
|
||||
|
||||
@Override
|
||||
public <R> SqmTuple<R> tuple(Class<R> tupleType, JpaExpression<?>... expressions) {
|
||||
//noinspection unchecked
|
||||
return tuple( tupleType, (List<SqmExpression<?>>) (List<?>) asList( expressions ) );
|
||||
public <R> SqmTuple<R> tuple(Class<R> tupleType, SqmExpression<?>... expressions) {
|
||||
return tuple( tupleType, asList( expressions ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R> SqmTuple<R> tuple(Class<R> tupleType, List<? extends JpaExpression<?>> expressions) {
|
||||
public <R> SqmTuple<R> tuple(Class<R> tupleType, List<? extends SqmExpression<?>> expressions) {
|
||||
final TypeConfiguration typeConfiguration = getTypeConfiguration();
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<SqmExpression<?>> sqmExpressions = (List<SqmExpression<?>>) (List<?>) expressions;
|
||||
final DomainType<R> domainType;
|
||||
final List<SqmExpression<?>> sqmExpressions = (List<SqmExpression<?>>) expressions;
|
||||
final SqmExpressable<R> expressableType;
|
||||
if ( tupleType == null || tupleType == Object[].class ) {
|
||||
//noinspection unchecked
|
||||
domainType = (DomainType<R>) typeConfiguration.resolveTupleType( sqmExpressions );
|
||||
expressableType = (DomainType<R>) typeConfiguration.resolveTupleType( sqmExpressions );
|
||||
}
|
||||
else {
|
||||
domainType = typeConfiguration.getSessionFactory().getMetamodel().embeddable( tupleType );
|
||||
expressableType = typeConfiguration.getSessionFactory().getMetamodel().embeddable( tupleType );
|
||||
}
|
||||
return tuple( domainType, sqmExpressions );
|
||||
return tuple( expressableType, sqmExpressions );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R> SqmTuple<R> tuple(DomainType<R> tupleType, JpaExpression<?>... expressions) {
|
||||
//noinspection unchecked
|
||||
return tuple( tupleType, (List<SqmExpression<?>>) (List<?>) asList( expressions ) );
|
||||
public <R> SqmTuple<R> tuple(SqmExpressable<R> tupleType, SqmExpression<?>... expressions) {
|
||||
return tuple( tupleType, asList( expressions ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R> SqmTuple<R> tuple(DomainType<R> tupleType, List<? extends JpaExpression<?>> expressions) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<SqmExpression<?>> sqmExpressions = (List<SqmExpression<?>>) (List<?>) expressions;
|
||||
public <R> SqmTuple<R> tuple(SqmExpressable<R> tupleType, List<? extends SqmExpression<?>> sqmExpressions) {
|
||||
if ( tupleType == null ) {
|
||||
//noinspection unchecked
|
||||
tupleType = (DomainType<R>) getTypeConfiguration().resolveTupleType( sqmExpressions );
|
||||
|
@ -921,11 +917,14 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
|||
return new SqmLiteralNull<>( this );
|
||||
}
|
||||
|
||||
return new SqmLiteral<>(
|
||||
value,
|
||||
queryEngine.getTypeConfiguration().getSessionFactory().resolveParameterBindType( value ),
|
||||
this
|
||||
);
|
||||
final AllowableParameterType<T> valueParamType = queryEngine.getTypeConfiguration()
|
||||
.getSessionFactory()
|
||||
.resolveParameterBindType( value );
|
||||
final SqmExpressable<T> sqmExpressable = valueParamType == null
|
||||
? null
|
||||
: valueParamType.resolveExpressable( getTypeConfiguration().getSessionFactory() );
|
||||
|
||||
return new SqmLiteral<>( value, sqmExpressable, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -970,7 +969,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
|||
return new SqmLiteralNull<>( sqmExpressable, this );
|
||||
}
|
||||
|
||||
class MultiValueParameterType<T> implements AllowableParameterType<T> {
|
||||
class MultiValueParameterType<T> implements SqmExpressable<T> {
|
||||
private final JavaType<T> javaTypeDescriptor;
|
||||
|
||||
public MultiValueParameterType(Class<T> type) {
|
||||
|
@ -986,12 +985,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
|||
}
|
||||
|
||||
@Override
|
||||
public PersistenceType getPersistenceType() {
|
||||
return PersistenceType.BASIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> getJavaType() {
|
||||
public Class<T> getBindableJavaType() {
|
||||
return javaTypeDescriptor.getJavaTypeClass();
|
||||
}
|
||||
}
|
||||
|
@ -1049,7 +1043,6 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public SqmExpression<String> concat(Expression<String> x, String y) {
|
||||
final SqmExpression<String> xSqmExpression = (SqmExpression<String>) x;
|
||||
final SqmExpression<String> ySqmExpression = value( y, xSqmExpression );
|
||||
|
@ -1063,7 +1056,6 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public SqmExpression<String> concat(String x, Expression<String> y) {
|
||||
final SqmExpression<String> ySqmExpression = (SqmExpression<String>) y;
|
||||
final SqmExpression<String> xSqmExpression = value( x, ySqmExpression );
|
||||
|
@ -1077,7 +1069,6 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public SqmExpression<String> concat(String x, String y) {
|
||||
final SqmExpression<String> xSqmExpression = value( x );
|
||||
final SqmExpression<String> ySqmExpression = value( y, xSqmExpression );
|
||||
|
@ -1450,7 +1441,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext,
|
|||
return (AllowableParameterType<T>) typeInferenceSource;
|
||||
}
|
||||
|
||||
if ( typeInferenceSource.getNodeType() instanceof AllowableParameterType ) {
|
||||
if ( typeInferenceSource.getNodeType() != null ) {
|
||||
//noinspection unchecked
|
||||
return (AllowableParameterType<T>) typeInferenceSource.getNodeType();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
package org.hibernate.query.sqm.produce.function;
|
||||
|
||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
import org.hibernate.sql.ast.tree.SqlAstNode;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.hibernate.QueryException;
|
|||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
import org.hibernate.sql.ast.tree.SqlAstNode;
|
||||
|
|
|
@ -83,48 +83,29 @@ import org.hibernate.metamodel.mapping.internal.EntityCollectionPart;
|
|||
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
|
||||
import org.hibernate.metamodel.mapping.ordering.OrderByFragment;
|
||||
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
|
||||
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.metamodel.model.domain.PluralPersistentAttribute;
|
||||
import org.hibernate.metamodel.model.domain.internal.CompositeSqmPathSource;
|
||||
import org.hibernate.metamodel.model.domain.internal.DiscriminatorSqmPath;
|
||||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||
import org.hibernate.query.FetchClauseType;
|
||||
import org.hibernate.query.SortOrder;
|
||||
import org.hibernate.query.criteria.JpaPath;
|
||||
import org.hibernate.query.internal.QueryHelper;
|
||||
import org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression;
|
||||
import org.hibernate.query.sqm.produce.function.internal.PatternRenderer;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedRootJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelation;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPluralPartJoin;
|
||||
import org.hibernate.query.sqm.tree.expression.*;
|
||||
import org.hibernate.query.sqm.tree.insert.SqmInsertStatement;
|
||||
import org.hibernate.sql.ast.tree.expression.ModifiedSubQueryExpression;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmTreatedRoot;
|
||||
import org.hibernate.sql.ast.tree.expression.Over;
|
||||
import org.hibernate.sql.ast.tree.expression.SelfRenderingSqlFragmentExpression;
|
||||
import org.hibernate.sql.ast.tree.from.CorrelatedPluralTableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.NamedTableReference;
|
||||
import org.hibernate.sql.ast.tree.from.PluralTableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.QueryPartTableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.QueryPartTableReference;
|
||||
import org.hibernate.sql.ast.tree.from.TableReference;
|
||||
import org.hibernate.sql.exec.internal.VersionTypeSeedParameterSpecification;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.Joinable;
|
||||
import org.hibernate.query.AllowableFunctionReturnType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.BinaryArithmeticOperator;
|
||||
import org.hibernate.query.CastType;
|
||||
import org.hibernate.query.ComparisonOperator;
|
||||
import org.hibernate.query.DynamicInstantiationNature;
|
||||
import org.hibernate.query.FetchClauseType;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.query.QueryLogging;
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.SortOrder;
|
||||
import org.hibernate.query.TemporalUnit;
|
||||
import org.hibernate.query.UnaryArithmeticOperator;
|
||||
import org.hibernate.query.criteria.JpaPath;
|
||||
import org.hibernate.query.internal.QueryHelper;
|
||||
import org.hibernate.query.spi.QueryOptions;
|
||||
import org.hibernate.query.spi.QueryParameterBinding;
|
||||
import org.hibernate.query.spi.QueryParameterBindings;
|
||||
|
@ -135,8 +116,10 @@ import org.hibernate.query.sqm.SqmPathSource;
|
|||
import org.hibernate.query.sqm.SqmQuerySource;
|
||||
import org.hibernate.query.sqm.function.AbstractSqmSelfRenderingFunctionDescriptor;
|
||||
import org.hibernate.query.sqm.function.SelfRenderingAggregateFunctionSqlAstExpression;
|
||||
import org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression;
|
||||
import org.hibernate.query.sqm.internal.DomainParameterXref;
|
||||
import org.hibernate.query.sqm.internal.SqmMappingModelHelper;
|
||||
import org.hibernate.query.sqm.produce.function.internal.PatternRenderer;
|
||||
import org.hibernate.query.sqm.spi.BaseSemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.sql.internal.BasicValuedPathInterpretation;
|
||||
import org.hibernate.query.sqm.sql.internal.DiscriminatedAssociationPathInterpretation;
|
||||
|
@ -152,6 +135,7 @@ import org.hibernate.query.sqm.sql.internal.SqmMapEntryResult;
|
|||
import org.hibernate.query.sqm.sql.internal.SqmParameterInterpretation;
|
||||
import org.hibernate.query.sqm.sql.internal.SqmPathInterpretation;
|
||||
import org.hibernate.query.sqm.sql.internal.TypeHelper;
|
||||
import org.hibernate.query.sqm.tree.SqmJoinType;
|
||||
import org.hibernate.query.sqm.tree.SqmStatement;
|
||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||
import org.hibernate.query.sqm.tree.cte.SqmCteContainer;
|
||||
|
@ -164,6 +148,8 @@ import org.hibernate.query.sqm.tree.domain.AbstractSqmSpecificPluralPartPath;
|
|||
import org.hibernate.query.sqm.tree.domain.NonAggregatedCompositeSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmAnyValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelatedRootJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmCorrelation;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmEmbeddedValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmEntityValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmIndexedCollectionAccessPath;
|
||||
|
@ -171,8 +157,45 @@ import org.hibernate.query.sqm.tree.domain.SqmMapEntryReference;
|
|||
import org.hibernate.query.sqm.tree.domain.SqmElementAggregateFunction;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmIndexAggregateFunction;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPluralPartJoin;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmPluralValuedSimplePath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmTreatedPath;
|
||||
import org.hibernate.query.sqm.tree.domain.SqmTreatedRoot;
|
||||
import org.hibernate.query.sqm.tree.expression.Conversion;
|
||||
import org.hibernate.query.sqm.tree.expression.JpaCriteriaParameter;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmAliasedNodeRef;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmAny;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmBinaryArithmetic;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmByUnit;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmCaseSearched;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmCaseSimple;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmCastTarget;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmCollation;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmCollectionSize;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmDistinct;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmDurationUnit;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmEnumLiteral;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmEvery;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmExtractUnit;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmFieldLiteral;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmFormat;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmFunction;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmJpaCriteriaParameterWrapper;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmLiteral;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmLiteralEntityType;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmLiteralNull;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmModifiedSubQueryExpression;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmNamedParameter;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmParameterizedEntityType;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmPositionalParameter;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmStar;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmSummarization;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmToDuration;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmTrimSpecification;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmTuple;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmUnaryOperation;
|
||||
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmCrossJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmEntityJoin;
|
||||
|
@ -181,6 +204,7 @@ import org.hibernate.query.sqm.tree.from.SqmFromClause;
|
|||
import org.hibernate.query.sqm.tree.from.SqmJoin;
|
||||
import org.hibernate.query.sqm.tree.from.SqmRoot;
|
||||
import org.hibernate.query.sqm.tree.insert.SqmInsertSelectStatement;
|
||||
import org.hibernate.query.sqm.tree.insert.SqmInsertStatement;
|
||||
import org.hibernate.query.sqm.tree.insert.SqmInsertValuesStatement;
|
||||
import org.hibernate.query.sqm.tree.insert.SqmValues;
|
||||
import org.hibernate.query.sqm.tree.predicate.SqmAndPredicate;
|
||||
|
@ -256,19 +280,28 @@ import org.hibernate.sql.ast.tree.expression.ExtractUnit;
|
|||
import org.hibernate.sql.ast.tree.expression.Format;
|
||||
import org.hibernate.sql.ast.tree.expression.JdbcLiteral;
|
||||
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
|
||||
import org.hibernate.sql.ast.tree.expression.ModifiedSubQueryExpression;
|
||||
import org.hibernate.sql.ast.tree.expression.Over;
|
||||
import org.hibernate.sql.ast.tree.expression.QueryLiteral;
|
||||
import org.hibernate.sql.ast.tree.expression.SelfRenderingExpression;
|
||||
import org.hibernate.sql.ast.tree.expression.SelfRenderingSqlFragmentExpression;
|
||||
import org.hibernate.sql.ast.tree.expression.SqlSelectionExpression;
|
||||
import org.hibernate.sql.ast.tree.expression.SqlTuple;
|
||||
import org.hibernate.sql.ast.tree.expression.Star;
|
||||
import org.hibernate.sql.ast.tree.expression.Summarization;
|
||||
import org.hibernate.sql.ast.tree.expression.TrimSpecification;
|
||||
import org.hibernate.sql.ast.tree.expression.UnaryOperation;
|
||||
import org.hibernate.sql.ast.tree.from.CorrelatedPluralTableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.CorrelatedTableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.LazyTableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.NamedTableReference;
|
||||
import org.hibernate.sql.ast.tree.from.PluralTableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.QueryPartTableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.QueryPartTableReference;
|
||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.TableGroupJoin;
|
||||
import org.hibernate.sql.ast.tree.from.TableGroupJoinProducer;
|
||||
import org.hibernate.sql.ast.tree.from.TableReference;
|
||||
import org.hibernate.sql.ast.tree.from.VirtualTableGroup;
|
||||
import org.hibernate.sql.ast.tree.insert.InsertStatement;
|
||||
import org.hibernate.sql.ast.tree.insert.Values;
|
||||
|
@ -297,6 +330,7 @@ import org.hibernate.sql.ast.tree.update.Assignment;
|
|||
import org.hibernate.sql.ast.tree.update.UpdateStatement;
|
||||
import org.hibernate.sql.exec.internal.JdbcParameterImpl;
|
||||
import org.hibernate.sql.exec.internal.JdbcParametersImpl;
|
||||
import org.hibernate.sql.exec.internal.VersionTypeSeedParameterSpecification;
|
||||
import org.hibernate.sql.exec.spi.ExecutionContext;
|
||||
import org.hibernate.sql.exec.spi.JdbcParameterBindings;
|
||||
import org.hibernate.sql.exec.spi.JdbcParameters;
|
||||
|
@ -4350,24 +4384,26 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
}
|
||||
}
|
||||
|
||||
AllowableParameterType<?> parameterSqmType = binding.getBindType();
|
||||
if ( parameterSqmType == null ) {
|
||||
parameterSqmType = queryParameter.getHibernateType();
|
||||
if ( parameterSqmType == null ) {
|
||||
parameterSqmType = sqmParameter.getAnticipatedType();
|
||||
AllowableParameterType<?> paramType = binding.getBindType();
|
||||
if ( paramType == null ) {
|
||||
paramType = queryParameter.getHibernateType();
|
||||
if ( paramType == null ) {
|
||||
paramType = sqmParameter.getAnticipatedType();
|
||||
}
|
||||
}
|
||||
|
||||
if ( parameterSqmType == null ) {
|
||||
if ( paramType == null ) {
|
||||
// Default to the Object type
|
||||
return basicType( Object.class );
|
||||
}
|
||||
else if ( parameterSqmType instanceof MappingModelExpressable<?> && parameterSqmType.getJavaType() == Object.class ) {
|
||||
return (MappingModelExpressable<?>) parameterSqmType;
|
||||
else if ( paramType instanceof MappingModelExpressable<?> && paramType.getBindableJavaType() == Object.class ) {
|
||||
return (MappingModelExpressable<?>) paramType;
|
||||
}
|
||||
|
||||
if ( parameterSqmType instanceof SqmPath ) {
|
||||
final SqmPath<?> sqmPath = (SqmPath<?>) parameterSqmType;
|
||||
final SqmExpressable<?> paramSqmType = paramType.resolveExpressable( creationContext.getSessionFactory() );
|
||||
|
||||
if ( paramSqmType instanceof SqmPath ) {
|
||||
final SqmPath<?> sqmPath = (SqmPath<?>) paramSqmType;
|
||||
final NavigablePath navigablePath = sqmPath.getNavigablePath();
|
||||
if ( navigablePath.getParent() != null ) {
|
||||
final TableGroup tableGroup = getFromClauseAccess().getTableGroup( navigablePath.getParent() );
|
||||
|
@ -4380,11 +4416,11 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
return getFromClauseAccess().getTableGroup( navigablePath ).getModelPart();
|
||||
}
|
||||
|
||||
if ( parameterSqmType instanceof BasicValuedMapping ) {
|
||||
return (BasicValuedMapping) parameterSqmType;
|
||||
if ( paramSqmType instanceof BasicValuedMapping ) {
|
||||
return (BasicValuedMapping) paramSqmType;
|
||||
}
|
||||
|
||||
if ( parameterSqmType instanceof CompositeSqmPathSource ) {
|
||||
if ( paramSqmType instanceof CompositeSqmPathSource ) {
|
||||
// Try to infer the value mapping since the other side apparently is a path source
|
||||
final MappingModelExpressable<?> inferredValueMapping = getInferredValueMapping();
|
||||
if ( inferredValueMapping != null ) {
|
||||
|
@ -4393,15 +4429,14 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
throw new NotYetImplementedFor6Exception( "Support for embedded-valued parameters not yet implemented" );
|
||||
}
|
||||
|
||||
if ( parameterSqmType instanceof SqmPathSource<?> || parameterSqmType instanceof BasicDomainType<?> ) {
|
||||
if ( paramSqmType instanceof SqmPathSource<?> || paramSqmType instanceof BasicDomainType<?> ) {
|
||||
// Try to infer the value mapping since the other side apparently is a path source
|
||||
final MappingModelExpressable<?> inferredValueMapping = getInferredValueMapping();
|
||||
if ( inferredValueMapping != null ) {
|
||||
return inferredValueMapping;
|
||||
}
|
||||
return getTypeConfiguration().getBasicTypeForJavaType(
|
||||
( (SqmExpressable<?>) parameterSqmType ).getExpressableJavaTypeDescriptor()
|
||||
.getJavaTypeClass()
|
||||
paramSqmType.getExpressableJavaTypeDescriptor().getJavaTypeClass()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4838,7 +4873,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
.findFunctionDescriptor( "timestampdiff" );
|
||||
}
|
||||
|
||||
private <T> T cleanly(Supplier<T> supplier) {
|
||||
private <X> X cleanly(Supplier<X> supplier) {
|
||||
SqmByUnit byUnit = appliedByUnit;
|
||||
Expression timestamp = adjustedTimestamp;
|
||||
SqmExpressable<?> timestampType = adjustedTimestampType;
|
||||
|
|
|
@ -9,42 +9,44 @@ package org.hibernate.query.sqm.sql.internal;
|
|||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.metamodel.mapping.DiscriminatedAssociationModelPart;
|
||||
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
||||
import org.hibernate.metamodel.mapping.EntityValuedModelPart;
|
||||
import org.hibernate.metamodel.mapping.MappingModelExpressable;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.spi.QueryParameterBinding;
|
||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.tree.expression.SqmParameter;
|
||||
import org.hibernate.sql.ast.SqlAstWalker;
|
||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||
import org.hibernate.sql.ast.tree.expression.Expression;
|
||||
import org.hibernate.sql.ast.tree.expression.SqlTuple;
|
||||
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
|
||||
import org.hibernate.sql.ast.tree.expression.SqlTuple;
|
||||
import org.hibernate.sql.ast.tree.expression.SqlTupleContainer;
|
||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||
import org.hibernate.sql.results.graph.DomainResult;
|
||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||
import org.hibernate.sql.results.graph.basic.BasicResult;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class SqmParameterInterpretation implements Expression, DomainResultProducer, SqlTupleContainer {
|
||||
private final SqmParameter sqmParameter;
|
||||
private final SqmParameter<?> sqmParameter;
|
||||
private final QueryParameterImplementor<?> queryParameter;
|
||||
private final MappingModelExpressable valueMapping;
|
||||
private final Function<QueryParameterImplementor, QueryParameterBinding> queryParameterBindingResolver;
|
||||
private final MappingModelExpressable<?> valueMapping;
|
||||
private final Function<QueryParameterImplementor<?>, QueryParameterBinding<?>> queryParameterBindingResolver;
|
||||
|
||||
private final Expression resolvedExpression;
|
||||
|
||||
public SqmParameterInterpretation(
|
||||
SqmParameter sqmParameter,
|
||||
SqmParameter<?> sqmParameter,
|
||||
QueryParameterImplementor<?> queryParameter,
|
||||
List<JdbcParameter> jdbcParameters,
|
||||
MappingModelExpressable valueMapping,
|
||||
Function<QueryParameterImplementor, QueryParameterBinding> queryParameterBindingResolver) {
|
||||
MappingModelExpressable<?> valueMapping,
|
||||
Function<QueryParameterImplementor<?>, QueryParameterBinding<?>> queryParameterBindingResolver) {
|
||||
this.sqmParameter = sqmParameter;
|
||||
this.queryParameter = queryParameter;
|
||||
this.queryParameterBindingResolver = queryParameterBindingResolver;
|
||||
|
@ -62,7 +64,7 @@ public class SqmParameterInterpretation implements Expression, DomainResultProdu
|
|||
this.resolvedExpression = determineResolvedExpression( jdbcParameters, this.valueMapping );
|
||||
}
|
||||
|
||||
private Expression determineResolvedExpression(List<JdbcParameter> jdbcParameters, MappingModelExpressable valueMapping) {
|
||||
private Expression determineResolvedExpression(List<JdbcParameter> jdbcParameters, MappingModelExpressable<?> valueMapping) {
|
||||
if ( valueMapping instanceof EmbeddableValuedModelPart
|
||||
|| valueMapping instanceof DiscriminatedAssociationModelPart ) {
|
||||
return new SqlTuple( jdbcParameters, valueMapping );
|
||||
|
@ -82,38 +84,39 @@ public class SqmParameterInterpretation implements Expression, DomainResultProdu
|
|||
}
|
||||
|
||||
@Override
|
||||
public MappingModelExpressable getExpressionType() {
|
||||
public MappingModelExpressable<?> getExpressionType() {
|
||||
return valueMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainResult createDomainResult(
|
||||
public DomainResult<?> createDomainResult(
|
||||
String resultVariable,
|
||||
DomainResultCreationState creationState) {
|
||||
if ( resolvedExpression instanceof SqlTuple ) {
|
||||
throw new SemanticException( "Composite query parameter cannot be used in select" );
|
||||
}
|
||||
|
||||
AllowableParameterType nodeType = sqmParameter.getNodeType();
|
||||
AllowableParameterType<?> nodeType = sqmParameter.getNodeType();
|
||||
if ( nodeType == null ) {
|
||||
final QueryParameterBinding<?> binding = queryParameterBindingResolver.apply( queryParameter );
|
||||
nodeType = binding.getBindType();
|
||||
}
|
||||
final SessionFactoryImplementor sessionFactory = creationState.getSqlAstCreationState()
|
||||
.getCreationContext()
|
||||
.getSessionFactory();
|
||||
|
||||
final SqmExpressable<?> sqmExpressable = nodeType.resolveExpressable( sessionFactory );
|
||||
|
||||
final SqlSelection sqlSelection = creationState.getSqlAstCreationState().getSqlExpressionResolver().resolveSqlSelection(
|
||||
resolvedExpression,
|
||||
nodeType.getExpressableJavaTypeDescriptor(),
|
||||
creationState.getSqlAstCreationState()
|
||||
.getCreationContext()
|
||||
.getSessionFactory()
|
||||
.getTypeConfiguration()
|
||||
sqmExpressable.getExpressableJavaTypeDescriptor(),
|
||||
sessionFactory.getTypeConfiguration()
|
||||
);
|
||||
|
||||
//noinspection unchecked
|
||||
return new BasicResult(
|
||||
return new BasicResult<>(
|
||||
sqlSelection.getValuesArrayPosition(),
|
||||
resultVariable,
|
||||
nodeType.getExpressableJavaTypeDescriptor()
|
||||
sqmExpressable.getExpressableJavaTypeDescriptor()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -134,19 +137,22 @@ public class SqmParameterInterpretation implements Expression, DomainResultProdu
|
|||
throw new SemanticException( "Composite query parameter cannot be used in select" );
|
||||
}
|
||||
|
||||
AllowableParameterType nodeType = sqmParameter.getNodeType();
|
||||
AllowableParameterType<?> nodeType = sqmParameter.getNodeType();
|
||||
if ( nodeType == null ) {
|
||||
final QueryParameterBinding<?> binding = queryParameterBindingResolver.apply( queryParameter );
|
||||
nodeType = binding.getBindType();
|
||||
}
|
||||
|
||||
final SessionFactoryImplementor sessionFactory = creationState.getSqlAstCreationState()
|
||||
.getCreationContext()
|
||||
.getSessionFactory();
|
||||
|
||||
final SqmExpressable<?> sqmExpressable = nodeType.resolveExpressable( sessionFactory );
|
||||
|
||||
return creationState.getSqlAstCreationState().getSqlExpressionResolver().resolveSqlSelection(
|
||||
resolvedExpression,
|
||||
nodeType.getExpressableJavaTypeDescriptor(),
|
||||
creationState.getSqlAstCreationState()
|
||||
.getCreationContext()
|
||||
.getSessionFactory()
|
||||
.getTypeConfiguration()
|
||||
sqmExpressable.getExpressableJavaTypeDescriptor(),
|
||||
sessionFactory.getTypeConfiguration()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.tree.domain;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.query.PathException;
|
||||
import org.hibernate.query.SemanticException;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.type.descriptor.java.BasicJavaType;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
|
@ -23,7 +24,7 @@ import org.hibernate.type.descriptor.java.JavaType;
|
|||
*/
|
||||
public class SqmBasicValuedSimplePath<T>
|
||||
extends AbstractSqmSimplePath<T>
|
||||
implements AllowableParameterType<T> {
|
||||
implements AllowableParameterType<T>, SqmExpressable<T> {
|
||||
public SqmBasicValuedSimplePath(
|
||||
NavigablePath navigablePath,
|
||||
SqmPathSource<T> referencedPathSource,
|
||||
|
@ -86,19 +87,19 @@ public class SqmBasicValuedSimplePath<T>
|
|||
throw new UnsupportedOperationException( "Basic-value cannot be treated (downcast)" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> getJavaType() {
|
||||
return getJavaTypeDescriptor().getJavaTypeClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaType<T> getExpressableJavaTypeDescriptor() {
|
||||
return getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceType getPersistenceType() {
|
||||
return PersistenceType.BASIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> getJavaType() {
|
||||
return getJavaTypeDescriptor().getJavaTypeClass();
|
||||
public Class<T> getBindableJavaType() {
|
||||
return getJavaType();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,23 +6,24 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.tree.domain;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.query.PathException;
|
||||
import org.hibernate.query.hql.spi.SemanticPathPart;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.UnknownPathException;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class SqmEmbeddedValuedSimplePath<T> extends AbstractSqmSimplePath<T> implements AllowableParameterType<T> {
|
||||
public class SqmEmbeddedValuedSimplePath<T>
|
||||
extends AbstractSqmSimplePath<T>
|
||||
implements AllowableParameterType<T>, SqmExpressable<T> {
|
||||
public SqmEmbeddedValuedSimplePath(
|
||||
NavigablePath navigablePath,
|
||||
SqmPathSource<T> referencedPathSource,
|
||||
|
@ -76,21 +77,15 @@ public class SqmEmbeddedValuedSimplePath<T> extends AbstractSqmSimplePath<T> imp
|
|||
return getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceType getPersistenceType() {
|
||||
return PersistenceType.EMBEDDABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> getJavaType() {
|
||||
return getJavaTypeDescriptor().getJavaTypeClass();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public DomainResult createDomainResult(
|
||||
// String resultVariable,
|
||||
// DomainResultCreationState creationState,
|
||||
// DomainResultCreationContext creationContext) {
|
||||
// return new CompositeResultImpl( getNavigablePath(), getReferencedNavigable(), resultVariable, creationState );
|
||||
// }
|
||||
@Override
|
||||
public Class<T> getBindableJavaType() {
|
||||
return getJavaType();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,11 +9,10 @@ package org.hibernate.query.sqm.tree.domain;
|
|||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.query.NavigablePath;
|
||||
import org.hibernate.query.PathException;
|
||||
import org.hibernate.query.hql.spi.SemanticPathPart;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.hql.spi.SqmCreationState;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SemanticQueryWalker;
|
||||
import org.hibernate.query.sqm.SqmPathSource;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
|
|
@ -11,8 +11,6 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import jakarta.persistence.criteria.Expression;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
|
||||
import org.hibernate.query.criteria.JpaSelection;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
|
@ -21,6 +19,9 @@ import org.hibernate.query.sqm.SqmExpressable;
|
|||
import org.hibernate.query.sqm.tree.select.SqmSelectableNode;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
|
||||
import jakarta.persistence.criteria.Expression;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
|
||||
|
||||
/**
|
||||
* Represents the reference to a Map attribute's {@link Map.Entry} entries
|
||||
|
@ -45,8 +46,7 @@ public class SqmMapEntryReference<K,V>
|
|||
this.mapPath = mapPath;
|
||||
this.nodeBuilder = nodeBuilder;
|
||||
|
||||
//noinspection unchecked
|
||||
this.mapEntryTypeDescriptor = (JavaType) nodeBuilder.getDomainModel()
|
||||
this.mapEntryTypeDescriptor = nodeBuilder.getDomainModel()
|
||||
.getTypeConfiguration()
|
||||
.getJavaTypeDescriptorRegistry()
|
||||
.getDescriptor( Map.Entry.class );
|
||||
|
@ -107,6 +107,11 @@ public class SqmMapEntryReference<K,V>
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Map.Entry<K, V>> getBindableJavaType() {
|
||||
return getNodeType().getBindableJavaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeBuilder nodeBuilder() {
|
||||
return nodeBuilder;
|
||||
|
@ -156,5 +161,4 @@ public class SqmMapEntryReference<K,V>
|
|||
public <X> Expression<X> as(Class<X> type) {
|
||||
throw new UnsupportedOperationException( "Whatever JPA" );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
package org.hibernate.query.sqm.tree.expression;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.PluralPersistentAttribute;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.internal.QueryHelper;
|
||||
import org.hibernate.query.sqm.NodeBuilder;
|
||||
import org.hibernate.query.sqm.SqmExpressable;
|
||||
|
@ -22,7 +22,7 @@ public abstract class AbstractSqmParameter<T> extends AbstractSqmExpression<T> i
|
|||
|
||||
public AbstractSqmParameter(
|
||||
boolean canBeMultiValued,
|
||||
AllowableParameterType<T> inherentType,
|
||||
SqmExpressable<T> inherentType,
|
||||
NodeBuilder nodeBuilder) {
|
||||
super( inherentType, nodeBuilder );
|
||||
this.canBeMultiValued = canBeMultiValued;
|
||||
|
@ -36,7 +36,7 @@ public abstract class AbstractSqmParameter<T> extends AbstractSqmExpression<T> i
|
|||
else if ( type instanceof PluralPersistentAttribute<?, ?, ?> ) {
|
||||
type = ( (PluralPersistentAttribute<?, ?, ?>) type ).getElementType();
|
||||
}
|
||||
final SqmExpressable<?> oldType = getNodeType();
|
||||
final SqmExpressable<T> oldType = getNodeType();
|
||||
|
||||
final SqmExpressable<?> newType = QueryHelper.highestPrecedenceType( oldType, type );
|
||||
if ( newType != null && newType != oldType ) {
|
||||
|
@ -59,11 +59,6 @@ public abstract class AbstractSqmParameter<T> extends AbstractSqmExpression<T> i
|
|||
return canBeMultiValued;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AllowableParameterType<T> getNodeType() {
|
||||
return (AllowableParameterType<T>) super.getNodeType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AllowableParameterType<T> getAnticipatedType() {
|
||||
return this.getNodeType();
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
package org.hibernate.query.sqm.tree.expression;
|
||||
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||
import org.hibernate.query.AllowableParameterType;
|
||||
import org.hibernate.query.ParameterMetadata;
|
||||
import org.hibernate.query.criteria.JpaParameterExpression;
|
||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||
|
@ -48,7 +48,7 @@ public class JpaCriteriaParameter<T>
|
|||
AllowableParameterType<T> type,
|
||||
boolean allowsMultiValuedBinding,
|
||||
NodeBuilder nodeBuilder) {
|
||||
super( type, nodeBuilder );
|
||||
super( toSqmType( type, nodeBuilder ), nodeBuilder );
|
||||
this.name = name;
|
||||
this.value = null;
|
||||
this.allowsMultiValuedBinding = allowsMultiValuedBinding;
|
||||
|
@ -60,14 +60,23 @@ public class JpaCriteriaParameter<T>
|
|||
T value,
|
||||
boolean allowsMultiValuedBinding,
|
||||
NodeBuilder nodeBuilder) {
|
||||
super( type, nodeBuilder );
|
||||
super( toSqmType( type, nodeBuilder ), nodeBuilder );
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.allowsMultiValuedBinding = allowsMultiValuedBinding;
|
||||
}
|
||||
|
||||
public JpaCriteriaParameter(AllowableParameterType<T> type, T value, NodeBuilder criteriaBuilder) {
|
||||
super( type, criteriaBuilder );
|
||||
private static <T> SqmExpressable<T> toSqmType(AllowableParameterType<T> type, NodeBuilder nodeBuilder) {
|
||||
if ( type == null ) {
|
||||
return null;
|
||||
}
|
||||
return type.resolveExpressable(
|
||||
nodeBuilder.getQueryEngine().getTypeConfiguration().getSessionFactory()
|
||||
);
|
||||
}
|
||||
|
||||
public JpaCriteriaParameter(AllowableParameterType<T> type, T value, NodeBuilder nodeBuilder) {
|
||||
super( toSqmType( type, nodeBuilder ), nodeBuilder );
|
||||
this.name = null;
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -107,14 +116,10 @@ public class JpaCriteriaParameter<T>
|
|||
return getHibernateType();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void applyAnticipatedType(AllowableParameterType type) {
|
||||
super.internalApplyInferableType( type );
|
||||
}
|
||||
|
||||
@Override
|
||||
public AllowableParameterType<T> getNodeType() {
|
||||
return (AllowableParameterType<T>) super.getNodeType();
|
||||
super.internalApplyInferableType( toSqmType( type, nodeBuilder() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue