Improve SemanticQueryBuilder performance and fix a few generics related issues
This commit is contained in:
parent
e93f43a43f
commit
4ee71faecf
|
@ -37,7 +37,7 @@ public class CastStrEmulation
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class CoalesceIfnullEmulation
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
|
|
@ -1479,7 +1479,7 @@ public class CommonFunctionFactory {
|
||||||
queryEngine.getSqmFunctionRegistry().namedAggregateDescriptorBuilder("sum")
|
queryEngine.getSqmFunctionRegistry().namedAggregateDescriptorBuilder("sum")
|
||||||
.setReturnTypeResolver( new FunctionReturnTypeResolver() {
|
.setReturnTypeResolver( new FunctionReturnTypeResolver() {
|
||||||
@Override
|
@Override
|
||||||
public AllowableFunctionReturnType<?> resolveFunctionReturnType(AllowableFunctionReturnType<?> impliedType, List<SqmTypedNode<?>> arguments, TypeConfiguration typeConfiguration) {
|
public AllowableFunctionReturnType<?> resolveFunctionReturnType(AllowableFunctionReturnType<?> impliedType, List<? extends SqmTypedNode<?>> arguments, TypeConfiguration typeConfiguration) {
|
||||||
final AllowableFunctionReturnType<?> argType = StandardFunctionReturnTypeResolvers.extractArgumentType(
|
final AllowableFunctionReturnType<?> argType = StandardFunctionReturnTypeResolvers.extractArgumentType(
|
||||||
arguments,
|
arguments,
|
||||||
1
|
1
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class ExtractFunction
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class InsertSubstringOverlayEmulation
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class LocatePositionEmulation
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class LpadRpadPadEmulation
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class NvlCoalesceEmulation
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
|
|
@ -21,16 +21,16 @@ import org.hibernate.query.sqm.SqmPathSource;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface PluralPersistentAttribute<D,C,E>
|
public interface PluralPersistentAttribute<D, C, E>
|
||||||
extends PersistentAttribute<D,C>, SqmPathSource<E>, SqmJoinable, PluralAttribute<D,C,E> {
|
extends PersistentAttribute<D, C>, SqmPathSource<E>, SqmJoinable, PluralAttribute<D, C, E> {
|
||||||
@Override
|
@Override
|
||||||
ManagedDomainType<D> getDeclaringType();
|
ManagedDomainType<D> getDeclaringType();
|
||||||
|
|
||||||
CollectionClassification getCollectionClassification();
|
CollectionClassification getCollectionClassification();
|
||||||
|
|
||||||
SqmPathSource getElementPathSource();
|
SqmPathSource<E> getElementPathSource();
|
||||||
|
|
||||||
default SqmPathSource getIndexPathSource() {
|
default SqmPathSource<?> getIndexPathSource() {
|
||||||
throw new NotIndexedCollectionException(
|
throw new NotIndexedCollectionException(
|
||||||
"Plural attribute [" + getPathName() + "] is not indexed (list / map)"
|
"Plural attribute [" + getPathName() + "] is not indexed (list / map)"
|
||||||
);
|
);
|
||||||
|
@ -42,7 +42,7 @@ public interface PluralPersistentAttribute<D,C,E>
|
||||||
@Override
|
@Override
|
||||||
SimpleDomainType<E> getValueGraphType();
|
SimpleDomainType<E> getValueGraphType();
|
||||||
|
|
||||||
default SimpleDomainType<E> getKeyGraphType() {
|
default SimpleDomainType<?> getKeyGraphType() {
|
||||||
throw new NotIndexedCollectionException(
|
throw new NotIndexedCollectionException(
|
||||||
"Plural attribute [" + getPathName() + "] is not indexed (list / map)"
|
"Plural attribute [" + getPathName() + "] is not indexed (list / map)"
|
||||||
);
|
);
|
||||||
|
|
|
@ -29,9 +29,9 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractPluralAttribute<D,C,E>
|
public abstract class AbstractPluralAttribute<D, C, E>
|
||||||
extends AbstractAttribute<D,C,E>
|
extends AbstractAttribute<D, C, E>
|
||||||
implements PluralPersistentAttribute<D,C,E>, Serializable {
|
implements PluralPersistentAttribute<D, C, E>, Serializable {
|
||||||
|
|
||||||
private final CollectionClassification classification;
|
private final CollectionClassification classification;
|
||||||
private final SqmPathSource<E> elementPathSource;
|
private final SqmPathSource<E> elementPathSource;
|
||||||
|
@ -101,7 +101,7 @@ public abstract class AbstractPluralAttribute<D,C,E>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SimpleDomainType getKeyGraphType() {
|
public SimpleDomainType<?> getKeyGraphType() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class ListAttributeImpl<X, E> extends AbstractPluralAttribute<X, List<E>, E> imp
|
||||||
super( builder, metadataContext );
|
super( builder, metadataContext );
|
||||||
|
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
this.indexPathSource = (SqmPathSource) SqmMappingModelHelper.resolveSqmKeyPathSource(
|
this.indexPathSource = (SqmPathSource<Integer>) SqmMappingModelHelper.resolveSqmKeyPathSource(
|
||||||
getName(),
|
getName(),
|
||||||
builder.getListIndexOrMapKeyType(),
|
builder.getListIndexOrMapKeyType(),
|
||||||
BindableType.PLURAL_ATTRIBUTE
|
BindableType.PLURAL_ATTRIBUTE
|
||||||
|
|
|
@ -47,12 +47,12 @@ class MapAttributeImpl<X, K, V> extends AbstractPluralAttribute<X, Map<K, V>, V>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmPathSource getKeyPathSource() {
|
public SqmPathSource<K> getKeyPathSource() {
|
||||||
return keyPathSource;
|
return keyPathSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmPathSource getIndexPathSource() {
|
public SqmPathSource<K> getIndexPathSource() {
|
||||||
return getKeyPathSource();
|
return getKeyPathSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class MapAttributeImpl<X, K, V> extends AbstractPluralAttribute<X, Map<K, V>, V>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SimpleDomainType getKeyGraphType() {
|
public SimpleDomainType<K> getKeyGraphType() {
|
||||||
return getKeyType();
|
return getKeyType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ public interface HibernateCriteriaBuilder extends CriteriaBuilder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<T> JpaExpression<T> literal(T value);
|
<T> JpaExpression<T> literal(T value);
|
||||||
<T> SqmExpression<T> literal(T value, SqmExpression<T> typeInferenceSource);
|
<T> SqmExpression<T> literal(T value, SqmExpression<? extends T> typeInferenceSource);
|
||||||
|
|
||||||
<T> List<? extends JpaExpression<T>> literals(T[] values);
|
<T> List<? extends JpaExpression<T>> literals(T[] values);
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ public interface HibernateCriteriaBuilder extends CriteriaBuilder {
|
||||||
|
|
||||||
<T> SqmExpression<T> value(T value);
|
<T> SqmExpression<T> value(T value);
|
||||||
|
|
||||||
<T> SqmExpression<T> value(T value, SqmExpression<T> typeInferenceSource);
|
<T> SqmExpression<T> value(T value, SqmExpression<? extends T> typeInferenceSource);
|
||||||
|
|
||||||
<V, C extends Collection<V>> JpaExpression<Collection<V>> values(C collection);
|
<V, C extends Collection<V>> JpaExpression<Collection<V>> values(C collection);
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -80,13 +80,13 @@ public abstract class AbstractSqmFunctionDescriptor implements SqmFunctionDescri
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<SqlAstNode> resolveSqlAstArguments(List<SqmTypedNode<?>> sqmArguments, SqmToSqlAstConverter walker) {
|
public static List<SqlAstNode> resolveSqlAstArguments(List<? extends SqmTypedNode<?>> sqmArguments, SqmToSqlAstConverter walker) {
|
||||||
if ( sqmArguments == null || sqmArguments.isEmpty() ) {
|
if ( sqmArguments == null || sqmArguments.isEmpty() ) {
|
||||||
return emptyList();
|
return emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList<SqlAstNode> sqlAstArguments = new ArrayList<>();
|
final ArrayList<SqlAstNode> sqlAstArguments = new ArrayList<>();
|
||||||
for ( SqmTypedNode sqmArgument : sqmArguments ) {
|
for ( SqmTypedNode<?> sqmArgument : sqmArguments ) {
|
||||||
sqlAstArguments.add( toSqlAstNode( ((SqmVisitableNode) sqmArgument).accept( walker ), walker ) );
|
sqlAstArguments.add( toSqlAstNode( ((SqmVisitableNode) sqmArgument).accept( walker ), walker ) );
|
||||||
}
|
}
|
||||||
return sqlAstArguments;
|
return sqlAstArguments;
|
||||||
|
@ -94,7 +94,7 @@ public abstract class AbstractSqmFunctionDescriptor implements SqmFunctionDescri
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final <T> SelfRenderingSqmFunction<T> generateSqmExpression(
|
public final <T> SelfRenderingSqmFunction<T> generateSqmExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
@ -110,7 +110,7 @@ public abstract class AbstractSqmFunctionDescriptor implements SqmFunctionDescri
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final <T> SelfRenderingSqmFunction<T> generateAggregateSqmExpression(
|
public final <T> SelfRenderingSqmFunction<T> generateAggregateSqmExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
SqmPredicate filter,
|
SqmPredicate filter,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
|
@ -135,7 +135,7 @@ public abstract class AbstractSqmFunctionDescriptor implements SqmFunctionDescri
|
||||||
* @param impliedResultType the function return type as inferred from its usage
|
* @param impliedResultType the function return type as inferred from its usage
|
||||||
*/
|
*/
|
||||||
protected abstract <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected abstract <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration);
|
TypeConfiguration typeConfiguration);
|
||||||
|
@ -149,7 +149,7 @@ public abstract class AbstractSqmFunctionDescriptor implements SqmFunctionDescri
|
||||||
* @param impliedResultType the function return type as inferred from its usage
|
* @param impliedResultType the function return type as inferred from its usage
|
||||||
*/
|
*/
|
||||||
protected <T> SelfRenderingSqmAggregateFunction<T> generateSqmAggregateFunctionExpression(
|
protected <T> SelfRenderingSqmAggregateFunction<T> generateSqmAggregateFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
SqmPredicate filter,
|
SqmPredicate filter,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
|
|
|
@ -40,7 +40,7 @@ public abstract class AbstractSqmSelfRenderingFunctionDescriptor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
@ -60,7 +60,7 @@ public abstract class AbstractSqmSelfRenderingFunctionDescriptor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> SelfRenderingSqmAggregateFunction<T> generateSqmAggregateFunctionExpression(
|
public <T> SelfRenderingSqmAggregateFunction<T> generateSqmAggregateFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
SqmPredicate filter,
|
SqmPredicate filter,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class JdbcEscapeFunctionDescriptor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class MultipatternSqmFunctionDescriptor extends AbstractSqmFunctionDescri
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class SelfRenderingSqmAggregateFunction<T> extends SelfRenderingSqmFuncti
|
||||||
public SelfRenderingSqmAggregateFunction(
|
public SelfRenderingSqmAggregateFunction(
|
||||||
SqmFunctionDescriptor descriptor,
|
SqmFunctionDescriptor descriptor,
|
||||||
FunctionRenderingSupport renderingSupport,
|
FunctionRenderingSupport renderingSupport,
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
SqmPredicate filter,
|
SqmPredicate filter,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
FunctionReturnTypeResolver returnTypeResolver,
|
FunctionReturnTypeResolver returnTypeResolver,
|
||||||
|
@ -57,7 +57,7 @@ public class SelfRenderingSqmAggregateFunction<T> extends SelfRenderingSqmFuncti
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendHqlString(StringBuilder sb) {
|
public void appendHqlString(StringBuilder sb) {
|
||||||
final List<SqmTypedNode<?>> arguments = getArguments();
|
final List<? extends SqmTypedNode<?>> arguments = getArguments();
|
||||||
sb.append( getFunctionName() );
|
sb.append( getFunctionName() );
|
||||||
sb.append( '(' );
|
sb.append( '(' );
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SelfRenderingSqmFunction<T> extends SqmFunction<T> {
|
||||||
public SelfRenderingSqmFunction(
|
public SelfRenderingSqmFunction(
|
||||||
SqmFunctionDescriptor descriptor,
|
SqmFunctionDescriptor descriptor,
|
||||||
FunctionRenderingSupport renderingSupport,
|
FunctionRenderingSupport renderingSupport,
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
FunctionReturnTypeResolver returnTypeResolver,
|
FunctionReturnTypeResolver returnTypeResolver,
|
||||||
NodeBuilder nodeBuilder,
|
NodeBuilder nodeBuilder,
|
||||||
|
@ -55,7 +55,7 @@ public class SelfRenderingSqmFunction<T> extends SqmFunction<T> {
|
||||||
return renderingSupport;
|
return renderingSupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static List<SqlAstNode> resolveSqlAstArguments(List<SqmTypedNode<?>> sqmArguments, SqmToSqlAstConverter walker) {
|
protected static List<SqlAstNode> resolveSqlAstArguments(List<? extends SqmTypedNode<?>> sqmArguments, SqmToSqlAstConverter walker) {
|
||||||
if ( sqmArguments == null || sqmArguments.isEmpty() ) {
|
if ( sqmArguments == null || sqmArguments.isEmpty() ) {
|
||||||
return emptyList();
|
return emptyList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public interface SqmFunctionDescriptor {
|
||||||
* portable between databases.
|
* portable between databases.
|
||||||
*/
|
*/
|
||||||
<T> SelfRenderingSqmFunction<T> generateSqmExpression(
|
<T> SelfRenderingSqmFunction<T> generateSqmExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
TypeConfiguration typeConfiguration);
|
TypeConfiguration typeConfiguration);
|
||||||
|
@ -51,7 +51,7 @@ public interface SqmFunctionDescriptor {
|
||||||
* but also accepts a filter predicate. This method is intended for aggregate functions.
|
* but also accepts a filter predicate. This method is intended for aggregate functions.
|
||||||
*/
|
*/
|
||||||
default <T> SelfRenderingSqmFunction<T> generateAggregateSqmExpression(
|
default <T> SelfRenderingSqmFunction<T> generateAggregateSqmExpression(
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
SqmPredicate filter,
|
SqmPredicate filter,
|
||||||
AllowableFunctionReturnType<T> impliedResultType,
|
AllowableFunctionReturnType<T> impliedResultType,
|
||||||
QueryEngine queryEngine,
|
QueryEngine queryEngine,
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class ConcreteSqmSelectQueryPlan<R> implements SelectQueryPlan<R> {
|
||||||
|
|
||||||
// NOTE : if we get here, a result-type of some kind (other than Object[].class) was specified
|
// NOTE : if we get here, a result-type of some kind (other than Object[].class) was specified
|
||||||
|
|
||||||
final List<SqmSelection> selections = sqm.getQueryPart().getFirstQuerySpec().getSelectClause().getSelections();
|
final List<SqmSelection<?>> selections = sqm.getQueryPart().getFirstQuerySpec().getSelectClause().getSelections();
|
||||||
if ( Tuple.class.isAssignableFrom( resultType ) ) {
|
if ( Tuple.class.isAssignableFrom( resultType ) ) {
|
||||||
// resultType is Tuple..
|
// resultType is Tuple..
|
||||||
if ( queryOptions.getTupleTransformer() == null ) {
|
if ( queryOptions.getTupleTransformer() == null ) {
|
||||||
|
|
|
@ -244,7 +244,7 @@ public class QuerySqmImpl<R>
|
||||||
SessionFactoryImplementor factory) {
|
SessionFactoryImplementor factory) {
|
||||||
if ( queryPart instanceof SqmQuerySpec<?> ) {
|
if ( queryPart instanceof SqmQuerySpec<?> ) {
|
||||||
final SqmQuerySpec<R> sqmQuerySpec = (SqmQuerySpec<R>) queryPart;
|
final SqmQuerySpec<R> sqmQuerySpec = (SqmQuerySpec<R>) queryPart;
|
||||||
final List<SqmSelection> sqmSelections = sqmQuerySpec.getSelectClause().getSelections();
|
final List<SqmSelection<?>> sqmSelections = sqmQuerySpec.getSelectClause().getSelections();
|
||||||
|
|
||||||
// make sure there is at least one root
|
// make sure there is at least one root
|
||||||
final List<SqmRoot<?>> sqmRoots = sqmQuerySpec.getFromClause().getRoots();
|
final List<SqmRoot<?>> sqmRoots = sqmQuerySpec.getFromClause().getRoots();
|
||||||
|
@ -281,7 +281,7 @@ public class QuerySqmImpl<R>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<SqmSelection> selections = querySpec.getSelectClause().getSelections();
|
final List<SqmSelection<?>> selections = querySpec.getSelectClause().getSelections();
|
||||||
|
|
||||||
if ( resultClass.isArray() ) {
|
if ( resultClass.isArray() ) {
|
||||||
// todo (6.0) : implement
|
// todo (6.0) : implement
|
||||||
|
|
|
@ -714,8 +714,8 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
public SqmExpression<Number> quot(Number x, Expression<? extends Number> y) {
|
public SqmExpression<Number> quot(Number x, Expression<? extends Number> y) {
|
||||||
return createSqmArithmeticNode(
|
return createSqmArithmeticNode(
|
||||||
BinaryArithmeticOperator.QUOT,
|
BinaryArithmeticOperator.QUOT,
|
||||||
value( x, (SqmExpression) y ),
|
value( x, (SqmExpression<? extends Number>) y ),
|
||||||
(SqmExpression) y
|
(SqmExpression<? extends Number>) y
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,34 +723,31 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
public SqmExpression<Integer> mod(Expression<Integer> x, Expression<Integer> y) {
|
public SqmExpression<Integer> mod(Expression<Integer> x, Expression<Integer> y) {
|
||||||
return createSqmArithmeticNode(
|
return createSqmArithmeticNode(
|
||||||
BinaryArithmeticOperator.MODULO,
|
BinaryArithmeticOperator.MODULO,
|
||||||
(SqmExpression<?>) x,
|
(SqmExpression<Integer>) x,
|
||||||
(SqmExpression<?>) y
|
(SqmExpression<Integer>) y
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
||||||
public SqmExpression<Integer> mod(Expression<Integer> x, Integer y) {
|
public SqmExpression<Integer> mod(Expression<Integer> x, Integer y) {
|
||||||
return createSqmArithmeticNode(
|
return createSqmArithmeticNode(
|
||||||
BinaryArithmeticOperator.MODULO,
|
BinaryArithmeticOperator.MODULO,
|
||||||
(SqmExpression) x,
|
(SqmExpression<Integer>) x,
|
||||||
value( y, (SqmExpression) x )
|
value( y, (SqmExpression<Integer>) x )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
||||||
public SqmExpression<Integer> mod(Integer x, Expression<Integer> y) {
|
public SqmExpression<Integer> mod(Integer x, Expression<Integer> y) {
|
||||||
return createSqmArithmeticNode(
|
return createSqmArithmeticNode(
|
||||||
BinaryArithmeticOperator.MODULO,
|
BinaryArithmeticOperator.MODULO,
|
||||||
value( x, (SqmExpression) y ),
|
value( x, (SqmExpression<Integer>) y ),
|
||||||
(SqmExpression) y
|
(SqmExpression<Integer>) y
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmExpression<Double> sqrt(Expression<? extends Number> x) {
|
public SqmExpression<Double> sqrt(Expression<? extends Number> x) {
|
||||||
//noinspection unchecked
|
|
||||||
return getFunctionDescriptor("sqrt").generateSqmExpression(
|
return getFunctionDescriptor("sqrt").generateSqmExpression(
|
||||||
(SqmTypedNode<?>) x,
|
(SqmTypedNode<?>) x,
|
||||||
null,
|
null,
|
||||||
|
@ -760,37 +757,31 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public SqmExpression<Long> toLong(Expression<? extends Number> number) {
|
public SqmExpression<Long> toLong(Expression<? extends Number> number) {
|
||||||
return ( (SqmExpression<?>) number ).asLong();
|
return ( (SqmExpression<?>) number ).asLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public SqmExpression<Integer> toInteger(Expression<? extends Number> number) {
|
public SqmExpression<Integer> toInteger(Expression<? extends Number> number) {
|
||||||
return ( (SqmExpression<?>) number ).asInteger();
|
return ( (SqmExpression<?>) number ).asInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public SqmExpression<Float> toFloat(Expression<? extends Number> number) {
|
public SqmExpression<Float> toFloat(Expression<? extends Number> number) {
|
||||||
return ( (SqmExpression<?>) number ).asFloat();
|
return ( (SqmExpression<?>) number ).asFloat();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public SqmExpression<Double> toDouble(Expression<? extends Number> number) {
|
public SqmExpression<Double> toDouble(Expression<? extends Number> number) {
|
||||||
return ( (SqmExpression<?>) number ).asDouble();
|
return ( (SqmExpression<?>) number ).asDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public SqmExpression<BigDecimal> toBigDecimal(Expression<? extends Number> number) {
|
public SqmExpression<BigDecimal> toBigDecimal(Expression<? extends Number> number) {
|
||||||
return ( (SqmExpression<?>) number ).asBigDecimal();
|
return ( (SqmExpression<?>) number ).asBigDecimal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public SqmExpression<BigInteger> toBigInteger(Expression<? extends Number> number) {
|
public SqmExpression<BigInteger> toBigInteger(Expression<? extends Number> number) {
|
||||||
return ( (SqmExpression<?>) number ).asBigInteger();
|
return ( (SqmExpression<?>) number ).asBigInteger();
|
||||||
}
|
}
|
||||||
|
@ -801,7 +792,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> SqmLiteral<T> literal(T value, SqmExpression<T> typeInferenceSource) {
|
public <T> SqmLiteral<T> literal(T value, SqmExpression<? extends T> typeInferenceSource) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return new SqmLiteralNull<>( this );
|
return new SqmLiteralNull<>( this );
|
||||||
}
|
}
|
||||||
|
@ -812,10 +803,11 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
|
|
||||||
private static <T> SqmExpressable<T> resolveInferredType(
|
private static <T> SqmExpressable<T> resolveInferredType(
|
||||||
T value,
|
T value,
|
||||||
SqmExpression<T> typeInferenceSource,
|
SqmExpression<? extends T> typeInferenceSource,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
if ( typeInferenceSource != null ) {
|
if ( typeInferenceSource != null ) {
|
||||||
return typeInferenceSource.getNodeType();
|
//noinspection unchecked
|
||||||
|
return (SqmExpressable<T>) typeInferenceSource.getNodeType();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
|
@ -903,13 +895,13 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T> JpaCriteriaParameter<T> parameter(Class<T> paramClass, String name) {
|
public <T> JpaCriteriaParameter<T> parameter(Class<T> paramClass, String name) {
|
||||||
|
|
||||||
if ( Collection.class.isAssignableFrom( paramClass ) ) {
|
if ( Collection.class.isAssignableFrom( paramClass ) ) {
|
||||||
// a Collection-valued, multi-valued parameter
|
// a Collection-valued, multi-valued parameter
|
||||||
return new JpaCriteriaParameter(
|
return new JpaCriteriaParameter<>(
|
||||||
name,
|
name,
|
||||||
new MultiValueParameterType<>( Collection.class ),
|
new MultiValueParameterType<T>( (Class<T>) Collection.class ),
|
||||||
true,
|
true,
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
|
@ -917,9 +909,9 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
|
|
||||||
if ( paramClass.isArray() ) {
|
if ( paramClass.isArray() ) {
|
||||||
// an array-valued, multi-valued parameter
|
// an array-valued, multi-valued parameter
|
||||||
return new JpaCriteriaParameter(
|
return new JpaCriteriaParameter<>(
|
||||||
name,
|
name,
|
||||||
new MultiValueParameterType( Object[].class ),
|
new MultiValueParameterType<T>( (Class<T>) Object[].class ),
|
||||||
true,
|
true,
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
|
@ -936,8 +928,8 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmExpression<String> concat(Expression<String> x, Expression<String> y) {
|
public SqmExpression<String> concat(Expression<String> x, Expression<String> y) {
|
||||||
final SqmExpression xSqmExpression = (SqmExpression) x;
|
final SqmExpression<String> xSqmExpression = (SqmExpression<String>) x;
|
||||||
final SqmExpression ySqmExpression = (SqmExpression) y;
|
final SqmExpression<String> ySqmExpression = (SqmExpression<String>) y;
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return getFunctionDescriptor( "concat" ).generateSqmExpression(
|
return getFunctionDescriptor( "concat" ).generateSqmExpression(
|
||||||
asList( xSqmExpression, ySqmExpression ),
|
asList( xSqmExpression, ySqmExpression ),
|
||||||
|
@ -952,10 +944,10 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public SqmExpression<String> concat(Expression<String> x, String y) {
|
public SqmExpression<String> concat(Expression<String> x, String y) {
|
||||||
final SqmExpression xSqmExpression = (SqmExpression) x;
|
final SqmExpression<String> xSqmExpression = (SqmExpression<String>) x;
|
||||||
final SqmExpression ySqmExpression = value( y, xSqmExpression );
|
final SqmExpression<String> ySqmExpression = value( y, xSqmExpression );
|
||||||
|
|
||||||
return getFunctionDescriptor( "concat" ).generateSqmExpression(
|
return getFunctionDescriptor( "concat" ).generateSqmExpression(
|
||||||
asList( xSqmExpression, ySqmExpression ),
|
asList( xSqmExpression, ySqmExpression ),
|
||||||
|
@ -970,10 +962,10 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public SqmExpression<String> concat(String x, Expression<String> y) {
|
public SqmExpression<String> concat(String x, Expression<String> y) {
|
||||||
final SqmExpression ySqmExpression = (SqmExpression) y;
|
final SqmExpression<String> ySqmExpression = (SqmExpression<String>) y;
|
||||||
final SqmExpression xSqmExpression = value( x, ySqmExpression );
|
final SqmExpression<String> xSqmExpression = value( x, ySqmExpression );
|
||||||
|
|
||||||
return getFunctionDescriptor( "concat" ).generateSqmExpression(
|
return getFunctionDescriptor( "concat" ).generateSqmExpression(
|
||||||
asList( xSqmExpression, ySqmExpression ),
|
asList( xSqmExpression, ySqmExpression ),
|
||||||
|
@ -988,10 +980,10 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public SqmExpression<String> concat(String x, String y) {
|
public SqmExpression<String> concat(String x, String y) {
|
||||||
final SqmExpression xSqmExpression = value( x );
|
final SqmExpression<String> xSqmExpression = value( x );
|
||||||
final SqmExpression ySqmExpression = value( y, xSqmExpression );
|
final SqmExpression<String> ySqmExpression = value( y, xSqmExpression );
|
||||||
|
|
||||||
return getFunctionDescriptor( "concat" ).generateSqmExpression(
|
return getFunctionDescriptor( "concat" ).generateSqmExpression(
|
||||||
asList( xSqmExpression, ySqmExpression ),
|
asList( xSqmExpression, ySqmExpression ),
|
||||||
|
@ -1008,19 +1000,22 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> substring(Expression<String> source, Expression<Integer> from) {
|
public SqmFunction<String> substring(Expression<String> source, Expression<Integer> from) {
|
||||||
return createSubstringNode(
|
return createSubstringNode(
|
||||||
(SqmExpression) source,
|
(SqmExpression<String>) source,
|
||||||
(SqmExpression) from,
|
(SqmExpression<Integer>) from,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SqmFunction<String> createSubstringNode(SqmExpression source, SqmExpression from, SqmExpression len) {
|
private SqmFunction<String> createSubstringNode(
|
||||||
final AllowableFunctionReturnType resultType = (AllowableFunctionReturnType) QueryHelper.highestPrecedenceType2(
|
SqmExpression<String> source,
|
||||||
|
SqmExpression<Integer> from,
|
||||||
|
SqmExpression<Integer> len) {
|
||||||
|
//noinspection unchecked
|
||||||
|
final AllowableFunctionReturnType<String> resultType = (AllowableFunctionReturnType<String>) QueryHelper.highestPrecedenceType2(
|
||||||
source.getNodeType(),
|
source.getNodeType(),
|
||||||
StandardBasicTypes.STRING
|
StandardBasicTypes.STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
//noinspection unchecked
|
|
||||||
return getFunctionDescriptor( "substring" ).generateSqmExpression(
|
return getFunctionDescriptor( "substring" ).generateSqmExpression(
|
||||||
len==null ? asList( source, from ) : asList( source, from, len ),
|
len==null ? asList( source, from ) : asList( source, from, len ),
|
||||||
resultType,
|
resultType,
|
||||||
|
@ -1032,7 +1027,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> substring(Expression<String> source, int from) {
|
public SqmFunction<String> substring(Expression<String> source, int from) {
|
||||||
return createSubstringNode(
|
return createSubstringNode(
|
||||||
(SqmExpression) source,
|
(SqmExpression<String>) source,
|
||||||
value( from ),
|
value( from ),
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
@ -1041,16 +1036,16 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> substring(Expression<String> source, Expression<Integer> from, Expression<Integer> len) {
|
public SqmFunction<String> substring(Expression<String> source, Expression<Integer> from, Expression<Integer> len) {
|
||||||
return createSubstringNode(
|
return createSubstringNode(
|
||||||
(SqmExpression) source,
|
(SqmExpression<String>) source,
|
||||||
(SqmExpression) from,
|
(SqmExpression<Integer>) from,
|
||||||
(SqmExpression) len
|
(SqmExpression<Integer>) len
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> substring(Expression<String> source, int from, int len) {
|
public SqmFunction<String> substring(Expression<String> source, int from, int len) {
|
||||||
return createSubstringNode(
|
return createSubstringNode(
|
||||||
(SqmExpression) source,
|
(SqmExpression<String>) source,
|
||||||
value( from ),
|
value( from ),
|
||||||
value( len )
|
value( len )
|
||||||
);
|
);
|
||||||
|
@ -1058,10 +1053,13 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> trim(Expression<String> source) {
|
public SqmFunction<String> trim(Expression<String> source) {
|
||||||
return createTrimNode( null, null, (SqmExpression) source );
|
return createTrimNode( null, null, (SqmExpression<String>) source );
|
||||||
}
|
}
|
||||||
|
|
||||||
private SqmFunction<String> createTrimNode(TrimSpec trimSpecification, SqmExpression trimCharacter, SqmExpression source) {
|
private SqmFunction<String> createTrimNode(
|
||||||
|
TrimSpec trimSpecification,
|
||||||
|
SqmExpression<Character> trimCharacter,
|
||||||
|
SqmExpression<String> source) {
|
||||||
|
|
||||||
final ArrayList<SqmTypedNode<?>> arguments = new ArrayList<>();
|
final ArrayList<SqmTypedNode<?>> arguments = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -1088,7 +1086,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> trim(Trimspec ts, Expression<String> source) {
|
public SqmFunction<String> trim(Trimspec ts, Expression<String> source) {
|
||||||
return createTrimNode( convertTrimSpec( ts ), null, (SqmExpression) source );
|
return createTrimNode( convertTrimSpec( ts ), null, (SqmExpression<String>) source );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TrimSpec convertTrimSpec(Trimspec jpaTs) {
|
private static TrimSpec convertTrimSpec(Trimspec jpaTs) {
|
||||||
|
@ -1113,35 +1111,34 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> trim(Expression<Character> trimChar, Expression<String> source) {
|
public SqmFunction<String> trim(Expression<Character> trimChar, Expression<String> source) {
|
||||||
return createTrimNode( null, (SqmExpression) trimChar, (SqmExpression) source );
|
return createTrimNode( null, (SqmExpression<Character>) trimChar, (SqmExpression<String>) source );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> trim(Trimspec ts, Expression<Character> trimChar, Expression<String> source) {
|
public SqmFunction<String> trim(Trimspec ts, Expression<Character> trimChar, Expression<String> source) {
|
||||||
return createTrimNode( convertTrimSpec( ts ), (SqmExpression) trimChar, (SqmExpression) source );
|
return createTrimNode( convertTrimSpec( ts ), (SqmExpression<Character>) trimChar, (SqmExpression<String>) source );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> trim(char trimChar, Expression<String> source) {
|
public SqmFunction<String> trim(char trimChar, Expression<String> source) {
|
||||||
return createTrimNode( null, literal( trimChar ), (SqmExpression) source );
|
return createTrimNode( null, literal( trimChar ), (SqmExpression<String>) source );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> trim(Trimspec ts, char trimChar, Expression<String> source) {
|
public SqmFunction<String> trim(Trimspec ts, char trimChar, Expression<String> source) {
|
||||||
return createTrimNode( convertTrimSpec( ts ), literal( trimChar ), (SqmExpression) source );
|
return createTrimNode( convertTrimSpec( ts ), literal( trimChar ), (SqmExpression<String>) source );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> lower(Expression<String> x) {
|
public SqmFunction<String> lower(Expression<String> x) {
|
||||||
|
//noinspection unchecked
|
||||||
final AllowableFunctionReturnType type = (AllowableFunctionReturnType) highestPrecedenceType(
|
final AllowableFunctionReturnType<String> type = (AllowableFunctionReturnType<String>) highestPrecedenceType(
|
||||||
((SqmExpression) x).getNodeType(),
|
((SqmExpression<String>) x).getNodeType(),
|
||||||
StandardBasicTypes.STRING
|
StandardBasicTypes.STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
//noinspection unchecked
|
|
||||||
return getFunctionDescriptor( "lower" ).generateSqmExpression(
|
return getFunctionDescriptor( "lower" ).generateSqmExpression(
|
||||||
(SqmExpression) x,
|
(SqmExpression<String>) x,
|
||||||
type,
|
type,
|
||||||
getQueryEngine(),
|
getQueryEngine(),
|
||||||
getJpaMetamodel().getTypeConfiguration()
|
getJpaMetamodel().getTypeConfiguration()
|
||||||
|
@ -1150,14 +1147,14 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<String> upper(Expression<String> x) {
|
public SqmFunction<String> upper(Expression<String> x) {
|
||||||
final AllowableFunctionReturnType type = (AllowableFunctionReturnType) highestPrecedenceType(
|
//noinspection unchecked
|
||||||
((SqmExpression) x).getNodeType(),
|
final AllowableFunctionReturnType<String> type = (AllowableFunctionReturnType<String>) highestPrecedenceType(
|
||||||
|
((SqmExpression<String>) x).getNodeType(),
|
||||||
StandardBasicTypes.STRING
|
StandardBasicTypes.STRING
|
||||||
);
|
);
|
||||||
|
|
||||||
//noinspection unchecked
|
|
||||||
return getFunctionDescriptor( "upper" ).generateSqmExpression(
|
return getFunctionDescriptor( "upper" ).generateSqmExpression(
|
||||||
(SqmExpression) x,
|
(SqmExpression<String>) x,
|
||||||
type,
|
type,
|
||||||
getQueryEngine(),
|
getQueryEngine(),
|
||||||
getJpaMetamodel().getTypeConfiguration()
|
getJpaMetamodel().getTypeConfiguration()
|
||||||
|
@ -1166,13 +1163,9 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<Integer> length(Expression<String> argument) {
|
public SqmFunction<Integer> length(Expression<String> argument) {
|
||||||
//noinspection unchecked
|
|
||||||
return getFunctionDescriptor( "length" ).generateSqmExpression(
|
return getFunctionDescriptor( "length" ).generateSqmExpression(
|
||||||
(SqmExpression) argument,
|
(SqmExpression<String>) argument,
|
||||||
(AllowableFunctionReturnType) highestPrecedenceType(
|
StandardBasicTypes.INTEGER,
|
||||||
((SqmExpression) argument).getNodeType(),
|
|
||||||
StandardBasicTypes.INTEGER
|
|
||||||
),
|
|
||||||
getQueryEngine(),
|
getQueryEngine(),
|
||||||
getJpaMetamodel().getTypeConfiguration()
|
getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -1191,11 +1184,6 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
SqmExpression<String> source,
|
SqmExpression<String> source,
|
||||||
SqmExpression<String> pattern,
|
SqmExpression<String> pattern,
|
||||||
SqmExpression<Integer> startPosition) {
|
SqmExpression<Integer> startPosition) {
|
||||||
final AllowableFunctionReturnType type = (AllowableFunctionReturnType) highestPrecedenceType(
|
|
||||||
source.getNodeType(),
|
|
||||||
StandardBasicTypes.INTEGER
|
|
||||||
);
|
|
||||||
|
|
||||||
final List<SqmTypedNode<?>> arguments;
|
final List<SqmTypedNode<?>> arguments;
|
||||||
if ( startPosition == null ) {
|
if ( startPosition == null ) {
|
||||||
arguments = asList(
|
arguments = asList(
|
||||||
|
@ -1206,14 +1194,14 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
else {
|
else {
|
||||||
arguments = asList(
|
arguments = asList(
|
||||||
source,
|
source,
|
||||||
pattern
|
pattern,
|
||||||
|
startPosition
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//noinspection unchecked
|
|
||||||
return getFunctionDescriptor("locate").generateSqmExpression(
|
return getFunctionDescriptor("locate").generateSqmExpression(
|
||||||
arguments,
|
arguments,
|
||||||
type,
|
StandardBasicTypes.INTEGER,
|
||||||
getQueryEngine(),
|
getQueryEngine(),
|
||||||
getJpaMetamodel().getTypeConfiguration()
|
getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -1251,7 +1239,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return getFunctionDescriptor("current_date")
|
return getFunctionDescriptor("current_date")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
(AllowableFunctionReturnType) StandardBasicTypes.DATE,
|
(AllowableFunctionReturnType<Date>) (AllowableFunctionReturnType<?>) StandardBasicTypes.DATE,
|
||||||
queryEngine,
|
queryEngine,
|
||||||
getJpaMetamodel().getTypeConfiguration()
|
getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -1262,7 +1250,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return getFunctionDescriptor("current_timestamp")
|
return getFunctionDescriptor("current_timestamp")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
(AllowableFunctionReturnType) StandardBasicTypes.TIMESTAMP,
|
(AllowableFunctionReturnType<Timestamp>) (AllowableFunctionReturnType<?>) StandardBasicTypes.TIMESTAMP,
|
||||||
queryEngine,
|
queryEngine,
|
||||||
getJpaMetamodel().getTypeConfiguration()
|
getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -1273,7 +1261,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return getFunctionDescriptor("current_time")
|
return getFunctionDescriptor("current_time")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
(AllowableFunctionReturnType) StandardBasicTypes.TIME,
|
(AllowableFunctionReturnType<Time>) (AllowableFunctionReturnType<?>) StandardBasicTypes.TIME,
|
||||||
queryEngine,
|
queryEngine,
|
||||||
getJpaMetamodel().getTypeConfiguration()
|
getJpaMetamodel().getTypeConfiguration()
|
||||||
);
|
);
|
||||||
|
@ -1281,7 +1269,6 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmFunction<Instant> currentInstant() {
|
public SqmFunction<Instant> currentInstant() {
|
||||||
//noinspection unchecked
|
|
||||||
return getFunctionDescriptor("current_timestamp")
|
return getFunctionDescriptor("current_timestamp")
|
||||||
.generateSqmExpression(
|
.generateSqmExpression(
|
||||||
StandardBasicTypes.INSTANT,
|
StandardBasicTypes.INSTANT,
|
||||||
|
@ -1297,9 +1284,8 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
throw new SemanticException( "Could not resolve function named `" + name + "`" );
|
throw new SemanticException( "Could not resolve function named `" + name + "`" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//noinspection unchecked
|
|
||||||
return functionTemplate.generateSqmExpression(
|
return functionTemplate.generateSqmExpression(
|
||||||
(List) expressionList( args ),
|
expressionList( args ),
|
||||||
getTypeConfiguration().getBasicTypeForJavaType( type ),
|
getTypeConfiguration().getBasicTypeForJavaType( type ),
|
||||||
getQueryEngine(),
|
getQueryEngine(),
|
||||||
getJpaMetamodel().getTypeConfiguration()
|
getJpaMetamodel().getTypeConfiguration()
|
||||||
|
@ -1359,7 +1345,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
* Creates an expression for the value with the given "type inference" information
|
* Creates an expression for the value with the given "type inference" information
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public <T> SqmExpression<T> value(T value, SqmExpression<T> typeInferenceSource) {
|
public <T> SqmExpression<T> value(T value, SqmExpression<? extends T> typeInferenceSource) {
|
||||||
if ( typeInferenceSource == null ) {
|
if ( typeInferenceSource == null ) {
|
||||||
return value( value );
|
return value( value );
|
||||||
}
|
}
|
||||||
|
@ -1377,7 +1363,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
|
|
||||||
private static <T> AllowableParameterType<T> resolveInferredParameterType(
|
private static <T> AllowableParameterType<T> resolveInferredParameterType(
|
||||||
T value,
|
T value,
|
||||||
SqmExpression<T> typeInferenceSource,
|
SqmExpression<? extends T> typeInferenceSource,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
if ( typeInferenceSource != null ) {
|
if ( typeInferenceSource != null ) {
|
||||||
if ( typeInferenceSource instanceof AllowableParameterType ) {
|
if ( typeInferenceSource instanceof AllowableParameterType ) {
|
||||||
|
@ -1386,6 +1372,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( typeInferenceSource.getNodeType() instanceof AllowableParameterType ) {
|
if ( typeInferenceSource.getNodeType() instanceof AllowableParameterType ) {
|
||||||
|
//noinspection unchecked
|
||||||
return (AllowableParameterType<T>) typeInferenceSource.getNodeType();
|
return (AllowableParameterType<T>) typeInferenceSource.getNodeType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public interface ArgumentsValidator {
|
||||||
/**
|
/**
|
||||||
* The main (functional) operation defining validation
|
* The main (functional) operation defining validation
|
||||||
*/
|
*/
|
||||||
void validate(List<SqmTypedNode<?>> arguments);
|
void validate(List<? extends SqmTypedNode<?>> arguments);
|
||||||
|
|
||||||
default String getSignature() {
|
default String getSignature() {
|
||||||
return "( ... )";
|
return "( ... )";
|
||||||
|
|
|
@ -34,7 +34,7 @@ public interface FunctionReturnTypeResolver {
|
||||||
*/
|
*/
|
||||||
AllowableFunctionReturnType<?> resolveFunctionReturnType(
|
AllowableFunctionReturnType<?> resolveFunctionReturnType(
|
||||||
AllowableFunctionReturnType<?> impliedType,
|
AllowableFunctionReturnType<?> impliedType,
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
TypeConfiguration typeConfiguration);
|
TypeConfiguration typeConfiguration);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,7 +28,7 @@ public final class StandardArgumentsValidators {
|
||||||
*/
|
*/
|
||||||
public static final ArgumentsValidator NONE = new ArgumentsValidator() {
|
public static final ArgumentsValidator NONE = new ArgumentsValidator() {
|
||||||
@Override
|
@Override
|
||||||
public void validate(List<SqmTypedNode<?>> arguments) {}
|
public void validate(List<? extends SqmTypedNode<?>> arguments) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSignature() {
|
public String getSignature() {
|
||||||
|
@ -41,7 +41,7 @@ public final class StandardArgumentsValidators {
|
||||||
*/
|
*/
|
||||||
public static final ArgumentsValidator NO_ARGS = new ArgumentsValidator() {
|
public static final ArgumentsValidator NO_ARGS = new ArgumentsValidator() {
|
||||||
@Override
|
@Override
|
||||||
public void validate(List<SqmTypedNode<?>> arguments) {
|
public void validate(List<? extends SqmTypedNode<?>> arguments) {
|
||||||
if (!arguments.isEmpty()) {
|
if (!arguments.isEmpty()) {
|
||||||
throw new QueryException("Expecting no arguments, but found " + arguments.size());
|
throw new QueryException("Expecting no arguments, but found " + arguments.size());
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public final class StandardArgumentsValidators {
|
||||||
}
|
}
|
||||||
return new ArgumentsValidator() {
|
return new ArgumentsValidator() {
|
||||||
@Override
|
@Override
|
||||||
public void validate(List<SqmTypedNode<?>> arguments) {
|
public void validate(List<? extends SqmTypedNode<?>> arguments) {
|
||||||
if (arguments.size() < minNumOfArgs) {
|
if (arguments.size() < minNumOfArgs) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
String.format(
|
String.format(
|
||||||
|
@ -92,7 +92,7 @@ public final class StandardArgumentsValidators {
|
||||||
public static ArgumentsValidator exactly(int number) {
|
public static ArgumentsValidator exactly(int number) {
|
||||||
return new ArgumentsValidator() {
|
return new ArgumentsValidator() {
|
||||||
@Override
|
@Override
|
||||||
public void validate(List<SqmTypedNode<?>> arguments) {
|
public void validate(List<? extends SqmTypedNode<?>> arguments) {
|
||||||
if (arguments.size() != number) {
|
if (arguments.size() != number) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
String.format(
|
String.format(
|
||||||
|
@ -127,7 +127,7 @@ public final class StandardArgumentsValidators {
|
||||||
public static ArgumentsValidator max(int maxNumOfArgs) {
|
public static ArgumentsValidator max(int maxNumOfArgs) {
|
||||||
return new ArgumentsValidator() {
|
return new ArgumentsValidator() {
|
||||||
@Override
|
@Override
|
||||||
public void validate(List<SqmTypedNode<?>> arguments) {
|
public void validate(List<? extends SqmTypedNode<?>> arguments) {
|
||||||
if (arguments.size() > maxNumOfArgs) {
|
if (arguments.size() > maxNumOfArgs) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
String.format(
|
String.format(
|
||||||
|
@ -158,7 +158,7 @@ public final class StandardArgumentsValidators {
|
||||||
public static ArgumentsValidator between(int minNumOfArgs, int maxNumOfArgs) {
|
public static ArgumentsValidator between(int minNumOfArgs, int maxNumOfArgs) {
|
||||||
return new ArgumentsValidator() {
|
return new ArgumentsValidator() {
|
||||||
@Override
|
@Override
|
||||||
public void validate(List<SqmTypedNode<?>> arguments) {
|
public void validate(List<? extends SqmTypedNode<?>> arguments) {
|
||||||
if (arguments.size() < minNumOfArgs || arguments.size() > maxNumOfArgs) {
|
if (arguments.size() < minNumOfArgs || arguments.size() > maxNumOfArgs) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
String.format(
|
String.format(
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class StandardFunctionReturnTypeResolvers {
|
||||||
@Override
|
@Override
|
||||||
public AllowableFunctionReturnType<?> resolveFunctionReturnType(
|
public AllowableFunctionReturnType<?> resolveFunctionReturnType(
|
||||||
AllowableFunctionReturnType<?> impliedType,
|
AllowableFunctionReturnType<?> impliedType,
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
return isAssignableTo( invariantType, impliedType )
|
return isAssignableTo( invariantType, impliedType )
|
||||||
? impliedType : invariantType;
|
? impliedType : invariantType;
|
||||||
|
@ -68,7 +68,7 @@ public class StandardFunctionReturnTypeResolvers {
|
||||||
public static FunctionReturnTypeResolver useArgType(int argPosition) {
|
public static FunctionReturnTypeResolver useArgType(int argPosition) {
|
||||||
return new FunctionReturnTypeResolver() {
|
return new FunctionReturnTypeResolver() {
|
||||||
@Override
|
@Override
|
||||||
public AllowableFunctionReturnType<?> resolveFunctionReturnType(AllowableFunctionReturnType<?> impliedType, List<SqmTypedNode<?>> arguments, TypeConfiguration typeConfiguration) {
|
public AllowableFunctionReturnType<?> resolveFunctionReturnType(AllowableFunctionReturnType<?> impliedType, List<? extends SqmTypedNode<?>> arguments, TypeConfiguration typeConfiguration) {
|
||||||
AllowableFunctionReturnType<?> argType = extractArgumentType( arguments, argPosition );
|
AllowableFunctionReturnType<?> argType = extractArgumentType( arguments, argPosition );
|
||||||
return isAssignableTo( argType, impliedType ) ? impliedType : argType;
|
return isAssignableTo( argType, impliedType ) ? impliedType : argType;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class StandardFunctionReturnTypeResolvers {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AllowableFunctionReturnType<?> resolveFunctionReturnType(AllowableFunctionReturnType<?> impliedType, List<SqmTypedNode<?>> arguments, TypeConfiguration typeConfiguration) {
|
public AllowableFunctionReturnType<?> resolveFunctionReturnType(AllowableFunctionReturnType<?> impliedType, List<? extends SqmTypedNode<?>> arguments, TypeConfiguration typeConfiguration) {
|
||||||
for (SqmTypedNode<?> arg: arguments) {
|
for (SqmTypedNode<?> arg: arguments) {
|
||||||
if (arg!=null && arg.getNodeType() instanceof AllowableFunctionReturnType) {
|
if (arg!=null && arg.getNodeType() instanceof AllowableFunctionReturnType) {
|
||||||
AllowableFunctionReturnType<?> argType = (AllowableFunctionReturnType<?>) arg.getNodeType();
|
AllowableFunctionReturnType<?> argType = (AllowableFunctionReturnType<?>) arg.getNodeType();
|
||||||
|
@ -200,8 +200,10 @@ public class StandardFunctionReturnTypeResolvers {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AllowableFunctionReturnType<?> extractArgumentType(List<SqmTypedNode<?>> arguments, int position) {
|
public static AllowableFunctionReturnType<?> extractArgumentType(
|
||||||
final SqmTypedNode<?> specifiedArgument = arguments.get( position-1 );
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
|
int position) {
|
||||||
|
final SqmTypedNode<?> specifiedArgument = arguments.get( position - 1 );
|
||||||
final SqmExpressable<?> specifiedArgType = specifiedArgument.getNodeType();
|
final SqmExpressable<?> specifiedArgType = specifiedArgument.getNodeType();
|
||||||
if ( !(specifiedArgType instanceof AllowableFunctionReturnType) ) {
|
if ( !(specifiedArgType instanceof AllowableFunctionReturnType) ) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
|
|
|
@ -1717,11 +1717,11 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
|
|
||||||
private boolean selectClauseContains(SqmFrom<?, ?> from) {
|
private boolean selectClauseContains(SqmFrom<?, ?> from) {
|
||||||
final SqmQuerySpec<?> sqmQuerySpec = (SqmQuerySpec<?>) currentSqmQueryPart;
|
final SqmQuerySpec<?> sqmQuerySpec = (SqmQuerySpec<?>) currentSqmQueryPart;
|
||||||
final List<SqmSelection> selections = sqmQuerySpec.getSelectClause().getSelections();
|
final List<SqmSelection<?>> selections = sqmQuerySpec.getSelectClause().getSelections();
|
||||||
if ( selections.isEmpty() && from instanceof SqmRoot<?> ) {
|
if ( selections.isEmpty() && from instanceof SqmRoot<?> ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for ( SqmSelection selection : selections ) {
|
for ( SqmSelection<?> selection : selections ) {
|
||||||
if ( selection.getSelectableNode() == from ) {
|
if ( selection.getSelectableNode() == from ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,11 @@ public class SqmMaxIndexPath<T> extends AbstractSqmSpecificPluralPartPath<T> {
|
||||||
|
|
||||||
if ( getPluralAttribute() instanceof ListPersistentAttribute ) {
|
if ( getPluralAttribute() instanceof ListPersistentAttribute ) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
this.indexPathSource = getPluralAttribute().getIndexPathSource();
|
this.indexPathSource = (SqmPathSource<T>) getPluralAttribute().getIndexPathSource();
|
||||||
}
|
}
|
||||||
else if ( getPluralAttribute() instanceof MapPersistentAttribute ) {
|
else if ( getPluralAttribute() instanceof MapPersistentAttribute ) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
this.indexPathSource = ( (MapPersistentAttribute) getPluralAttribute() ).getKeyPathSource();
|
this.indexPathSource = ( (MapPersistentAttribute<?, ?, ?>) getPluralAttribute() ).getKeyPathSource();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new UnsupportedOperationException( "Plural attribute [" + getPluralAttribute() + "] is not indexed" );
|
throw new UnsupportedOperationException( "Plural attribute [" + getPluralAttribute() + "] is not indexed" );
|
||||||
|
|
|
@ -32,11 +32,11 @@ public class SqmMinIndexPath<T> extends AbstractSqmSpecificPluralPartPath<T> {
|
||||||
|
|
||||||
if ( getPluralAttribute() instanceof ListPersistentAttribute ) {
|
if ( getPluralAttribute() instanceof ListPersistentAttribute ) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
this.indexPathSource = getPluralAttribute().getIndexPathSource();
|
this.indexPathSource = (SqmPathSource<T>) getPluralAttribute().getIndexPathSource();
|
||||||
}
|
}
|
||||||
else if ( getPluralAttribute() instanceof MapPersistentAttribute ) {
|
else if ( getPluralAttribute() instanceof MapPersistentAttribute ) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
this.indexPathSource = ( (MapPersistentAttribute) getPluralAttribute() ).getKeyPathSource();
|
this.indexPathSource = ( (MapPersistentAttribute<?, ?, ?>) getPluralAttribute() ).getKeyPathSource();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new UnsupportedOperationException( "Plural attribute [" + getPluralAttribute() + "] is not indexed" );
|
throw new UnsupportedOperationException( "Plural attribute [" + getPluralAttribute() + "] is not indexed" );
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.hibernate.query.sqm.sql.internal.DomainResultProducer;
|
||||||
public class SqmCaseSearched<R>
|
public class SqmCaseSearched<R>
|
||||||
extends AbstractSqmExpression<R>
|
extends AbstractSqmExpression<R>
|
||||||
implements JpaSearchedCase<R>, DomainResultProducer<R> {
|
implements JpaSearchedCase<R>, DomainResultProducer<R> {
|
||||||
private List<WhenFragment<R>> whenFragments = new ArrayList<>();
|
private final List<WhenFragment<R>> whenFragments;
|
||||||
private SqmExpression<R> otherwise;
|
private SqmExpression<R> otherwise;
|
||||||
|
|
||||||
public SqmCaseSearched(NodeBuilder nodeBuilder) {
|
public SqmCaseSearched(NodeBuilder nodeBuilder) {
|
||||||
|
@ -34,6 +34,12 @@ public class SqmCaseSearched<R>
|
||||||
|
|
||||||
public SqmCaseSearched(SqmExpressable<R> inherentType, NodeBuilder nodeBuilder) {
|
public SqmCaseSearched(SqmExpressable<R> inherentType, NodeBuilder nodeBuilder) {
|
||||||
super( inherentType, nodeBuilder );
|
super( inherentType, nodeBuilder );
|
||||||
|
this.whenFragments = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SqmCaseSearched(SqmExpressable<R> inherentType, int estimateWhenSize, NodeBuilder nodeBuilder) {
|
||||||
|
super( inherentType, nodeBuilder );
|
||||||
|
this.whenFragments = new ArrayList<>( estimateWhenSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WhenFragment<R>> getWhenFragments() {
|
public List<WhenFragment<R>> getWhenFragments() {
|
||||||
|
|
|
@ -22,11 +22,11 @@ import org.hibernate.query.sqm.sql.internal.DomainResultProducer;
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class SqmCaseSimple<T,R>
|
public class SqmCaseSimple<T, R>
|
||||||
extends AbstractSqmExpression<R>
|
extends AbstractSqmExpression<R>
|
||||||
implements JpaSimpleCase<T,R>, DomainResultProducer<R> {
|
implements JpaSimpleCase<T, R>, DomainResultProducer<R> {
|
||||||
private final SqmExpression<T> fixture;
|
private final SqmExpression<T> fixture;
|
||||||
private List<WhenFragment<T,R>> whenFragments = new ArrayList<>();
|
private final List<WhenFragment<T, R>> whenFragments;
|
||||||
private SqmExpression<R> otherwise;
|
private SqmExpression<R> otherwise;
|
||||||
|
|
||||||
public SqmCaseSimple(SqmExpression<T> fixture, NodeBuilder nodeBuilder) {
|
public SqmCaseSimple(SqmExpression<T> fixture, NodeBuilder nodeBuilder) {
|
||||||
|
@ -35,6 +35,13 @@ public class SqmCaseSimple<T,R>
|
||||||
|
|
||||||
public SqmCaseSimple(SqmExpression<T> fixture, SqmExpressable<R> inherentType, NodeBuilder nodeBuilder) {
|
public SqmCaseSimple(SqmExpression<T> fixture, SqmExpressable<R> inherentType, NodeBuilder nodeBuilder) {
|
||||||
super( inherentType, nodeBuilder );
|
super( inherentType, nodeBuilder );
|
||||||
|
this.whenFragments = new ArrayList<>( );
|
||||||
|
this.fixture = fixture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SqmCaseSimple(SqmExpression<T> fixture, SqmExpressable<R> inherentType, int estimateWhenSize, NodeBuilder nodeBuilder) {
|
||||||
|
super( inherentType, nodeBuilder );
|
||||||
|
this.whenFragments = new ArrayList<>( estimateWhenSize );
|
||||||
this.fixture = fixture;
|
this.fixture = fixture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
||||||
*/
|
*/
|
||||||
public class SqmExtractUnit<T> extends AbstractSqmNode implements SqmTypedNode<T>, SqmVisitableNode {
|
public class SqmExtractUnit<T> extends AbstractSqmNode implements SqmTypedNode<T>, SqmVisitableNode {
|
||||||
private final TemporalUnit unit;
|
private final TemporalUnit unit;
|
||||||
private final AllowableFunctionReturnType type;
|
private final AllowableFunctionReturnType<T> type;
|
||||||
|
|
||||||
public SqmExtractUnit(TemporalUnit unit, AllowableFunctionReturnType<T> type, NodeBuilder nodeBuilder) {
|
public SqmExtractUnit(TemporalUnit unit, AllowableFunctionReturnType<T> type, NodeBuilder nodeBuilder) {
|
||||||
super( nodeBuilder );
|
super( nodeBuilder );
|
||||||
|
@ -32,7 +32,7 @@ public class SqmExtractUnit<T> extends AbstractSqmNode implements SqmTypedNode<T
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AllowableFunctionReturnType getType() {
|
public AllowableFunctionReturnType<T> getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,13 @@ public abstract class SqmFunction<T> extends AbstractSqmExpression<T>
|
||||||
private final String functionName;
|
private final String functionName;
|
||||||
private final SqmFunctionDescriptor functionDescriptor;
|
private final SqmFunctionDescriptor functionDescriptor;
|
||||||
|
|
||||||
private final List<SqmTypedNode<?>> arguments;
|
private final List<? extends SqmTypedNode<?>> arguments;
|
||||||
|
|
||||||
public SqmFunction(
|
public SqmFunction(
|
||||||
String functionName,
|
String functionName,
|
||||||
SqmFunctionDescriptor functionDescriptor,
|
SqmFunctionDescriptor functionDescriptor,
|
||||||
SqmExpressable<T> type,
|
SqmExpressable<T> type,
|
||||||
List<SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
NodeBuilder criteriaBuilder) {
|
NodeBuilder criteriaBuilder) {
|
||||||
super( type, criteriaBuilder );
|
super( type, criteriaBuilder );
|
||||||
this.functionName = functionName;
|
this.functionName = functionName;
|
||||||
|
@ -58,7 +58,7 @@ public abstract class SqmFunction<T> extends AbstractSqmExpression<T>
|
||||||
return functionName;
|
return functionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SqmTypedNode<?>> getArguments() {
|
public List<? extends SqmTypedNode<?>> getArguments() {
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.hibernate.query.sqm.tree.SqmVisitableNode;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class SqmTrimSpecification extends AbstractSqmNode implements SqmTypedNode, SqmVisitableNode {
|
public class SqmTrimSpecification extends AbstractSqmNode implements SqmTypedNode<Void>, SqmVisitableNode {
|
||||||
private final TrimSpec specification;
|
private final TrimSpec specification;
|
||||||
|
|
||||||
public SqmTrimSpecification(TrimSpec specification, NodeBuilder nodeBuilder) {
|
public SqmTrimSpecification(TrimSpec specification, NodeBuilder nodeBuilder) {
|
||||||
|
@ -43,7 +43,7 @@ public class SqmTrimSpecification extends AbstractSqmNode implements SqmTypedNod
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmExpressable getNodeType() {
|
public SqmExpressable<Void> getNodeType() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SqmInListPredicate<T> extends AbstractNegatableSqmPredicate impleme
|
||||||
|
|
||||||
public SqmInListPredicate(
|
public SqmInListPredicate(
|
||||||
SqmExpression<T> testExpression,
|
SqmExpression<T> testExpression,
|
||||||
List<SqmExpression<T>> listExpressions,
|
List<? extends SqmExpression<T>> listExpressions,
|
||||||
NodeBuilder nodeBuilder) {
|
NodeBuilder nodeBuilder) {
|
||||||
this( testExpression, listExpressions, false, nodeBuilder );
|
this( testExpression, listExpressions, false, nodeBuilder );
|
||||||
}
|
}
|
||||||
|
@ -48,13 +48,14 @@ public class SqmInListPredicate<T> extends AbstractNegatableSqmPredicate impleme
|
||||||
@SuppressWarnings("WeakerAccess")
|
@SuppressWarnings("WeakerAccess")
|
||||||
public SqmInListPredicate(
|
public SqmInListPredicate(
|
||||||
SqmExpression<T> testExpression,
|
SqmExpression<T> testExpression,
|
||||||
List<SqmExpression<T>> listExpressions,
|
List<? extends SqmExpression<T>> listExpressions,
|
||||||
boolean negated,
|
boolean negated,
|
||||||
NodeBuilder nodeBuilder) {
|
NodeBuilder nodeBuilder) {
|
||||||
super( negated, nodeBuilder );
|
super( negated, nodeBuilder );
|
||||||
this.testExpression = testExpression;
|
this.testExpression = testExpression;
|
||||||
this.listExpressions = listExpressions;
|
//noinspection unchecked
|
||||||
for ( SqmExpression listExpression : listExpressions ) {
|
this.listExpressions = (List<SqmExpression<T>>) listExpressions;
|
||||||
|
for ( SqmExpression<T> listExpression : listExpressions ) {
|
||||||
implyListElementType( listExpression );
|
implyListElementType( listExpression );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,30 +88,30 @@ public class SqmInListPredicate<T> extends AbstractNegatableSqmPredicate impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmInPredicate<T> value(Expression value) {
|
public SqmInPredicate<T> value(Expression<? extends T> value) {
|
||||||
|
//noinspection unchecked
|
||||||
addExpression( (SqmExpression<T>) value );
|
addExpression( (SqmExpression<T>) value );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmInPredicate<T> value(JpaExpression value) {
|
public SqmInPredicate<T> value(JpaExpression<? extends T> value) {
|
||||||
addExpression( (SqmExpression) value );
|
//noinspection unchecked
|
||||||
|
addExpression( (SqmExpression<T>) value );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SqmExpression<T>> getListExpressions() {
|
public List<? extends SqmExpression<T>> getListExpressions() {
|
||||||
return listExpressions;
|
return listExpressions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public <X> void addExpression(SqmExpression<X> expression) {
|
public void addExpression(SqmExpression<T> expression) {
|
||||||
implyListElementType( expression );
|
implyListElementType( expression );
|
||||||
|
|
||||||
//noinspection unchecked
|
listExpressions.add( expression );
|
||||||
listExpressions.add( (SqmExpression<T>) expression );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void implyListElementType(SqmExpression expression) {
|
private void implyListElementType(SqmExpression<?> expression) {
|
||||||
//noinspection unchecked
|
|
||||||
expression.applyInferableType(
|
expression.applyInferableType(
|
||||||
QueryHelper.highestPrecedenceType2(
|
QueryHelper.highestPrecedenceType2(
|
||||||
getTestExpression().getNodeType(),
|
getTestExpression().getNodeType(),
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class SqmInSubQueryPredicate<T> extends AbstractNegatableSqmPredicate imp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmInPredicate<T> value(JpaExpression value) {
|
public SqmInPredicate<T> value(JpaExpression<? extends T> value) {
|
||||||
throw new UnsupportedOperationException( );
|
throw new UnsupportedOperationException( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.hibernate.query.sqm.tree.expression.SqmExpression;
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface SqmAliasedExpressionContainer<T extends SqmAliasedNode> {
|
public interface SqmAliasedExpressionContainer<T extends SqmAliasedNode<?>> {
|
||||||
T add(SqmExpression<?> expression, String alias);
|
T add(SqmExpression<?> expression, String alias);
|
||||||
void add(T aliasExpression);
|
void add(T aliasExpression);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,10 @@ public class SqmOrderByClause {
|
||||||
public SqmOrderByClause() {
|
public SqmOrderByClause() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SqmOrderByClause(int estimateSize) {
|
||||||
|
this.sortSpecifications = new ArrayList<>( estimateSize );
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasPositionalSortItem() {
|
public boolean hasPositionalSortItem() {
|
||||||
return hasPositionalSortItem;
|
return hasPositionalSortItem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class SqmQueryGroup<T> extends SqmQueryPart<T> implements JpaQueryGroup<T
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateQueryGroupFetchStructure(SqmQuerySpec<?> firstQuerySpec) {
|
private void validateQueryGroupFetchStructure(SqmQuerySpec<?> firstQuerySpec) {
|
||||||
final List<SqmSelection> firstSelections = firstQuerySpec.getSelectClause().getSelections();
|
final List<SqmSelection<?>> firstSelections = firstQuerySpec.getSelectClause().getSelections();
|
||||||
final int firstSelectionSize = firstSelections.size();
|
final int firstSelectionSize = firstSelections.size();
|
||||||
for ( int i = 0; i < queryParts.size(); i++ ) {
|
for ( int i = 0; i < queryParts.size(); i++ ) {
|
||||||
final SqmQueryPart<T> queryPart = queryParts.get( i );
|
final SqmQueryPart<T> queryPart = queryParts.get( i );
|
||||||
|
@ -125,12 +125,12 @@ public class SqmQueryGroup<T> extends SqmQueryPart<T> implements JpaQueryGroup<T
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final SqmQuerySpec<?> querySpec = (SqmQuerySpec<?>) queryPart;
|
final SqmQuerySpec<?> querySpec = (SqmQuerySpec<?>) queryPart;
|
||||||
final List<SqmSelection> selections = querySpec.getSelectClause().getSelections();
|
final List<SqmSelection<?>> selections = querySpec.getSelectClause().getSelections();
|
||||||
if ( firstSelectionSize != selections.size() ) {
|
if ( firstSelectionSize != selections.size() ) {
|
||||||
throw new SemanticException( "All query parts in a query group must have the same arity!" );
|
throw new SemanticException( "All query parts in a query group must have the same arity!" );
|
||||||
}
|
}
|
||||||
for ( int j = 0; j < firstSelectionSize; j++ ) {
|
for ( int j = 0; j < firstSelectionSize; j++ ) {
|
||||||
final SqmSelection firstSqmSelection = firstSelections.get( j );
|
final SqmSelection<?> firstSqmSelection = firstSelections.get( j );
|
||||||
final JavaTypeDescriptor<?> firstJavaTypeDescriptor = firstSqmSelection.getNodeJavaTypeDescriptor();
|
final JavaTypeDescriptor<?> firstJavaTypeDescriptor = firstSqmSelection.getNodeJavaTypeDescriptor();
|
||||||
if ( firstJavaTypeDescriptor != selections.get( j ).getNodeJavaTypeDescriptor() ) {
|
if ( firstJavaTypeDescriptor != selections.get( j ).getNodeJavaTypeDescriptor() ) {
|
||||||
throw new SemanticException(
|
throw new SemanticException(
|
||||||
|
|
|
@ -340,7 +340,7 @@ public class SqmQuerySpec<T> extends SqmQueryPart<T>
|
||||||
if ( selectClause.isDistinct() ) {
|
if ( selectClause.isDistinct() ) {
|
||||||
sb.append( "distinct " );
|
sb.append( "distinct " );
|
||||||
}
|
}
|
||||||
final List<SqmSelection> selections = selectClause.getSelections();
|
final List<SqmSelection<?>> selections = selectClause.getSelections();
|
||||||
selections.get( 0 ).appendHqlString( sb );
|
selections.get( 0 ).appendHqlString( sb );
|
||||||
for ( int i = 1; i < selections.size(); i++ ) {
|
for ( int i = 1; i < selections.size(); i++ ) {
|
||||||
sb.append( ", " );
|
sb.append( ", " );
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class SqmSelectClause extends AbstractSqmNode implements SqmAliasedExpressionContainer<SqmSelection>, JpaSelection<Object> {
|
public class SqmSelectClause extends AbstractSqmNode implements SqmAliasedExpressionContainer<SqmSelection<?>>, JpaSelection<Object> {
|
||||||
private boolean distinct;
|
private boolean distinct;
|
||||||
private List<SqmSelection<?>> selections;
|
private List<SqmSelection<?>> selections;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class SqmSelectClause extends AbstractSqmNode implements SqmAliasedExpres
|
||||||
this.distinct = distinct;
|
this.distinct = distinct;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SqmSelection> getSelections() {
|
public List<SqmSelection<?>> getSelections() {
|
||||||
if ( selections == null ) {
|
if ( selections == null ) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class SqmSelectClause extends AbstractSqmNode implements SqmAliasedExpres
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSelection(SqmSelection selection) {
|
public void addSelection(SqmSelection<?> selection) {
|
||||||
if ( selections == null ) {
|
if ( selections == null ) {
|
||||||
selections = new ArrayList<>();
|
selections = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
@ -67,18 +67,18 @@ public class SqmSelectClause extends AbstractSqmNode implements SqmAliasedExpres
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SqmSelection add(SqmExpression<?> expression, String alias) {
|
public SqmSelection<?> add(SqmExpression<?> expression, String alias) {
|
||||||
final SqmSelection selection = new SqmSelection<>( expression, alias, nodeBuilder() );
|
final SqmSelection<?> selection = new SqmSelection<>( expression, alias, nodeBuilder() );
|
||||||
addSelection( selection );
|
addSelection( selection );
|
||||||
return selection;
|
return selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(SqmSelection aliasExpression) {
|
public void add(SqmSelection<?> aliasExpression) {
|
||||||
addSelection( aliasExpression );
|
addSelection( aliasExpression );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelection(SqmSelection sqmSelection) {
|
public void setSelection(SqmSelection<?> sqmSelection) {
|
||||||
if ( selections != null ) {
|
if ( selections != null ) {
|
||||||
selections.clear();
|
selections.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class AliasCollisionTest extends BaseSqmUnitTest {
|
||||||
|
|
||||||
final SqmQuerySpec<?> querySpec = sqm.getQuerySpec();
|
final SqmQuerySpec<?> querySpec = sqm.getQuerySpec();
|
||||||
|
|
||||||
final List<SqmSelection> selections = querySpec.getSelectClause().getSelections();
|
final List<SqmSelection<?>> selections = querySpec.getSelectClause().getSelections();
|
||||||
assertThat( selections, hasSize( 1 ) );
|
assertThat( selections, hasSize( 1 ) );
|
||||||
assertThat( selections.get( 0 ).getAlias(), nullValue() );
|
assertThat( selections.get( 0 ).getAlias(), nullValue() );
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ public class AliasCollisionTest extends BaseSqmUnitTest {
|
||||||
|
|
||||||
final SqmQuerySpec<?> querySpec = sqm.getQuerySpec();
|
final SqmQuerySpec<?> querySpec = sqm.getQuerySpec();
|
||||||
|
|
||||||
final List<SqmSelection> selections = querySpec.getSelectClause().getSelections();
|
final List<SqmSelection<?>> selections = querySpec.getSelectClause().getSelections();
|
||||||
assertThat( selections, hasSize( 1 ) );
|
assertThat( selections, hasSize( 1 ) );
|
||||||
assertThat( selections.get( 0 ).getAlias(), nullValue() );
|
assertThat( selections.get( 0 ).getAlias(), nullValue() );
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class AttributePathTests extends BaseSqmUnitTest {
|
||||||
// assertPropertyPath( space.getRoot(), "com.acme.Something(s)" );
|
// assertPropertyPath( space.getRoot(), "com.acme.Something(s)" );
|
||||||
// assertPropertyPath( space.getJoins().get( 0 ), "com.acme.Something(s).entity" );
|
// assertPropertyPath( space.getJoins().get( 0 ), "com.acme.Something(s).entity" );
|
||||||
|
|
||||||
final List<SqmSelection> selections = statement.getQuerySpec().getSelectClause().getSelections();
|
final List<SqmSelection<?>> selections = statement.getQuerySpec().getSelectClause().getSelections();
|
||||||
assertThat( selections.size(), is(2) );
|
assertThat( selections.size(), is(2) );
|
||||||
|
|
||||||
// expression paths
|
// expression paths
|
||||||
|
@ -136,7 +136,7 @@ public class AttributePathTests extends BaseSqmUnitTest {
|
||||||
@Test
|
@Test
|
||||||
public void testManyToOneReference() {
|
public void testManyToOneReference() {
|
||||||
final SqmSelectStatement<?> sqm = interpretSelect( "select s.mate from Person s" );
|
final SqmSelectStatement<?> sqm = interpretSelect( "select s.mate from Person s" );
|
||||||
final List<SqmSelection> selections = sqm.getQuerySpec().getSelectClause().getSelections();
|
final List<SqmSelection<?>> selections = sqm.getQuerySpec().getSelectClause().getSelections();
|
||||||
assertThat( selections.size(), is( 1 ) );
|
assertThat( selections.size(), is( 1 ) );
|
||||||
final SqmSelection<?> selection = selections.get( 0 );
|
final SqmSelection<?> selection = selections.get( 0 );
|
||||||
final SqmSelectableNode<?> selectableNode = selection.getSelectableNode();
|
final SqmSelectableNode<?> selectableNode = selection.getSelectableNode();
|
||||||
|
|
|
@ -331,7 +331,7 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
|
||||||
Query<?> query = session.createQuery( "select a.class from Animal a where a.class = Dog" );
|
Query<?> query = session.createQuery( "select a.class from Animal a where a.class = Dog" );
|
||||||
query.list();
|
query.list();
|
||||||
SqmSelectStatement<?> sqmStatement = (SqmSelectStatement<?>) query.unwrap( QuerySqmImpl.class ).getSqmStatement();
|
SqmSelectStatement<?> sqmStatement = (SqmSelectStatement<?>) query.unwrap( QuerySqmImpl.class ).getSqmStatement();
|
||||||
List<SqmSelection> selections = sqmStatement.getQuerySpec().getSelectClause().getSelections();
|
List<SqmSelection<?>> selections = sqmStatement.getQuerySpec().getSelectClause().getSelections();
|
||||||
assertEquals( 1, selections.size() );
|
assertEquals( 1, selections.size() );
|
||||||
SqmSelection<?> typeSelection = selections.get( 0 );
|
SqmSelection<?> typeSelection = selections.get( 0 );
|
||||||
// always integer for joined
|
// always integer for joined
|
||||||
|
@ -2627,7 +2627,7 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
Query<?> q = s.createQuery( "select a.bodyWeight as abw, a.description from Animal a" );
|
Query<?> q = s.createQuery( "select a.bodyWeight as abw, a.description from Animal a" );
|
||||||
SqmSelectStatement<?> sqmStatement = (SqmSelectStatement<?>) q.unwrap( QuerySqmImpl.class ).getSqmStatement();
|
SqmSelectStatement<?> sqmStatement = (SqmSelectStatement<?>) q.unwrap( QuerySqmImpl.class ).getSqmStatement();
|
||||||
List<SqmSelection> selections = sqmStatement.getQuerySpec().getSelectClause().getSelections();
|
List<SqmSelection<?>> selections = sqmStatement.getQuerySpec().getSelectClause().getSelections();
|
||||||
assertThat( selections.size(), is( 2 ) );
|
assertThat( selections.size(), is( 2 ) );
|
||||||
assertThat( selections.get( 0 ).getAlias(), is( "abw" ) );
|
assertThat( selections.get( 0 ).getAlias(), is( "abw" ) );
|
||||||
assertThat( selections.get( 1 ).getAlias(), nullValue() );
|
assertThat( selections.get( 1 ).getAlias(), nullValue() );
|
||||||
|
|
Loading…
Reference in New Issue