6 - SQM based on JPA type system

- further work on `org.hibernate.query` (especially `NamedQueryRepository` and friends)
- initial work on `org.hibernate.sql.exec`
- initial work on `org.hibernate.sql.results`
- SemanticPathPart handling
- NamedQueryMemento
This commit is contained in:
Steve Ebersole 2019-05-29 08:10:38 -05:00 committed by Andrea Boriero
parent 43c738ec4e
commit 0be0d06b1d
14 changed files with 227 additions and 413 deletions

View File

@ -6,6 +6,8 @@
*/ */
package org.hibernate.boot.internal; package org.hibernate.boot.internal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -14,12 +16,14 @@ import javax.persistence.StoredProcedureParameter;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.FlushMode; import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.LockOptions; import org.hibernate.LockOptions;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.boot.spi.AbstractNamedQueryMapping; import org.hibernate.boot.spi.AbstractNamedQueryMapping;
import org.hibernate.boot.spi.NamedCallableQueryMapping; import org.hibernate.boot.spi.NamedCallableQueryMapping;
import org.hibernate.boot.spi.NamedQueryParameterMapping;
import org.hibernate.cfg.BinderHelper; import org.hibernate.cfg.BinderHelper;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.procedure.internal.NamedCallableQueryMementoImpl; import org.hibernate.procedure.internal.NamedCallableQueryMementoImpl;
import org.hibernate.procedure.spi.NamedCallableQueryMemento; import org.hibernate.procedure.spi.NamedCallableQueryMemento;
import org.hibernate.procedure.spi.ParameterStrategy; import org.hibernate.procedure.spi.ParameterStrategy;
@ -29,17 +33,20 @@ import org.hibernate.query.procedure.internal.ProcedureParameterImpl;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class NamedCallableQueryMappingImpl extends AbstractNamedQueryMapping implements NamedCallableQueryMapping { public class NamedCallableQueryMappingImpl extends AbstractNamedQueryMapping implements NamedCallableQueryMapping {
private static final Class[] NO_CLASSES = new Class[0];
private final String callableName; private final String callableName;
private final List<ParameterMapping> parameterMappings;
private final List<String> resultSetMappingNames; private final List<String> resultSetMappingNames;
private final List<Class> resultClasses; private final List<String> resultSetMappingClassNames;
private final Set<String> querySpaces; private final Set<String> querySpaces;
public NamedCallableQueryMappingImpl( public NamedCallableQueryMappingImpl(
String name, String name,
String callableName, String callableName,
List<NamedQueryParameterMapping> parameterMappings, List<ParameterMapping> parameterMappings,
List<Class> resultClasses,
List<String> resultSetMappingNames, List<String> resultSetMappingNames,
List<String> resultSetMappingClassNames,
Set<String> querySpaces, Set<String> querySpaces,
Boolean cacheable, Boolean cacheable,
String cacheRegion, String cacheRegion,
@ -53,7 +60,6 @@ public class NamedCallableQueryMappingImpl extends AbstractNamedQueryMapping imp
Map<String,Object> hints) { Map<String,Object> hints) {
super( super(
name, name,
parameterMappings,
cacheable, cacheable,
cacheRegion, cacheRegion,
cacheMode, cacheMode,
@ -67,8 +73,9 @@ public class NamedCallableQueryMappingImpl extends AbstractNamedQueryMapping imp
); );
this.callableName = callableName; this.callableName = callableName;
this.parameterMappings = parameterMappings;
this.resultSetMappingNames = resultSetMappingNames; this.resultSetMappingNames = resultSetMappingNames;
this.resultClasses = resultClasses; this.resultSetMappingClassNames = resultSetMappingClassNames;
this.querySpaces = querySpaces; this.querySpaces = querySpaces;
} }
@ -79,15 +86,14 @@ public class NamedCallableQueryMappingImpl extends AbstractNamedQueryMapping imp
callableName, callableName,
ParameterStrategy.UNKNOWN, ParameterStrategy.UNKNOWN,
resolveParameterMappings( factory ), resolveParameterMappings( factory ),
resultClasses, (String[]) resultSetMappingNames.toArray(),
resultSetMappingNames, toResultClasses( resultSetMappingClassNames, factory ),
querySpaces, querySpaces,
getCacheable(), getCacheable(),
getCacheRegion(), getCacheRegion(),
getCacheMode(), getCacheMode(),
getFlushMode(), getFlushMode(),
getReadOnly(), getReadOnly(),
getLockOptions(),
getTimeout(), getTimeout(),
getFetchSize(), getFetchSize(),
getComment(), getComment(),
@ -95,20 +101,45 @@ public class NamedCallableQueryMappingImpl extends AbstractNamedQueryMapping imp
); );
} }
@Override protected List<NamedCallableQueryMemento.ParameterMemento> resolveParameterMappings(SessionFactoryImplementor factory) {
protected List<? extends NamedCallableQueryMementoImpl.CallableParameterMemento> resolveParameterMappings(SessionFactoryImplementor factory) { if ( parameterMappings == null || parameterMappings.isEmpty() ) {
//noinspection unchecked return Collections.emptyList();
return (List) super.resolveParameterMappings( factory ); }
final ArrayList<NamedCallableQueryMemento.ParameterMemento> mementos = CollectionHelper.arrayList( parameterMappings.size() );
parameterMappings.forEach( mapping -> mementos.add( mapping.resolve( factory ) ) );
return mementos;
}
private static Class<?>[] toResultClasses(List<String> classNames, SessionFactoryImplementor factory) {
if ( classNames == null || classNames.isEmpty() ) {
return NO_CLASSES;
}
final ClassLoaderService classLoaderService = factory.getServiceRegistry().getService( ClassLoaderService.class );
final Class<?>[] classes = new Class[ classNames.size() ];
int i = 0;
for ( String className : classNames ) {
try {
classes[ i++ ] = classLoaderService.classForName( className );
}
catch (Exception e) {
throw new HibernateException( "Could not resolve class name given as procedure-call result class: " + className, e );
}
}
return classes;
} }
public static class Builder extends AbstractBuilder<Builder> { public static class Builder extends AbstractBuilder<Builder> {
private String callableName; private String callableName;
private List<Class> resultClasses; private List<String> resultSetMappingClassNames;
private List<String> resultSetMappingNames; private List<String> resultSetMappingNames;
private ParameterStrategy parameterStrategy = ParameterStrategy.UNKNOWN; private ParameterStrategy parameterStrategy = ParameterStrategy.UNKNOWN;
private List<NamedCallableQueryParameterMapping> parameterMappings; private List<ParameterMapping> parameterMappings;
public Builder(String name) { public Builder(String name) {
super( name ); super( name );
@ -119,6 +150,21 @@ public class NamedCallableQueryMappingImpl extends AbstractNamedQueryMapping imp
return this; return this;
} }
public Builder setCallableName(String callableName) {
this.callableName = callableName;
return this;
}
public Builder setResultSetMappingClassNames(List<String> resultSetMappingClassNames) {
this.resultSetMappingClassNames = resultSetMappingClassNames;
return this;
}
public Builder setResultSetMappingNames(List<String> resultSetMappingNames) {
this.resultSetMappingNames = resultSetMappingNames;
return this;
}
public Builder consume(StoredProcedureParameter[] parameters) { public Builder consume(StoredProcedureParameter[] parameters) {
if ( parameters != null && parameters.length > 0 ) { if ( parameters != null && parameters.length > 0 ) {
for ( StoredProcedureParameter parameter : parameters ) { for ( StoredProcedureParameter parameter : parameters ) {
@ -132,11 +178,12 @@ public class NamedCallableQueryMappingImpl extends AbstractNamedQueryMapping imp
if ( BinderHelper.isEmptyAnnotationValue( parameter.name() ) ) { if ( BinderHelper.isEmptyAnnotationValue( parameter.name() ) ) {
consumeNamedParameter( parameter.name(), parameter.type(), parameter.mode() ); consumeNamedParameter( parameter.name(), parameter.type(), parameter.mode() );
} }
if ( parameter.name() != null ) { else {
consumePositionalParameter( parameter.type(), parameter.mode() );
} }
} }
private void consumeNamedParameter(String name, Class type, ParameterMode mode) { private void consumeNamedParameter(String name, Class javaType, ParameterMode mode) {
if ( parameterStrategy == ParameterStrategy.POSITIONAL ) { if ( parameterStrategy == ParameterStrategy.POSITIONAL ) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Named queries cannot mix named and positional parameters: " + getName() "Named queries cannot mix named and positional parameters: " + getName()
@ -144,50 +191,44 @@ public class NamedCallableQueryMappingImpl extends AbstractNamedQueryMapping imp
} }
parameterStrategy = ParameterStrategy.NAMED; parameterStrategy = ParameterStrategy.NAMED;
final NamedCallableQueryParameterMapping namedParameter = new NamedCallableQueryParameterMapping() {
@Override
public ParameterMemento resolve(SessionFactoryImplementor factory) {
return session -> new ProcedureParameterImpl(
label,
mode,
javaType,
factory.getMetamodel().getTypeConfiguration().standardBasicTypeForJavaType( javaType ),
factory.getSessionFactoryOptions().isProcedureParameterNullPassingEnabled()
);
}
};
parameterMappings.add( namedParameter );
}
@Override parameterMappings.add(
protected NamedCallableQueryParameterMapping createPositionalParameter(int label, Class javaType, ParameterMode mode) { (ParameterMapping) factory -> session -> new ProcedureParameterImpl(
return
}
@Override
protected NamedCallableQueryParameterMapping createNamedParameter(String name, Class javaType, ParameterMode mode) {
//noinspection Convert2Lambda
return new NamedQueryParameterMapping() {
@Override
@SuppressWarnings("unchecked")
public ParameterMemento resolve(SessionFactoryImplementor factory) {
return session -> new ProcedureParameterImpl(
name, name,
mode, mode,
javaType, javaType,
factory.getMetamodel().getTypeConfiguration().standardBasicTypeForJavaType( javaType ), factory.getMetamodel().getTypeConfiguration().standardBasicTypeForJavaType( javaType ),
factory.getSessionFactoryOptions().isProcedureParameterNullPassingEnabled() factory.getSessionFactoryOptions().isProcedureParameterNullPassingEnabled()
); )
} );
}; }
private void consumePositionalParameter(Class javaType, ParameterMode mode) {
if ( parameterStrategy == ParameterStrategy.POSITIONAL ) {
throw new IllegalArgumentException(
"Named queries cannot mix named and positional parameters: " + getName()
);
}
parameterStrategy = ParameterStrategy.POSITIONAL;
parameterMappings.add(
(ParameterMapping) factory -> session -> new ProcedureParameterImpl(
parameterMappings.size(),
mode,
javaType,
factory.getMetamodel().getTypeConfiguration().standardBasicTypeForJavaType( javaType ),
factory.getSessionFactoryOptions().isProcedureParameterNullPassingEnabled()
)
} }
public NamedCallableQueryMapping build() { public NamedCallableQueryMapping build() {
return new NamedCallableQueryMappingImpl( return new NamedCallableQueryMappingImpl(
getName(), getName(),
callableName, callableName,
getParameterMappings(), parameterMappings,
resultClasses, resultSetMappingClassNames,
resultSetMappingNames, resultSetMappingNames,
getQuerySpaces(), getQuerySpaces(),
getCacheable(), getCacheable(),
@ -202,18 +243,5 @@ public class NamedCallableQueryMappingImpl extends AbstractNamedQueryMapping imp
getHints() getHints()
); );
} }
public Builder setCallableName(String callableName) {
this.callableName = callableName;
return this;
}
}
private static class NamedCallableQueryParameterMapping implements NamedQueryParameterMapping {
@Override
public ParameterMemento resolve(SessionFactoryImplementor factory) {
return null;
}
} }
} }

View File

@ -6,17 +6,13 @@
*/ */
package org.hibernate.boot.internal; package org.hibernate.boot.internal;
import java.util.List;
import java.util.Map; import java.util.Map;
import javax.persistence.ParameterMode;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.FlushMode; import org.hibernate.FlushMode;
import org.hibernate.LockOptions; import org.hibernate.LockOptions;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.boot.spi.AbstractNamedQueryMapping; import org.hibernate.boot.spi.AbstractNamedQueryMapping;
import org.hibernate.boot.spi.NamedHqlQueryMapping; import org.hibernate.boot.spi.NamedHqlQueryMapping;
import org.hibernate.boot.spi.NamedQueryParameterMapping;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.query.hql.internal.NamedHqlQueryMementoImpl; import org.hibernate.query.hql.internal.NamedHqlQueryMementoImpl;
import org.hibernate.query.hql.spi.NamedHqlQueryMemento; import org.hibernate.query.hql.spi.NamedHqlQueryMemento;
@ -28,11 +24,11 @@ public class NamedHqlQueryMappingImpl extends AbstractNamedQueryMapping implemen
private final String hqlString; private final String hqlString;
private final Integer firstResult; private final Integer firstResult;
private final Integer maxResults; private final Integer maxResults;
private final Map<String, String> parameterTypes;
public NamedHqlQueryMappingImpl( public NamedHqlQueryMappingImpl(
String name, String name,
String hqlString, String hqlString,
List<NamedQueryParameterMapping> parameterMappings,
Integer firstResult, Integer firstResult,
Integer maxResults, Integer maxResults,
Boolean cacheable, Boolean cacheable,
@ -44,10 +40,10 @@ public class NamedHqlQueryMappingImpl extends AbstractNamedQueryMapping implemen
Integer timeout, Integer timeout,
Integer fetchSize, Integer fetchSize,
String comment, String comment,
Map<String,String> parameterTypes,
Map<String,Object> hints) { Map<String,Object> hints) {
super( super(
name, name,
parameterMappings,
cacheable, cacheable,
cacheRegion, cacheRegion,
cacheMode, cacheMode,
@ -62,6 +58,7 @@ public class NamedHqlQueryMappingImpl extends AbstractNamedQueryMapping implemen
this.hqlString = hqlString; this.hqlString = hqlString;
this.firstResult = firstResult; this.firstResult = firstResult;
this.maxResults = maxResults; this.maxResults = maxResults;
this.parameterTypes = parameterTypes;
} }
@Override @Override
@ -74,7 +71,6 @@ public class NamedHqlQueryMappingImpl extends AbstractNamedQueryMapping implemen
return new NamedHqlQueryMementoImpl( return new NamedHqlQueryMementoImpl(
getName(), getName(),
hqlString, hqlString,
resolveParameterMappings( factory ),
firstResult, firstResult,
maxResults, maxResults,
getCacheable(), getCacheable(),
@ -86,6 +82,7 @@ public class NamedHqlQueryMappingImpl extends AbstractNamedQueryMapping implemen
getTimeout(), getTimeout(),
getFetchSize(), getFetchSize(),
getComment(), getComment(),
parameterTypes,
getHints() getHints()
); );
} }
@ -96,6 +93,8 @@ public class NamedHqlQueryMappingImpl extends AbstractNamedQueryMapping implemen
private Integer firstResult; private Integer firstResult;
private Integer maxResults; private Integer maxResults;
private Map<String,String> parameterTypes;
public Builder(String name, String hqlString) { public Builder(String name, String hqlString) {
super( name ); super( name );
this.hqlString = hqlString; this.hqlString = hqlString;
@ -116,33 +115,10 @@ public class NamedHqlQueryMappingImpl extends AbstractNamedQueryMapping implemen
return getThis(); return getThis();
} }
@Override
protected NamedQueryParameterMapping createPositionalParameter(int i, Class javaType, ParameterMode mode) {
/// todo (6.0) : this really ought to just adjust the type, if one...
throw new NotYetImplementedFor6Exception();
// return new ParameterDefinition() {
// @Override
// public ParameterDescriptor resolve(SessionFactoryImplementor factory) {
// return new ParameterDescriptor() {
// @Override
// public QueryParameter toQueryParameter(SharedSessionContractImplementor session) {
// return new QueryParameterPositionalImpl( i, );
// }
// };
// }
// };
}
@Override
protected NamedQueryParameterMapping createNamedParameter(String name, Class javaType, ParameterMode mode) {
throw new NotYetImplementedFor6Exception();
}
public NamedHqlQueryMappingImpl build() { public NamedHqlQueryMappingImpl build() {
return new NamedHqlQueryMappingImpl( return new NamedHqlQueryMappingImpl(
getName(), getName(),
hqlString, hqlString,
getParameterMappings(),
firstResult, firstResult,
maxResults, maxResults,
getCacheable(), getCacheable(),
@ -154,6 +130,7 @@ public class NamedHqlQueryMappingImpl extends AbstractNamedQueryMapping implemen
getTimeout(), getTimeout(),
getFetchSize(), getFetchSize(),
getComment(), getComment(),
parameterTypes,
getHints() getHints()
); );
} }

View File

@ -16,7 +16,6 @@ import org.hibernate.FlushMode;
import org.hibernate.LockOptions; import org.hibernate.LockOptions;
import org.hibernate.boot.spi.AbstractNamedQueryMapping; import org.hibernate.boot.spi.AbstractNamedQueryMapping;
import org.hibernate.boot.spi.NamedNativeQueryMapping; import org.hibernate.boot.spi.NamedNativeQueryMapping;
import org.hibernate.boot.spi.NamedQueryParameterMapping;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.query.sql.internal.NamedNativeQueryMementoImpl; import org.hibernate.query.sql.internal.NamedNativeQueryMementoImpl;
import org.hibernate.query.sql.spi.NamedNativeQueryMemento; import org.hibernate.query.sql.spi.NamedNativeQueryMemento;

View File

@ -9,7 +9,6 @@ package org.hibernate.boot.spi;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.persistence.ParameterMode; import javax.persistence.ParameterMode;
@ -17,7 +16,6 @@ import javax.persistence.ParameterMode;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.FlushMode; import org.hibernate.FlushMode;
import org.hibernate.LockOptions; import org.hibernate.LockOptions;
import org.hibernate.engine.spi.SessionFactoryImplementor;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
@ -25,8 +23,6 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
public abstract class AbstractNamedQueryMapping implements NamedQueryMapping { public abstract class AbstractNamedQueryMapping implements NamedQueryMapping {
private final String name; private final String name;
private final List<? extends NamedQueryParameterMapping> parameterMappings;
private final Boolean cacheable; private final Boolean cacheable;
private final String cacheRegion; private final String cacheRegion;
private final CacheMode cacheMode; private final CacheMode cacheMode;
@ -45,7 +41,6 @@ public abstract class AbstractNamedQueryMapping implements NamedQueryMapping {
public AbstractNamedQueryMapping( public AbstractNamedQueryMapping(
String name, String name,
List<? extends NamedQueryParameterMapping> parameterMappings,
Boolean cacheable, Boolean cacheable,
String cacheRegion, String cacheRegion,
CacheMode cacheMode, CacheMode cacheMode,
@ -57,9 +52,6 @@ public abstract class AbstractNamedQueryMapping implements NamedQueryMapping {
String comment, String comment,
Map<String,Object> hints) { Map<String,Object> hints) {
this.name = name; this.name = name;
this.parameterMappings = parameterMappings == null
? new ArrayList<>()
: new ArrayList<>( parameterMappings );
this.cacheable = cacheable; this.cacheable = cacheable;
this.cacheRegion = cacheRegion; this.cacheRegion = cacheRegion;
this.cacheMode = cacheMode; this.cacheMode = cacheMode;
@ -117,16 +109,11 @@ public abstract class AbstractNamedQueryMapping implements NamedQueryMapping {
return hints; return hints;
} }
protected List<? extends ParameterMemento> resolveParameterMappings(SessionFactoryImplementor factory) {
final ArrayList<ParameterMemento> descriptors = new ArrayList<>();
parameterMappings.forEach( parameterMapping -> descriptors.add( parameterMapping.resolve( factory ) ) );
return descriptors;
}
protected static abstract class AbstractBuilder<T extends AbstractBuilder> { protected static abstract class AbstractBuilder<T extends AbstractBuilder> {
private final String name; private final String name;
private Set<String> querySpaces; private Set<String> querySpaces;
private Boolean cacheable; private Boolean cacheable;
private String cacheRegion; private String cacheRegion;
private CacheMode cacheMode; private CacheMode cacheMode;
@ -153,40 +140,6 @@ public abstract class AbstractNamedQueryMapping implements NamedQueryMapping {
protected abstract T getThis(); protected abstract T getThis();
public T addParameter(Class javaType, ParameterMode mode) {
return addParameter(
createPositionalParameter(
parameterMappings.size() + 1,
javaType,
mode
)
);
}
protected abstract NamedQueryParameterMapping createPositionalParameter(int i, Class javaType, ParameterMode mode);
public <P extends NamedQueryParameterMapping> T addParameter(P parameterMapping) {
if ( parameterMappings == null ) {
parameterMappings = new ArrayList<>();
}
parameterMappings.add( (P) parameterMapping );
return getThis();
}
public T addParameter(String name, Class javaType, ParameterMode mode) {
if ( parameterMappings == null ) {
parameterMappings = new ArrayList<>();
}
parameterMappings.add( createNamedParameter( name, javaType, mode ) );
return getThis();
}
protected abstract <P extends NamedQueryParameterMapping> P createNamedParameter(String name, Class javaType, ParameterMode mode);
public T addQuerySpaces(Set<String> querySpaces) { public T addQuerySpaces(Set<String> querySpaces) {
if ( querySpaces == null || querySpaces.isEmpty() ) { if ( querySpaces == null || querySpaces.isEmpty() ) {
@ -298,10 +251,6 @@ public abstract class AbstractNamedQueryMapping implements NamedQueryMapping {
return comment; return comment;
} }
protected List<? extends NamedQueryParameterMapping> getParameterMappings() {
return parameterMappings;
}
public void addHint(String name, Object value) { public void addHint(String name, Object value) {
if ( hints == null ) { if ( hints == null ) {
hints = new HashMap<>(); hints = new HashMap<>();

View File

@ -6,9 +6,8 @@
*/ */
package org.hibernate.boot.spi; package org.hibernate.boot.spi;
import java.util.List;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.procedure.internal.NamedCallableQueryMementoImpl;
import org.hibernate.procedure.spi.NamedCallableQueryMemento; import org.hibernate.procedure.spi.NamedCallableQueryMemento;
/** /**
@ -18,9 +17,10 @@ import org.hibernate.procedure.spi.NamedCallableQueryMemento;
* @author Gavin King * @author Gavin King
*/ */
public interface NamedCallableQueryMapping extends NamedQueryMapping { public interface NamedCallableQueryMapping extends NamedQueryMapping {
List<String> getResultSetMappingNames();
List<Class> getResultSetMappingClasses();
@Override @Override
NamedCallableQueryMemento resolve(SessionFactoryImplementor factory); NamedCallableQueryMemento resolve(SessionFactoryImplementor factory);
interface ParameterMapping {
NamedCallableQueryMementoImpl.ParameterMementoImpl resolve(SessionFactoryImplementor factory);
}
} }

View File

@ -1,22 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.boot.spi;
import org.hibernate.engine.spi.SessionFactoryImplementor;
/**
* Describes a parameter defined in the mapping of a {@link NamedQueryMapping}
*
* @author Steve Ebersole
* @author Gavin King
*/
public interface NamedQueryParameterMapping {
/**
* Resolve the mapping definition into its run-time memento form
*/
ParameterMemento resolve(SessionFactoryImplementor factory);
}

View File

@ -13,15 +13,14 @@ import javax.persistence.ParameterMode;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.FlushMode; import org.hibernate.FlushMode;
import org.hibernate.LockOptions; import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.procedure.ProcedureCall; import org.hibernate.procedure.ProcedureCall;
import org.hibernate.procedure.spi.NamedCallableQueryMemento; import org.hibernate.procedure.spi.NamedCallableQueryMemento;
import org.hibernate.procedure.spi.ParameterRegistrationImplementor; import org.hibernate.procedure.spi.ParameterRegistrationImplementor;
import org.hibernate.procedure.spi.ParameterStrategy; import org.hibernate.procedure.spi.ParameterStrategy;
import org.hibernate.query.QueryParameter;
import org.hibernate.query.spi.AbstractNamedQueryMemento; import org.hibernate.query.spi.AbstractNamedQueryMemento;
import org.hibernate.query.spi.NamedQueryMemento;
import org.hibernate.type.Type; import org.hibernate.type.Type;
/** /**
@ -31,9 +30,13 @@ import org.hibernate.type.Type;
*/ */
public class NamedCallableQueryMementoImpl extends AbstractNamedQueryMemento implements NamedCallableQueryMemento { public class NamedCallableQueryMementoImpl extends AbstractNamedQueryMemento implements NamedCallableQueryMemento {
private final String callableName; private final String callableName;
private final ParameterStrategy parameterStrategy; private final ParameterStrategy parameterStrategy;
private final Class[] resultClasses; private final List<ParameterMemento> parameterMementos;
private final String[] resultSetMappingNames; private final String[] resultSetMappingNames;
private final Class[] resultSetMappingClasses;
private final Set<String> querySpaces; private final Set<String> querySpaces;
@ -44,29 +47,26 @@ public class NamedCallableQueryMementoImpl extends AbstractNamedQueryMemento imp
String name, String name,
String callableName, String callableName,
ParameterStrategy parameterStrategy, ParameterStrategy parameterStrategy,
List<CallableParameterMemento> parameterMementos, List<ParameterMemento> parameterMementos,
Class[] resultClasses,
String[] resultSetMappingNames, String[] resultSetMappingNames,
Class[] resultSetMappingClasses,
Set<String> querySpaces, Set<String> querySpaces,
Boolean cacheable, Boolean cacheable,
String cacheRegion, String cacheRegion,
CacheMode cacheMode, CacheMode cacheMode,
FlushMode flushMode, FlushMode flushMode,
Boolean readOnly, Boolean readOnly,
LockOptions lockOptions,
Integer timeout, Integer timeout,
Integer fetchSize, Integer fetchSize,
String comment, String comment,
Map<String, Object> hints) { Map<String, Object> hints) {
super( super(
name, name,
parameterMementos,
cacheable, cacheable,
cacheRegion, cacheRegion,
cacheMode, cacheMode,
flushMode, flushMode,
readOnly, readOnly,
lockOptions,
timeout, timeout,
fetchSize, fetchSize,
comment, comment,
@ -74,45 +74,48 @@ public class NamedCallableQueryMementoImpl extends AbstractNamedQueryMemento imp
); );
this.callableName = callableName; this.callableName = callableName;
this.parameterStrategy = parameterStrategy; this.parameterStrategy = parameterStrategy;
this.resultClasses = resultClasses; this.parameterMementos = parameterMementos;
this.resultSetMappingNames = resultSetMappingNames; this.resultSetMappingNames = resultSetMappingNames;
this.resultSetMappingClasses = resultSetMappingClasses;
this.querySpaces = querySpaces; this.querySpaces = querySpaces;
} }
@Override
public String getCallableName() {
return callableName;
}
@Override @Override
public ProcedureCall makeProcedureCall(SharedSessionContractImplementor session) { public ProcedureCall makeProcedureCall(SharedSessionContractImplementor session) {
return new ProcedureCallImpl( session, this ); return new ProcedureCallImpl( session, this );
} }
public String getCallableName() {
return callableName;
}
public NativeSQLQueryReturn[] getQueryReturns() {
return queryReturns;
}
public ParameterStrategy getParameterStrategy() {
return parameterStrategy;
}
public List<ParameterMemento> getParameterDeclarations() {
return parameterDeclarations;
}
public Set<String> getSynchronizedQuerySpaces() {
return synchronizedQuerySpaces;
}
@Override @Override
public Map<String, Object> getHintsMap() { public NamedQueryMemento makeCopy(String name) {
return hintsMap; return new NamedCallableQueryMementoImpl(
name,
callableName,
parameterStrategy,
parameterMementos,
resultSetMappingNames,
resultSetMappingClasses,
querySpaces,
cacheable,
cacheRegion,
cacheMode,
flushMode,
readOnly,
timeout,
fetchSize,
comment,
hints
);
} }
/** /**
* A "disconnected" copy of the metadata for a parameter, that can be used in ProcedureCallMementoImpl. * A "disconnected" copy of the metadata for a parameter, that can be used in ProcedureCallMementoImpl.
*/ */
public static class CallableParameterMemento implements ParameterMemento { public static class ParameterMementoImpl implements ParameterMemento {
private final Integer position; private final Integer position;
private final String name; private final String name;
private final ParameterMode mode; private final ParameterMode mode;
@ -130,7 +133,7 @@ public class NamedCallableQueryMementoImpl extends AbstractNamedQueryMemento imp
* @param hibernateType The Hibernate Type. * @param hibernateType The Hibernate Type.
* @param passNulls Should NULL values to passed to the database? * @param passNulls Should NULL values to passed to the database?
*/ */
public CallableParameterMemento( public ParameterMementoImpl(
int position, int position,
String name, String name,
ParameterMode mode, ParameterMode mode,
@ -170,8 +173,8 @@ public class NamedCallableQueryMementoImpl extends AbstractNamedQueryMemento imp
} }
@Override @Override
public QueryParameter toQueryParameter(SharedSessionContractImplementor session) { public ParameterRegistrationImplementor resolve(SharedSessionContractImplementor session) {
return null; throw new NotYetImplementedFor6Exception();
} }
/** /**
@ -181,8 +184,8 @@ public class NamedCallableQueryMementoImpl extends AbstractNamedQueryMemento imp
* *
* @return The memento * @return The memento
*/ */
public static ParameterMemento fromRegistration(ParameterRegistrationImplementor registration) { public static ParameterMementoImpl fromRegistration(ParameterRegistrationImplementor registration) {
return new ParameterMemento( return new ParameterMementoImpl(
registration.getPosition(), registration.getPosition(),
registration.getName(), registration.getName(),
registration.getMode(), registration.getMode(),

View File

@ -6,8 +6,6 @@
*/ */
package org.hibernate.procedure.spi; package org.hibernate.procedure.spi;
import java.util.Map;
import org.hibernate.Incubating; import org.hibernate.Incubating;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SessionImplementor;
@ -22,16 +20,8 @@ import org.hibernate.query.spi.NamedQueryMemento;
*/ */
@Incubating @Incubating
public interface NamedCallableQueryMemento extends NamedQueryMemento { public interface NamedCallableQueryMemento extends NamedQueryMemento {
@Override
default String getQueryString() {
return getCallableName();
}
/** /**
* The name of the database callable to execute. Whereas {@link #getName()} * Informational access to the name of the database function or procedure
* describes the name under which the named query is registered with the
* SessionFactory, the callable name is the actual database procedure/function
* name
*/ */
String getCallableName(); String getCallableName();
@ -66,12 +56,7 @@ public interface NamedCallableQueryMemento extends NamedQueryMemento {
*/ */
ProcedureCall makeProcedureCall(SharedSessionContractImplementor session); ProcedureCall makeProcedureCall(SharedSessionContractImplementor session);
/** interface ParameterMemento {
* Access to any hints associated with the memento. ParameterRegistrationImplementor resolve(SharedSessionContractImplementor session);
* <p/> }
* IMPL NOTE : exposed separately because only HEM needs access to this.
*
* @return The hints.
*/
Map<String, Object> getHintsMap();
} }

View File

@ -9,11 +9,10 @@ package org.hibernate.query.hql.spi;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.hibernate.CacheMode;
import org.hibernate.FlushMode;
import org.hibernate.LockOptions; import org.hibernate.LockOptions;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.query.hql.internal.NamedHqlQueryMementoImpl; import org.hibernate.query.hql.internal.NamedHqlQueryMementoImpl;
import org.hibernate.query.spi.AbstractNamedQueryMemento;
import org.hibernate.query.spi.NamedQueryMemento; import org.hibernate.query.spi.NamedQueryMemento;
/** /**
@ -22,11 +21,18 @@ import org.hibernate.query.spi.NamedQueryMemento;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface NamedHqlQueryMemento extends NamedQueryMemento { public interface NamedHqlQueryMemento extends NamedQueryMemento {
@Override /**
NamedHqlQueryMemento makeCopy(String name); * Informational access to the HQL query string
*/
String getHqlString();
/**
* Convert the memento into an executable query
*/
<T> HqlQueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> resultType);
@Override @Override
<T> HqlQueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> resultType); NamedHqlQueryMemento makeCopy(String name);
/** /**
* Delegate used in creating named HQL query mementos. * Delegate used in creating named HQL query mementos.
@ -34,67 +40,20 @@ public interface NamedHqlQueryMemento extends NamedQueryMemento {
* @see org.hibernate.boot.spi.NamedHqlQueryMapping * @see org.hibernate.boot.spi.NamedHqlQueryMapping
* @see HqlQueryImplementor#toMemento * @see HqlQueryImplementor#toMemento
*/ */
class Builder { class Builder extends AbstractNamedQueryMemento.AbstractBuilder<Builder> {
protected String name; protected String hqlString;
protected String queryString;
protected boolean cacheable;
protected String cacheRegion;
protected CacheMode cacheMode;
protected Integer timeout;
protected Integer fetchSize;
protected FlushMode flushMode;
protected boolean readOnly;
protected String comment;
protected LockOptions lockOptions; protected LockOptions lockOptions;
protected Integer firstResult; protected Integer firstResult;
protected Integer maxResults; protected Integer maxResults;
protected Map<String,String> parameterTypes; protected Map<String,String> parameterTypes;
protected Map<String,Object> hints;
public Builder() {
}
public Builder(String name) { public Builder(String name) {
this.name = name; super( name );
} }
public Builder setName(String name) { @Override
this.name = name; protected Builder getThis() {
return this;
}
public Builder setQuery(String queryString) {
this.queryString = queryString;
return this;
}
public Builder setCacheable(boolean cacheable) {
this.cacheable = cacheable;
return this;
}
public Builder setCacheRegion(String cacheRegion) {
this.cacheRegion = cacheRegion;
return this;
}
public Builder setTimeout(Integer timeout) {
this.timeout = timeout;
return this;
}
public Builder setFetchSize(Integer fetchSize) {
this.fetchSize = fetchSize;
return this;
}
public Builder setFlushMode(FlushMode flushMode) {
this.flushMode = flushMode;
return this;
}
public Builder setCacheMode(CacheMode cacheMode) {
this.cacheMode = cacheMode;
return this; return this;
} }
@ -103,11 +62,6 @@ public interface NamedHqlQueryMemento extends NamedQueryMemento {
return this; return this;
} }
public Builder setComment(String comment) {
this.comment = comment;
return this;
}
public Builder addParameterType(String name, String typeName) { public Builder addParameterType(String name, String typeName) {
if ( this.parameterTypes == null ) { if ( this.parameterTypes == null ) {
this.parameterTypes = new HashMap<>(); this.parameterTypes = new HashMap<>();
@ -139,7 +93,7 @@ public interface NamedHqlQueryMemento extends NamedQueryMemento {
public NamedHqlQueryMemento createNamedQueryDefinition() { public NamedHqlQueryMemento createNamedQueryDefinition() {
return new NamedHqlQueryMementoImpl( return new NamedHqlQueryMementoImpl(
name, name,
queryString, hqlString,
firstResult, firstResult,
maxResults, maxResults,
cacheable, cacheable,

View File

@ -140,7 +140,7 @@ public class NamedQueryRepositoryImpl implements NamedQueryRepository {
// this will throw an error if there's something wrong. // this will throw an error if there's something wrong.
try { try {
log.debugf( "Checking named query: %s", hqlMemento.getName() ); log.debugf( "Checking named query: %s", hqlMemento.getName() );
final SqmStatement sqmStatement = sqmProducer.interpret( hqlMemento.getQueryString() ); final SqmStatement sqmStatement = sqmProducer.interpret( hqlMemento.getHqlString() );
if ( cachingEnabled ) { if ( cachingEnabled ) {
// todo (6.0) : need to cache these; however atm that requires producing a SqmQueryImpl // todo (6.0) : need to cache these; however atm that requires producing a SqmQueryImpl

View File

@ -6,17 +6,13 @@
*/ */
package org.hibernate.query.spi; package org.hibernate.query.spi;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.persistence.ParameterMode;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.FlushMode; import org.hibernate.FlushMode;
import org.hibernate.LockOptions;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
/** /**
@ -106,23 +102,23 @@ public abstract class AbstractNamedQueryMemento implements NamedQueryMemento {
} }
} }
protected static abstract class AbstractBuilder<T extends AbstractBuilder> { public static abstract class AbstractBuilder<T extends AbstractBuilder> {
private final String name; protected final String name;
private Set<String> querySpaces; protected Set<String> querySpaces;
private Boolean cacheable; protected Boolean cacheable;
private String cacheRegion; protected String cacheRegion;
private CacheMode cacheMode; protected CacheMode cacheMode;
private FlushMode flushMode; protected FlushMode flushMode;
private Boolean readOnly; protected Boolean readOnly;
private Integer timeout; protected Integer timeout;
private Integer fetchSize; protected Integer fetchSize;
private String comment; protected String comment;
private Map<String,Object> hints; protected Map<String,Object> hints;
public AbstractBuilder(String name) { public AbstractBuilder(String name) {
this.name = name; this.name = name;
@ -170,11 +166,6 @@ public abstract class AbstractNamedQueryMemento implements NamedQueryMemento {
return getThis(); return getThis();
} }
public T setLockOptions(LockOptions lockOptions) {
this.lockOptions = lockOptions;
return getThis();
}
public T setTimeout(Integer timeout) { public T setTimeout(Integer timeout) {
this.timeout = timeout; this.timeout = timeout;
return getThis(); return getThis();
@ -190,6 +181,11 @@ public abstract class AbstractNamedQueryMemento implements NamedQueryMemento {
return getThis(); return getThis();
} }
public T setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
return getThis();
}
public T setFetchSize(Integer fetchSize) { public T setFetchSize(Integer fetchSize) {
this.fetchSize = fetchSize; this.fetchSize = fetchSize;
return getThis(); return getThis();
@ -224,10 +220,6 @@ public abstract class AbstractNamedQueryMemento implements NamedQueryMemento {
return readOnly; return readOnly;
} }
public LockOptions getLockOptions() {
return lockOptions;
}
public Integer getTimeout() { public Integer getTimeout() {
return timeout; return timeout;
} }
@ -240,19 +232,11 @@ public abstract class AbstractNamedQueryMemento implements NamedQueryMemento {
return comment; return comment;
} }
protected List<ParameterDefinition> getParameterDescriptors() {
return parameterDescriptors;
}
public void addHint(String name, Object value) { public void addHint(String name, Object value) {
if ( hints == null ) { if ( hints == null ) {
hints = new HashMap<>(); hints = new HashMap<>();
} }
hints.put( name, value ); hints.put( name, value );
} }
public Map<String, Object> getHints() {
return hints;
}
} }
} }

View File

@ -6,8 +6,6 @@
*/ */
package org.hibernate.query.spi; package org.hibernate.query.spi;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
/** /**
* Base contract for all named query mementos * Base contract for all named query mementos
* *
@ -23,9 +21,4 @@ public interface NamedQueryMemento {
* Makes a copy of the memento * Makes a copy of the memento
*/ */
NamedQueryMemento makeCopy(String name); NamedQueryMemento makeCopy(String name);
/**
* Convert the memento into an executable query
*/
<T> QueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> resultType);
} }

View File

@ -24,13 +24,17 @@ import org.hibernate.query.sql.spi.NativeQueryImplementor;
*/ */
public class NamedNativeQueryMementoImpl extends AbstractNamedQueryMemento implements NamedNativeQueryMemento { public class NamedNativeQueryMementoImpl extends AbstractNamedQueryMemento implements NamedNativeQueryMemento {
private final String sqlString; private final String sqlString;
private final String resultSetMappingName;
private String resultSetMappingName;
private String resultSetMappingClassName;
private final Set<String> querySpaces; private final Set<String> querySpaces;
public NamedNativeQueryMementoImpl( public NamedNativeQueryMementoImpl(
String name, String name,
String sqlString, String sqlString,
String resultSetMappingName, String resultSetMappingName,
String resultSetMappingClassName,
Set<String> querySpaces, Set<String> querySpaces,
Boolean cacheable, Boolean cacheable,
String cacheRegion, String cacheRegion,
@ -55,6 +59,7 @@ public class NamedNativeQueryMementoImpl extends AbstractNamedQueryMemento imple
); );
this.sqlString = sqlString; this.sqlString = sqlString;
this.resultSetMappingName = resultSetMappingName; this.resultSetMappingName = resultSetMappingName;
this.resultSetMappingClassName = resultSetMappingClassName;
this.querySpaces = querySpaces; this.querySpaces = querySpaces;
} }
@ -67,20 +72,19 @@ public class NamedNativeQueryMementoImpl extends AbstractNamedQueryMemento imple
public NamedNativeQueryMemento makeCopy(String name) { public NamedNativeQueryMemento makeCopy(String name) {
return new NamedNativeQueryMementoImpl( return new NamedNativeQueryMementoImpl(
name, name,
getParameterMementos(),
sqlString, sqlString,
resultSetMappingName, resultSetMappingName,
getQuerySpaces(), resultSetMappingClassName,
getCacheable(), querySpaces,
getCacheRegion(), cacheable,
getCacheMode(), cacheRegion,
getFlushMode(), cacheMode,
getReadOnly(), flushMode,
getLockOptions(), readOnly,
getTimeout(), timeout,
getFetchSize(), fetchSize,
getComment(), comment,
getHints() hints
); );
} }

View File

@ -6,11 +6,10 @@
*/ */
package org.hibernate.query.sql.spi; package org.hibernate.query.sql.spi;
import java.util.Collection; import java.util.Set;
import org.hibernate.CacheMode;
import org.hibernate.FlushMode;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.query.spi.AbstractNamedQueryMemento;
import org.hibernate.query.spi.NamedQueryMemento; import org.hibernate.query.spi.NamedQueryMemento;
import org.hibernate.query.sql.internal.NamedNativeQueryMementoImpl; import org.hibernate.query.sql.internal.NamedNativeQueryMementoImpl;
@ -20,48 +19,42 @@ import org.hibernate.query.sql.internal.NamedNativeQueryMementoImpl;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface NamedNativeQueryMemento extends NamedQueryMemento { public interface NamedNativeQueryMemento extends NamedQueryMemento {
/**
* Informational access to the SQL query string
*/
String getSqlString(); String getSqlString();
/**
* Convert the memento into an executable query
*/
<T> NativeQueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> resultType);
@Override @Override
NamedNativeQueryMemento makeCopy(String name); NamedNativeQueryMemento makeCopy(String name);
@Override
<T> NativeQueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> resultType);
/** /**
* Delegate used in creating named HQL query mementos. * Delegate used in creating named HQL query mementos.
* *
* @see org.hibernate.boot.spi.NamedNativeQueryMapping * @see org.hibernate.boot.spi.NamedNativeQueryMapping
*/ */
class Builder { class Builder extends AbstractNamedQueryMemento.AbstractBuilder<Builder> {
protected String name;
protected String queryString; protected String queryString;
protected boolean cacheable;
protected String cacheRegion;
protected CacheMode cacheMode;
protected Integer timeout;
protected Integer fetchSize;
protected FlushMode flushMode;
protected boolean readOnly;
protected String comment;
protected Integer firstResult; protected Integer firstResult;
protected Integer maxResults; protected Integer maxResults;
private Collection<String> querySpaces; protected Set<String> querySpaces;
private String resultSetMappingName;
private String resultSetMappingClassName;
protected String resultSetMappingName;
protected String resultSetMappingClassName;
public Builder() {
}
public Builder(String name) { public Builder(String name) {
this.name = name; super( name );
} }
public Builder setName(String name) { @Override
this.name = name; protected Builder getThis() {
return this; return this;
} }
@ -75,41 +68,6 @@ public interface NamedNativeQueryMemento extends NamedQueryMemento {
return this; return this;
} }
public Builder setCacheRegion(String cacheRegion) {
this.cacheRegion = cacheRegion;
return this;
}
public Builder setCacheMode(CacheMode cacheMode) {
this.cacheMode = cacheMode;
return this;
}
public Builder setTimeout(Integer timeout) {
this.timeout = timeout;
return this;
}
public Builder setFetchSize(Integer fetchSize) {
this.fetchSize = fetchSize;
return this;
}
public Builder setFlushMode(FlushMode flushMode) {
this.flushMode = flushMode;
return this;
}
public Builder setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
return this;
}
public Builder setComment(String comment) {
this.comment = comment;
return this;
}
public Builder setFirstResult(Integer firstResult) { public Builder setFirstResult(Integer firstResult) {
this.firstResult = firstResult; this.firstResult = firstResult;
return this; return this;
@ -120,7 +78,7 @@ public interface NamedNativeQueryMemento extends NamedQueryMemento {
return this; return this;
} }
public void setQuerySpaces(Collection<String> querySpaces) { public void setQuerySpaces(Set<String> querySpaces) {
this.querySpaces = querySpaces; this.querySpaces = querySpaces;
} }
@ -132,20 +90,22 @@ public interface NamedNativeQueryMemento extends NamedQueryMemento {
this.resultSetMappingClassName = resultSetMappingClassName; this.resultSetMappingClassName = resultSetMappingClassName;
} }
public NamedNativeQueryMemento createNamedQueryDefinition() { public NamedNativeQueryMemento build() {
return new NamedNativeQueryMementoImpl( return new NamedNativeQueryMementoImpl(
name, name,
queryString, queryString,
resultSetMappingName,
resultSetMappingClassName,
querySpaces,
cacheable, cacheable,
cacheRegion, cacheRegion,
cacheMode,
flushMode,
readOnly,
timeout, timeout,
fetchSize, fetchSize,
flushMode,
cacheMode,
readOnly,
comment, comment,
firstResult, hints
maxResults
); );
} }
} }