6 - SQM based on JPA type system
This commit is contained in:
parent
e551311eaa
commit
fa754a77e2
|
@ -10,7 +10,7 @@ package org.hibernate.query;
|
||||||
import javax.persistence.ParameterMode;
|
import javax.persistence.ParameterMode;
|
||||||
|
|
||||||
import org.hibernate.Incubating;
|
import org.hibernate.Incubating;
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableParameterType;
|
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a parameter defined in the source (HQL/JPQL or criteria) query.
|
* Represents a parameter defined in the source (HQL/JPQL or criteria) query.
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
import org.hibernate.graph.spi.GraphImplementor;
|
import org.hibernate.graph.spi.GraphImplementor;
|
||||||
import org.hibernate.internal.util.collections.Stack;
|
import org.hibernate.internal.util.collections.Stack;
|
||||||
import org.hibernate.internal.util.collections.StandardStack;
|
import org.hibernate.internal.util.collections.StandardStack;
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableParameterType;
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.EmbeddedValuedNavigable;
|
import org.hibernate.metamodel.model.mapping.spi.EmbeddedValuedNavigable;
|
||||||
import org.hibernate.metamodel.model.mapping.EntityTypeDescriptor;
|
import org.hibernate.metamodel.model.mapping.EntityTypeDescriptor;
|
||||||
import org.hibernate.metamodel.model.mapping.spi.NavigableContainer;
|
import org.hibernate.metamodel.model.mapping.spi.NavigableContainer;
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class SqmCreationHelper {
|
||||||
public static void resolveAsLhs(
|
public static void resolveAsLhs(
|
||||||
SqmPath lhs,
|
SqmPath lhs,
|
||||||
SqmPath processingPath,
|
SqmPath processingPath,
|
||||||
SqmPathSource<?,?> subNavigable,
|
SqmPathSource<?> subNavigable,
|
||||||
boolean isSubRefTerminal,
|
boolean isSubRefTerminal,
|
||||||
SqmCreationState creationState) {
|
SqmCreationState creationState) {
|
||||||
SqmTreeCreationLogger.LOGGER.tracef(
|
SqmTreeCreationLogger.LOGGER.tracef(
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.hibernate.query.sqm.produce.function;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.hibernate.query.sqm.produce.function;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
import org.hibernate.query.sqm.produce.function.internal.SelfRenderingSqmFunction;
|
import org.hibernate.query.sqm.produce.function.internal.SelfRenderingSqmFunction;
|
||||||
import org.hibernate.query.sqm.produce.function.spi.AbstractSqmFunctionTemplate;
|
import org.hibernate.query.sqm.produce.function.spi.AbstractSqmFunctionTemplate;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.produce.function;
|
package org.hibernate.query.sqm.produce.function;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.sqm.produce.function.spi.NamedSqmFunctionTemplate;
|
import org.hibernate.query.sqm.produce.function.spi.NamedSqmFunctionTemplate;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.produce.function;
|
package org.hibernate.query.sqm.produce.function;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.sqm.produce.function.internal.PatternRenderer;
|
import org.hibernate.query.sqm.produce.function.internal.PatternRenderer;
|
||||||
import org.hibernate.query.sqm.produce.function.spi.PatternBasedSqmFunctionTemplate;
|
import org.hibernate.query.sqm.produce.function.spi.PatternBasedSqmFunctionTemplate;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.query.sqm.produce.function;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ import java.sql.Types;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
|
||||||
import org.hibernate.QueryException;
|
import org.hibernate.QueryException;
|
||||||
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -107,7 +107,7 @@ public class StandardFunctionReturnTypeResolvers {
|
||||||
|
|
||||||
private static AllowableFunctionReturnType extractArgumentType(List<SqmTypedNode<?>> arguments, int position) {
|
private static AllowableFunctionReturnType extractArgumentType(List<SqmTypedNode<?>> arguments, int position) {
|
||||||
final SqmTypedNode specifiedArgument = arguments.get( position-1 );
|
final SqmTypedNode specifiedArgument = arguments.get( position-1 );
|
||||||
final ExpressableType specifiedArgType = specifiedArgument.getNodeType();
|
final SqmExpressable specifiedArgType = specifiedArgument.getNodeType();
|
||||||
if ( !(specifiedArgType instanceof AllowableFunctionReturnType) ) {
|
if ( !(specifiedArgType instanceof AllowableFunctionReturnType) ) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
String.format(
|
String.format(
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.produce.function;
|
package org.hibernate.query.sqm.produce.function;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.sqm.produce.function.spi.FunctionAsExpressionTemplate;
|
import org.hibernate.query.sqm.produce.function.spi.FunctionAsExpressionTemplate;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.produce.function.internal;
|
package org.hibernate.query.sqm.produce.function.internal;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
import org.hibernate.query.sqm.produce.function.spi.SelfRenderingFunctionSupport;
|
import org.hibernate.query.sqm.produce.function.spi.SelfRenderingFunctionSupport;
|
||||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.hibernate.query.sqm.produce.function.spi;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||||
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
||||||
|
|
|
@ -8,7 +8,7 @@ package org.hibernate.query.sqm.produce.function.spi;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||||
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
||||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.query.sqm.produce.function.spi;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||||
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
package org.hibernate.query.sqm.produce.function.spi;
|
package org.hibernate.query.sqm.produce.function.spi;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||||
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.produce.function.spi;
|
package org.hibernate.query.sqm.produce.function.spi;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
import org.hibernate.query.sqm.produce.function.SqmFunctionTemplate;
|
import org.hibernate.query.sqm.produce.function.SqmFunctionTemplate;
|
||||||
import org.hibernate.query.sqm.produce.function.StandardArgumentsValidators;
|
import org.hibernate.query.sqm.produce.function.StandardArgumentsValidators;
|
||||||
|
@ -35,7 +35,8 @@ public class PairedFunctionTemplate extends AbstractSqmFunctionTemplate {
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
String name,
|
String name,
|
||||||
AllowableFunctionReturnType type,
|
AllowableFunctionReturnType type,
|
||||||
String pattern2, String pattern3) {
|
String pattern2,
|
||||||
|
String pattern3) {
|
||||||
queryEngine.getSqmFunctionRegistry().register(
|
queryEngine.getSqmFunctionRegistry().register(
|
||||||
name,
|
name,
|
||||||
new PairedFunctionTemplate(
|
new PairedFunctionTemplate(
|
||||||
|
@ -53,6 +54,7 @@ public class PairedFunctionTemplate extends AbstractSqmFunctionTemplate {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<SqmTypedNode<?>> arguments,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
package org.hibernate.query.sqm.produce.function.spi;
|
package org.hibernate.query.sqm.produce.function.spi;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.spi.QueryEngine;
|
import org.hibernate.query.spi.QueryEngine;
|
||||||
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
import org.hibernate.query.sqm.produce.function.ArgumentsValidator;
|
||||||
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
import org.hibernate.query.sqm.produce.function.FunctionReturnTypeResolver;
|
||||||
|
|
|
@ -13,6 +13,7 @@ import javax.persistence.criteria.Expression;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.BasicValuedNavigable;
|
import org.hibernate.metamodel.model.mapping.spi.BasicValuedNavigable;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.produce.path.spi.SemanticPathPart;
|
import org.hibernate.query.sqm.produce.path.spi.SemanticPathPart;
|
||||||
import org.hibernate.query.sqm.produce.spi.SqmCreationState;
|
import org.hibernate.query.sqm.produce.spi.SqmCreationState;
|
||||||
|
@ -22,7 +23,6 @@ import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmLiteral;
|
import org.hibernate.query.sqm.tree.expression.SqmLiteral;
|
||||||
import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
|
import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.BasicValuedExpressableType;
|
import org.hibernate.sql.ast.produce.metamodel.spi.BasicValuedExpressableType;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
import org.hibernate.type.descriptor.java.spi.EnumJavaDescriptor;
|
import org.hibernate.type.descriptor.java.spi.EnumJavaDescriptor;
|
||||||
import org.hibernate.type.spi.StandardSpiBasicTypes;
|
import org.hibernate.type.spi.StandardSpiBasicTypes;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class SqmStaticEnumReference<T extends Enum<T>>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalApplyInferableType(ExpressableType<?> newType) {
|
protected void internalApplyInferableType(SqmExpressable<?> newType) {
|
||||||
//noinspection StatementWithEmptyBody
|
//noinspection StatementWithEmptyBody
|
||||||
if ( newType instanceof BasicValuedNavigable ) {
|
if ( newType instanceof BasicValuedNavigable ) {
|
||||||
final BasicValuedNavigable basicValuedNavigable = (BasicValuedNavigable) newType;
|
final BasicValuedNavigable basicValuedNavigable = (BasicValuedNavigable) newType;
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.math.BigInteger;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.BasicValuedNavigable;
|
import org.hibernate.metamodel.model.mapping.spi.BasicValuedNavigable;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.produce.SqmProductionException;
|
import org.hibernate.query.sqm.produce.SqmProductionException;
|
||||||
import org.hibernate.query.sqm.produce.path.spi.SemanticPathPart;
|
import org.hibernate.query.sqm.produce.path.spi.SemanticPathPart;
|
||||||
|
@ -21,7 +22,6 @@ import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmLiteral;
|
import org.hibernate.query.sqm.tree.expression.SqmLiteral;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.BasicValuedExpressableType;
|
import org.hibernate.sql.ast.produce.metamodel.spi.BasicValuedExpressableType;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
import org.hibernate.type.descriptor.java.spi.BasicJavaDescriptor;
|
import org.hibernate.type.descriptor.java.spi.BasicJavaDescriptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,7 +78,7 @@ public class SqmStaticFieldReference<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalApplyInferableType(ExpressableType<?> newType) {
|
protected void internalApplyInferableType(SqmExpressable<?> newType) {
|
||||||
//noinspection StatementWithEmptyBody
|
//noinspection StatementWithEmptyBody
|
||||||
if ( newType instanceof BasicValuedNavigable ) {
|
if ( newType instanceof BasicValuedNavigable ) {
|
||||||
// basic valued navigable may have a ValueConverter associated
|
// basic valued navigable may have a ValueConverter associated
|
||||||
|
|
|
@ -45,7 +45,7 @@ public abstract class AbstractSqmAttributeJoin<O,T>
|
||||||
@SuppressWarnings("WeakerAccess")
|
@SuppressWarnings("WeakerAccess")
|
||||||
public AbstractSqmAttributeJoin(
|
public AbstractSqmAttributeJoin(
|
||||||
SqmFrom<?,O> lhs,
|
SqmFrom<?,O> lhs,
|
||||||
SqmJoinable<O,T> joinedNavigable,
|
SqmJoinable joinedNavigable,
|
||||||
String alias,
|
String alias,
|
||||||
SqmJoinType joinType,
|
SqmJoinType joinType,
|
||||||
boolean fetched,
|
boolean fetched,
|
||||||
|
|
|
@ -60,7 +60,7 @@ public interface SqmPath<T> extends SqmExpression<T>, SemanticPathPart, JpaPath<
|
||||||
SqmPathSource<T> getNodeType();
|
SqmPathSource<T> getNodeType();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void applyInferableType(SqmExpressable<T> type) {
|
default void applyInferableType(SqmExpressable<?> type) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.produce.SqmTreeCreationLogger;
|
import org.hibernate.query.sqm.produce.SqmTreeCreationLogger;
|
||||||
import org.hibernate.query.sqm.tree.jpa.AbstractJpaSelection;
|
import org.hibernate.query.sqm.tree.jpa.AbstractJpaSelection;
|
||||||
import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
|
import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
|
||||||
|
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||||
|
|
||||||
import static org.hibernate.query.internal.QueryHelper.highestPrecedenceType;
|
import static org.hibernate.query.internal.QueryHelper.highestPrecedenceType;
|
||||||
|
|
||||||
|
@ -130,4 +131,9 @@ public abstract class AbstractSqmExpression<T> extends AbstractJpaSelection<T> i
|
||||||
setAlias( name );
|
setAlias( name );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JavaTypeDescriptor<T> getJavaTypeDescriptor() {
|
||||||
|
return getNodeType().getExpressableJavaTypeDescriptor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.tree.expression;
|
package org.hibernate.query.sqm.tree.expression;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableParameterType;
|
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,7 +9,7 @@ package org.hibernate.query.sqm.tree.expression;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptor;
|
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
|
|
@ -9,9 +9,9 @@ package org.hibernate.query.sqm.tree.expression;
|
||||||
import org.hibernate.metamodel.spi.MetamodelImplementor;
|
import org.hibernate.metamodel.spi.MetamodelImplementor;
|
||||||
import org.hibernate.query.BinaryArithmeticOperator;
|
import org.hibernate.query.BinaryArithmeticOperator;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.BasicValuedExpressableType;
|
import org.hibernate.sql.ast.produce.metamodel.spi.BasicValuedExpressableType;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -29,7 +29,7 @@ public class SqmBinaryArithmetic<T> extends AbstractSqmExpression<T> {
|
||||||
NodeBuilder nodeBuilder) {
|
NodeBuilder nodeBuilder) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
super(
|
super(
|
||||||
(ExpressableType<T>) domainModel.getTypeConfiguration().resolveArithmeticType(
|
(SqmExpressable<T>) domainModel.getTypeConfiguration().resolveArithmeticType(
|
||||||
(BasicValuedExpressableType) lhsOperand.getNodeType(),
|
(BasicValuedExpressableType) lhsOperand.getNodeType(),
|
||||||
(BasicValuedExpressableType) rhsOperand.getNodeType(),
|
(BasicValuedExpressableType) rhsOperand.getNodeType(),
|
||||||
operator
|
operator
|
||||||
|
@ -99,7 +99,7 @@ public class SqmBinaryArithmetic<T> extends AbstractSqmExpression<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalApplyInferableType(ExpressableType<?> type) {
|
protected void internalApplyInferableType(SqmExpressable<?> type) {
|
||||||
rhsOperand.applyInferableType( type );
|
rhsOperand.applyInferableType( type );
|
||||||
lhsOperand.applyInferableType( type );
|
lhsOperand.applyInferableType( type );
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,9 @@ import javax.persistence.criteria.Expression;
|
||||||
import org.hibernate.query.criteria.JpaExpression;
|
import org.hibernate.query.criteria.JpaExpression;
|
||||||
import org.hibernate.query.criteria.JpaSearchedCase;
|
import org.hibernate.query.criteria.JpaSearchedCase;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
|
import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.BasicValuedExpressableType;
|
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -53,7 +52,7 @@ public class SqmCaseSearched<R> extends AbstractSqmExpression<R> implements JpaS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalApplyInferableType(ExpressableType<?> newType) {
|
protected void internalApplyInferableType(SqmExpressable<?> newType) {
|
||||||
super.internalApplyInferableType( newType );
|
super.internalApplyInferableType( newType );
|
||||||
|
|
||||||
if ( otherwise != null ) {
|
if ( otherwise != null ) {
|
||||||
|
|
|
@ -6,14 +6,13 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.tree.expression;
|
package org.hibernate.query.sqm.tree.expression;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableParameterType;
|
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||||
import org.hibernate.query.ParameterMetadata;
|
import org.hibernate.query.ParameterMetadata;
|
||||||
import org.hibernate.query.named.spi.ParameterMemento;
|
import org.hibernate.query.named.spi.ParameterMemento;
|
||||||
import org.hibernate.query.spi.QueryParameterImplementor;
|
import org.hibernate.query.spi.QueryParameterImplementor;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SqmParameter created via JPA {@link javax.persistence.criteria.CriteriaBuilder}
|
* SqmParameter created via JPA {@link javax.persistence.criteria.CriteriaBuilder}
|
||||||
|
@ -102,15 +101,10 @@ public class SqmCriteriaParameter<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void internalApplyInferableType(ExpressableType<?> newType) {
|
protected void internalApplyInferableType(SqmExpressable<?> newType) {
|
||||||
super.internalApplyInferableType( newType );
|
super.internalApplyInferableType( newType );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public JavaTypeDescriptor<T> getJavaTypeDescriptor() {
|
|
||||||
return this.getNodeType().getJavaTypeDescriptor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <X> X accept(SemanticQueryWalker<X> walker) {
|
public <X> X accept(SemanticQueryWalker<X> walker) {
|
||||||
return walker.visitCriteriaParameter( this );
|
return walker.visitCriteriaParameter( this );
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.tree.expression;
|
package org.hibernate.query.sqm.tree.expression;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableParameterType;
|
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.tree.expression;
|
package org.hibernate.query.sqm.tree.expression;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableParameterType;
|
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||||
import org.hibernate.query.criteria.JpaParameterExpression;
|
import org.hibernate.query.criteria.JpaParameterExpression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,13 +7,12 @@
|
||||||
package org.hibernate.query.sqm.tree.expression;
|
package org.hibernate.query.sqm.tree.expression;
|
||||||
|
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.EntityValuedExpressableType;
|
import org.hibernate.sql.ast.produce.metamodel.spi.EntityValuedExpressableType;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
import org.hibernate.sql.results.spi.DomainResult;
|
import org.hibernate.sql.results.spi.DomainResult;
|
||||||
import org.hibernate.sql.results.spi.DomainResultCreationState;
|
import org.hibernate.sql.results.spi.DomainResultCreationState;
|
||||||
import org.hibernate.sql.results.spi.DomainResultProducer;
|
import org.hibernate.sql.results.spi.DomainResultProducer;
|
||||||
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity type expression based on a parameter - `TYPE( :someParam )`
|
* Entity type expression based on a parameter - `TYPE( :someParam )`
|
||||||
|
@ -35,7 +34,7 @@ public class SqmParameterizedEntityType<T> extends AbstractSqmExpression<T> impl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void internalApplyInferableType(ExpressableType<?> type) {
|
public void internalApplyInferableType(SqmExpressable<?> type) {
|
||||||
setExpressableType( type );
|
setExpressableType( type );
|
||||||
|
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
|
@ -60,8 +59,4 @@ public class SqmParameterizedEntityType<T> extends AbstractSqmExpression<T> impl
|
||||||
// todo (6.0) : but could be ^^ - consider adding support for this (returning Class)
|
// todo (6.0) : but could be ^^ - consider adding support for this (returning Class)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public JavaTypeDescriptor<T> getJavaTypeDescriptor() {
|
|
||||||
return getNodeType().getJavaTypeDescriptor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.tree.expression;
|
package org.hibernate.query.sqm.tree.expression;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableParameterType;
|
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
package org.hibernate.query.sqm.tree.expression;
|
package org.hibernate.query.sqm.tree.expression;
|
||||||
|
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.tree.select.SqmSubQuery;
|
import org.hibernate.query.sqm.tree.select.SqmSubQuery;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a {@link Modifier#ALL}, {@link Modifier#ANY}, {@link Modifier#SOME} modifier appplied to a subquery as
|
* Represents a {@link Modifier#ALL}, {@link Modifier#ANY}, {@link Modifier#SOME} modifier appplied to a subquery as
|
||||||
|
@ -42,7 +42,7 @@ public class SqmRestrictedSubQueryExpression<T> extends AbstractSqmExpression<T>
|
||||||
public SqmRestrictedSubQueryExpression(
|
public SqmRestrictedSubQueryExpression(
|
||||||
SqmSubQuery<T> subQuery,
|
SqmSubQuery<T> subQuery,
|
||||||
Modifier modifier,
|
Modifier modifier,
|
||||||
ExpressableType<T> resultType,
|
SqmExpressable<T> resultType,
|
||||||
NodeBuilder builder) {
|
NodeBuilder builder) {
|
||||||
super( resultType, builder );
|
super( resultType, builder );
|
||||||
this.subQuery = subQuery;
|
this.subQuery = subQuery;
|
||||||
|
|
|
@ -13,10 +13,9 @@ import org.hibernate.QueryException;
|
||||||
import org.hibernate.query.criteria.JpaCompoundSelection;
|
import org.hibernate.query.criteria.JpaCompoundSelection;
|
||||||
import org.hibernate.query.criteria.JpaSelection;
|
import org.hibernate.query.criteria.JpaSelection;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||||
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptor;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Models a tuple of values, generally defined as a series of values
|
* Models a tuple of values, generally defined as a series of values
|
||||||
|
@ -37,7 +36,7 @@ public class SqmTuple<T> extends AbstractSqmExpression<T> implements JpaCompound
|
||||||
this( Arrays.asList( groupedExpressions ), nodeBuilder );
|
this( Arrays.asList( groupedExpressions ), nodeBuilder );
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqmTuple(NodeBuilder nodeBuilder, ExpressableType<T> type, SqmExpression<?>... groupedExpressions) {
|
public SqmTuple(NodeBuilder nodeBuilder, SqmExpressable<T> type, SqmExpression<?>... groupedExpressions) {
|
||||||
this( Arrays.asList( groupedExpressions ), nodeBuilder );
|
this( Arrays.asList( groupedExpressions ), nodeBuilder );
|
||||||
applyInferableType( type );
|
applyInferableType( type );
|
||||||
}
|
}
|
||||||
|
@ -50,21 +49,21 @@ public class SqmTuple<T> extends AbstractSqmExpression<T> implements JpaCompound
|
||||||
this.groupedExpressions = groupedExpressions;
|
this.groupedExpressions = groupedExpressions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqmTuple(List<SqmExpression<?>> groupedExpressions, ExpressableType<T> type, NodeBuilder nodeBuilder) {
|
public SqmTuple(List<SqmExpression<?>> groupedExpressions, SqmExpressable<T> type, NodeBuilder nodeBuilder) {
|
||||||
this( groupedExpressions, nodeBuilder );
|
this( groupedExpressions, nodeBuilder );
|
||||||
applyInferableType( type );
|
applyInferableType( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExpressableType<T> getNodeType() {
|
public SqmExpressable<T> getNodeType() {
|
||||||
final ExpressableType<T> expressableType = super.getNodeType();
|
final SqmExpressable<T> expressableType = super.getNodeType();
|
||||||
if ( expressableType != null ) {
|
if ( expressableType != null ) {
|
||||||
return expressableType;
|
return expressableType;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( SqmExpression groupedExpression : groupedExpressions ) {
|
for ( SqmExpression groupedExpression : groupedExpressions ) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
final ExpressableType<T> groupedExpressionExpressableType = groupedExpression.getNodeType();
|
final SqmExpressable<T> groupedExpressionExpressableType = groupedExpression.getNodeType();
|
||||||
if ( groupedExpressionExpressableType != null ) {
|
if ( groupedExpressionExpressableType != null ) {
|
||||||
return groupedExpressionExpressableType;
|
return groupedExpressionExpressableType;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +84,7 @@ public class SqmTuple<T> extends AbstractSqmExpression<T> implements JpaCompound
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JavaTypeDescriptor<T> getJavaTypeDescriptor() {
|
public JavaTypeDescriptor<T> getJavaTypeDescriptor() {
|
||||||
return getNodeType().getJavaTypeDescriptor();
|
return getNodeType().getExpressableJavaTypeDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.tree.expression.function;
|
package org.hibernate.query.sqm.tree.expression.function;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.tree.AbstractSqmNode;
|
import org.hibernate.query.sqm.tree.AbstractSqmNode;
|
||||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||||
import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
|
@ -35,7 +35,7 @@ public class SqmCastTarget<T> extends AbstractSqmNode implements SqmTypedNode<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExpressableType getNodeType() {
|
public SqmExpressable<T> getNodeType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.criteria.Expression;
|
import javax.persistence.criteria.Expression;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.criteria.JpaCoalesce;
|
import org.hibernate.query.criteria.JpaCoalesce;
|
||||||
import org.hibernate.query.criteria.JpaExpression;
|
import org.hibernate.query.criteria.JpaExpression;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
@ -19,7 +19,6 @@ import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.produce.function.SqmFunctionTemplate;
|
import org.hibernate.query.sqm.produce.function.SqmFunctionTemplate;
|
||||||
import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression;
|
import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||||
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -39,15 +38,6 @@ public class SqmCoalesce<T> extends AbstractSqmExpression<T> implements JpaCoale
|
||||||
coalesceFunction = nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionTemplate("coalesce");
|
coalesceFunction = nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionTemplate("coalesce");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public JavaTypeDescriptor<T> getJavaTypeDescriptor() {
|
|
||||||
if ( getNodeType() == null ) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getNodeType().getExpressableJavaTypeDescriptor();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void value(SqmExpression<? extends T> expression) {
|
public void value(SqmExpression<? extends T> expression) {
|
||||||
arguments.add( expression );
|
arguments.add( expression );
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
package org.hibernate.query.sqm.tree.expression.function;
|
package org.hibernate.query.sqm.tree.expression.function;
|
||||||
|
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.tree.AbstractSqmNode;
|
import org.hibernate.query.sqm.tree.AbstractSqmNode;
|
||||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||||
import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
||||||
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
|
@ -31,7 +31,7 @@ public class SqmDistinct<T> extends AbstractSqmNode implements SqmTypedNode<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExpressableType<T> getNodeType() {
|
public SqmExpressable<T> getNodeType() {
|
||||||
return expression.getNodeType();
|
return expression.getNodeType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.query.sqm.tree.expression.function;
|
package org.hibernate.query.sqm.tree.expression.function;
|
||||||
|
|
||||||
import org.hibernate.metamodel.model.mapping.spi.AllowableFunctionReturnType;
|
import org.hibernate.metamodel.model.domain.AllowableFunctionReturnType;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.tree.AbstractSqmNode;
|
import org.hibernate.query.sqm.tree.AbstractSqmNode;
|
||||||
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
import org.hibernate.query.sqm.tree.SqmTypedNode;
|
||||||
import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
|
@ -41,7 +41,7 @@ public class SqmExtractUnit<T> extends AbstractSqmNode implements SqmTypedNode<T
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExpressableType getNodeType() {
|
public SqmExpressable<T> getNodeType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@ import java.util.List;
|
||||||
import org.hibernate.query.criteria.JpaCompoundSelection;
|
import org.hibernate.query.criteria.JpaCompoundSelection;
|
||||||
import org.hibernate.query.criteria.JpaSelection;
|
import org.hibernate.query.criteria.JpaSelection;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression;
|
import org.hibernate.query.sqm.tree.expression.AbstractSqmExpression;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||||
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @asciidoctor
|
* @asciidoctor
|
||||||
|
@ -26,7 +26,7 @@ import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptor;
|
||||||
*/
|
*/
|
||||||
public class SqmJpaCompoundSelection<T>
|
public class SqmJpaCompoundSelection<T>
|
||||||
extends AbstractSqmExpression<T>
|
extends AbstractSqmExpression<T>
|
||||||
implements JpaCompoundSelection<T>, ExpressableType<T> {
|
implements JpaCompoundSelection<T>, SqmExpressable<T> {
|
||||||
private final List<SqmSelectableNode<?>> selectableNodes;
|
private final List<SqmSelectableNode<?>> selectableNodes;
|
||||||
private final JavaTypeDescriptor<T> javaTypeDescriptor;
|
private final JavaTypeDescriptor<T> javaTypeDescriptor;
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,10 @@ import javax.persistence.criteria.Selection;
|
||||||
import javax.persistence.criteria.SetJoin;
|
import javax.persistence.criteria.SetJoin;
|
||||||
|
|
||||||
import org.hibernate.NotYetImplementedFor6Exception;
|
import org.hibernate.NotYetImplementedFor6Exception;
|
||||||
import org.hibernate.metamodel.model.domain.DomainType;
|
|
||||||
import org.hibernate.query.criteria.JpaSelection;
|
import org.hibernate.query.criteria.JpaSelection;
|
||||||
import org.hibernate.query.criteria.JpaSubQuery;
|
import org.hibernate.query.criteria.JpaSubQuery;
|
||||||
import org.hibernate.query.sqm.NodeBuilder;
|
import org.hibernate.query.sqm.NodeBuilder;
|
||||||
|
import org.hibernate.query.sqm.SqmExpressable;
|
||||||
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
import org.hibernate.query.sqm.consume.spi.SemanticQueryWalker;
|
||||||
import org.hibernate.query.sqm.tree.SqmQuery;
|
import org.hibernate.query.sqm.tree.SqmQuery;
|
||||||
import org.hibernate.query.sqm.tree.domain.SqmBagJoin;
|
import org.hibernate.query.sqm.tree.domain.SqmBagJoin;
|
||||||
|
@ -37,8 +37,7 @@ import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||||
import org.hibernate.query.sqm.tree.from.SqmRoot;
|
import org.hibernate.query.sqm.tree.from.SqmRoot;
|
||||||
import org.hibernate.query.sqm.tree.predicate.SqmInPredicate;
|
import org.hibernate.query.sqm.tree.predicate.SqmInPredicate;
|
||||||
import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
|
import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
|
||||||
import org.hibernate.sql.ast.produce.metamodel.spi.ExpressableType;
|
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||||
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptor;
|
|
||||||
import org.hibernate.type.spi.StandardSpiBasicTypes;
|
import org.hibernate.type.spi.StandardSpiBasicTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +46,7 @@ import org.hibernate.type.spi.StandardSpiBasicTypes;
|
||||||
public class SqmSubQuery<T> extends AbstractSqmSelectQuery<T> implements SqmSelectQuery<T>, JpaSubQuery<T>, SqmExpression<T> {
|
public class SqmSubQuery<T> extends AbstractSqmSelectQuery<T> implements SqmSelectQuery<T>, JpaSubQuery<T>, SqmExpression<T> {
|
||||||
private final SqmQuery<?> parent;
|
private final SqmQuery<?> parent;
|
||||||
|
|
||||||
private ExpressableType<T> expressableType;
|
private SqmExpressable<T> expressableType;
|
||||||
private String alias;
|
private String alias;
|
||||||
|
|
||||||
public SqmSubQuery(
|
public SqmSubQuery(
|
||||||
|
@ -226,15 +225,15 @@ public class SqmSubQuery<T> extends AbstractSqmSelectQuery<T> implements SqmSele
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExpressableType<T> getNodeType() {
|
public SqmExpressable<T> getNodeType() {
|
||||||
return expressableType;
|
return expressableType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyInferableType(DomainType<T> type) {
|
public void applyInferableType(SqmExpressable<?> type) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
this.expressableType = (ExpressableType<T>) type;
|
this.expressableType = (SqmExpressable) type;
|
||||||
setResultType( type == null ? null : type.getJavaType() );
|
setResultType( type == null ? null : type.getExpressableJavaTypeDescriptor().getJavaType() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -282,7 +281,7 @@ public class SqmSubQuery<T> extends AbstractSqmSelectQuery<T> implements SqmSele
|
||||||
if ( getNodeType() == null ) {
|
if ( getNodeType() == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return getNodeType().getJavaTypeDescriptor();
|
return getNodeType().getExpressableJavaTypeDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue