6 - Remove NativeQuery<T> addScalar(String columnAlias, Type type) in favour of NativeQuery<T> addScalar(String columnAlias, BasicDomainType type)
This commit is contained in:
parent
44e01cdf7e
commit
a5414d2324
|
@ -37,6 +37,7 @@ import org.hibernate.mapping.PersistentClass;
|
|||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.mapping.ToOne;
|
||||
import org.hibernate.mapping.Value;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
|
@ -103,7 +104,7 @@ public abstract class ResultSetMappingBinder {
|
|||
);
|
||||
}
|
||||
}
|
||||
return new NativeSQLQueryScalarReturn( column, type );
|
||||
return new NativeSQLQueryScalarReturn( column, (BasicDomainType) type );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.engine.query.spi.sql;
|
||||
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
|
@ -14,11 +15,11 @@ import org.hibernate.type.Type;
|
|||
* @author gloegl
|
||||
*/
|
||||
public class NativeSQLQueryScalarReturn implements NativeSQLQueryReturn {
|
||||
private final Type type;
|
||||
private final BasicDomainType type;
|
||||
private final String columnAlias;
|
||||
private final int hashCode;
|
||||
|
||||
public NativeSQLQueryScalarReturn(String alias, Type type) {
|
||||
public NativeSQLQueryScalarReturn(String alias, BasicDomainType type) {
|
||||
this.type = type;
|
||||
this.columnAlias = alias;
|
||||
this.hashCode = determineHashCode();
|
||||
|
@ -36,7 +37,7 @@ public class NativeSQLQueryScalarReturn implements NativeSQLQueryReturn {
|
|||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
return (Type) type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,7 +70,7 @@ public class NativeSQLQueryScalarReturn implements NativeSQLQueryReturn {
|
|||
public void traceLog(TraceLogger logger) {
|
||||
logger.writeLine( "Scalar[" );
|
||||
logger.writeLine( " columnAlias=" + columnAlias + "," );
|
||||
logger.writeLine( " type=" + ( type == null ? "<unknown>" : type.getName() ) + "," );
|
||||
logger.writeLine( " type=" + ( type == null ? "<unknown>" : type.getTypeName() ) + "," );
|
||||
logger.writeLine( "]" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,9 +89,7 @@ public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
|
|||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
default NativeQuery<T> addScalar(String columnAlias, Type type) {
|
||||
return addScalar( columnAlias, (BasicDomainType) type );
|
||||
}
|
||||
// NativeQuery<T> addScalar(String columnAlias, Type type);
|
||||
|
||||
/**
|
||||
* Declare a scalar query result.
|
||||
|
|
|
@ -530,22 +530,18 @@ public class NativeQueryImpl<R>
|
|||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> addScalar(String columnAlias) {
|
||||
return addScalar( columnAlias, (BasicDomainType) null );
|
||||
return addScalar( columnAlias, null );
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public NativeQueryImplementor<R> addScalar(String columnAlias, BasicDomainType type) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> addScalar(String columnAlias, BasicDomainType type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryImplementor<R> addScalar(String columnAlias, Type type) {
|
||||
addReturnBuilder(
|
||||
new NativeQueryReturnBuilder() {
|
||||
public NativeSQLQueryReturn buildReturn() {
|
||||
return new NativeSQLQueryScalarReturn( columnAlias, type );
|
||||
}
|
||||
}
|
||||
() -> new NativeSQLQueryScalarReturn( columnAlias, type )
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.hibernate.LockMode;
|
|||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.metamodel.model.domain.AllowableParameterType;
|
||||
import org.hibernate.metamodel.model.domain.BasicDomainType;
|
||||
import org.hibernate.query.NativeQuery;
|
||||
import org.hibernate.query.QueryParameter;
|
||||
import org.hibernate.query.ResultListTransformer;
|
||||
|
@ -53,7 +54,7 @@ public interface NativeQueryImplementor<R> extends QueryImplementor<R>, NativeQu
|
|||
NativeQueryImplementor<R> addScalar(String columnAlias);
|
||||
|
||||
@Override
|
||||
NativeQueryImplementor<R> addScalar(String columnAlias, Type type);
|
||||
NativeQueryImplementor<R> addScalar(String columnAlias, BasicDomainType type);
|
||||
|
||||
@Override
|
||||
RootReturn addRoot(String tableAlias, String entityName);
|
||||
|
|
Loading…
Reference in New Issue