org.hibernate.engine.spi.NamedSQLQueryDefinitionBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
JPMS Module-Info's for a few of the Jakarta Libraries just until they add them in themselves
/*
* 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 .
*/
package org.hibernate.engine.spi;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.hibernate.CacheMode;
import org.hibernate.FlushMode;
import org.hibernate.LockOptions;
import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn;
public class NamedSQLQueryDefinitionBuilder extends NamedQueryDefinitionBuilder {
private NativeSQLQueryReturn[] queryReturns;
private Collection querySpaces;
private boolean callable;
private String resultSetRef;
public NamedSQLQueryDefinitionBuilder() {
}
public NamedSQLQueryDefinitionBuilder(String name) {
super( name );
}
public NamedSQLQueryDefinitionBuilder setQueryReturns(NativeSQLQueryReturn[] queryReturns) {
this.queryReturns = queryReturns;
return this;
}
public NamedSQLQueryDefinitionBuilder setQueryReturns(List queryReturns) {
if ( queryReturns != null ) {
this.queryReturns = queryReturns.toArray( new NativeSQLQueryReturn[ queryReturns.size() ] );
}
else {
this.queryReturns = null;
}
return this;
}
public NamedSQLQueryDefinitionBuilder setQuerySpaces(List querySpaces) {
this.querySpaces = querySpaces;
return this;
}
public NamedSQLQueryDefinitionBuilder setQuerySpaces(Collection synchronizedQuerySpaces) {
this.querySpaces = synchronizedQuerySpaces;
return this;
}
public NamedSQLQueryDefinitionBuilder addSynchronizedQuerySpace(String table) {
if ( this.querySpaces == null ) {
this.querySpaces = new ArrayList();
}
this.querySpaces.add( table );
return this;
}
public NamedSQLQueryDefinitionBuilder setResultSetRef(String resultSetRef) {
this.resultSetRef = resultSetRef;
return this;
}
public NamedSQLQueryDefinitionBuilder setCallable(boolean callable) {
this.callable = callable;
return this;
}
@Override
public NamedSQLQueryDefinitionBuilder setName(String name) {
return (NamedSQLQueryDefinitionBuilder) super.setName( name );
}
@Override
public NamedSQLQueryDefinitionBuilder setQuery(String query) {
return (NamedSQLQueryDefinitionBuilder) super.setQuery( query );
}
@Override
public NamedSQLQueryDefinitionBuilder setCacheable(boolean cacheable) {
return (NamedSQLQueryDefinitionBuilder) super.setCacheable( cacheable );
}
@Override
public NamedSQLQueryDefinitionBuilder setCacheRegion(String cacheRegion) {
return (NamedSQLQueryDefinitionBuilder) super.setCacheRegion( cacheRegion );
}
@Override
public NamedSQLQueryDefinitionBuilder setTimeout(Integer timeout) {
return (NamedSQLQueryDefinitionBuilder) super.setTimeout( timeout );
}
@Override
public NamedSQLQueryDefinitionBuilder setFetchSize(Integer fetchSize) {
return (NamedSQLQueryDefinitionBuilder) super.setFetchSize( fetchSize );
}
@Override
public NamedSQLQueryDefinitionBuilder setFlushMode(FlushMode flushMode) {
return (NamedSQLQueryDefinitionBuilder) super.setFlushMode( flushMode );
}
@Override
public NamedSQLQueryDefinitionBuilder setCacheMode(CacheMode cacheMode) {
return (NamedSQLQueryDefinitionBuilder) super.setCacheMode( cacheMode );
}
@Override
public NamedSQLQueryDefinitionBuilder setReadOnly(boolean readOnly) {
return (NamedSQLQueryDefinitionBuilder) super.setReadOnly( readOnly );
}
@Override
public NamedSQLQueryDefinitionBuilder setComment(String comment) {
return (NamedSQLQueryDefinitionBuilder) super.setComment( comment );
}
@Override
public NamedSQLQueryDefinitionBuilder addParameterType(String name, String typeName) {
return (NamedSQLQueryDefinitionBuilder) super.addParameterType( name, typeName );
}
@Override
public NamedSQLQueryDefinitionBuilder setParameterTypes(Map parameterTypes) {
return (NamedSQLQueryDefinitionBuilder) super.setParameterTypes( parameterTypes );
}
@Override
public NamedSQLQueryDefinitionBuilder setLockOptions(LockOptions lockOptions) {
// todo : maybe throw an exception here instead? since this is not valid for native-0sql queries?
return (NamedSQLQueryDefinitionBuilder) super.setLockOptions( lockOptions );
}
@Override
public NamedSQLQueryDefinitionBuilder setFirstResult(Integer firstResult) {
return (NamedSQLQueryDefinitionBuilder) super.setFirstResult( firstResult );
}
@Override
public NamedSQLQueryDefinitionBuilder setMaxResults(Integer maxResults) {
return (NamedSQLQueryDefinitionBuilder) super.setMaxResults( maxResults );
}
@Override
public NamedSQLQueryDefinitionBuilder setPassDistinctThrough(Boolean passDistinctThrough) {
return (NamedSQLQueryDefinitionBuilder) super.setPassDistinctThrough( passDistinctThrough );
}
@Override
public NamedSQLQueryDefinition createNamedQueryDefinition() {
return new NamedSQLQueryDefinition(
name,
query,
cacheable,
cacheRegion,
timeout,
fetchSize,
flushMode,
cacheMode,
readOnly,
comment,
parameterTypes,
firstResult,
maxResults,
resultSetRef,
querySpacesCopy(),
callable,
queryReturns,
passDistinctThrough
);
}
private List querySpacesCopy() {
return querySpaces == null
? null
: new ArrayList( querySpaces );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy