Top Inners Fields Constructors Methods
org.hibernate.loader.custom.sql

public Class SQLQueryParser

extends Object
Class Inheritance
Known Direct Subclasses
org.hibernate.persister.entity.AbstractEntityPersister.SubstituteBracketSQLQueryParser
Imports
java.util.ArrayList, .Collections, .List, .Map, java.util.regex.Pattern, org.hibernate.QueryException, org.hibernate.boot.model.naming.Identifier, org.hibernate.boot.model.relational.SqlStringGenerationContext, org.hibernate.engine.query.spi.ParameterParser, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.param.ParameterBinder, org.hibernate.persister.collection.SQLLoadableCollection, org.hibernate.persister.entity.SQLLoadable

Authors
Gavin King, Max Andersen, Steve Ebersole, Paul Benedict

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
pack-priv static interface

Field Summary

Modifier and TypeField and Description
private long
private static final String
private final SQLQueryParser.ParserContext
private static final String
private final SessionFactoryImplementor
factory

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
private static final String
private final String
private List<ParameterBinder>
private static final Pattern
private static final String

Constructor Summary

AccessConstructor and Description
public
SQLQueryParser(String queryString, SQLQueryParser.ParserContext context, SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.

Method Summary

Modifier and TypeMethod and Description
protected String
public List<ParameterBinder>
public String
public boolean
private String
resolveCollectionProperties(String aliasName, String propertyName)

private String
resolveProperties(String aliasName, String propertyName)

protected String
private String

Returns:

The SQL query with parameter substitution complete.
substituteParams
(String
The query string.
sqlString
)

Substitutes JDBC parameter placeholders (?) for all encountered parameter specifications.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasesFoundback to summary
private long aliasesFound
CATALOG_PLACEHOLDERback to summary
private static final String CATALOG_PLACEHOLDER
contextback to summary
private final SQLQueryParser.ParserContext context
DOMAIN_PLACEHOLDERback to summary
private static final String DOMAIN_PLACEHOLDER
factoryback to summary
private final SessionFactoryImplementor factory

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

HIBERNATE_PLACEHOLDER_PREFIXback to summary
private static final String HIBERNATE_PLACEHOLDER_PREFIX
originalQueryStringback to summary
private final String originalQueryString
paramValueBindersback to summary
private List<ParameterBinder> paramValueBinders
PREPARED_STATEMENT_PATTERNback to summary
private static final Pattern PREPARED_STATEMENT_PATTERN
SCHEMA_PLACEHOLDERback to summary
private static final String SCHEMA_PLACEHOLDER

Constructor Detail

SQLQueryParserback to summary
public SQLQueryParser(String queryString, SQLQueryParser.ParserContext context, SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Method Detail

getOriginalQueryStringback to summary
protected String getOriginalQueryString()
getParameterValueBindersback to summary
public List<ParameterBinder> getParameterValueBinders()
processback to summary
public String process()
queryHasAliasesback to summary
public boolean queryHasAliases()
resolveCollectionPropertiesback to summary
private String resolveCollectionProperties(String aliasName, String propertyName)
resolvePropertiesback to summary
private String resolveProperties(String aliasName, String propertyName)
substituteBracketsback to summary
protected String substituteBrackets(String sqlQuery) throws QueryException
substituteParamsback to summary
private String substituteParams(String sqlString)

Substitutes JDBC parameter placeholders (?) for all encountered parameter specifications. It also tracks the positions of these parameter specifications within the query string. This accounts for ordinal-params, named-params, and ejb3-positional-params.

Parameters
sqlString:String

The query string.

Returns:String

The SQL query with parameter substitution complete.

org.hibernate.loader.custom.sql back to summary

public Class SQLQueryParser.ParameterSubstitutionRecognizer

extends Object
implements Recognizer
Class Inheritance
  • java.lang.Object
  • org.hibernate.loader.custom.sql.SQLQueryParser.ParameterSubstitutionRecognizer
All Implemented Interfaces
org.hibernate.engine.query.spi.ParameterParser.Recognizer

Field Summary

Modifier and TypeField and Description
pack-priv int
private List<ParameterBinder>
pack-priv StringBuilder

Constructor Summary

AccessConstructor and Description
public
ParameterSubstitutionRecognizer(SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.

Method Summary

Modifier and TypeMethod and Description
public void
public List<ParameterBinder>
public void
jpaPositionalParameter(int
The identifier (name) of the JPA-style parameter
name
,
int
The position within the query
position
)

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.jpaPositionalParameter.

Called when a JPA-style named parameter is recognized
public void
namedParameter(String
The recognized parameter name
name
,
int
The position within the query
position
)

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.namedParameter.

Called when a named parameter is recognized
public void
ordinalParameter(int
The position within the query
position
)

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.ordinalParameter.

Called when an ordinal parameter is recognized
public void
other(char
The recognized character
character
)

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.other.

Called when a character that is not a parameter (or part of a parameter definition) is recognized.
public void
outParameter(int
The position within the query
position
)

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.outParameter.

Called when an output parameter is recognized
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

jdbcPositionalParamCountback to summary
pack-priv int jdbcPositionalParamCount
paramValueBindersback to summary
private List<ParameterBinder> paramValueBinders
resultback to summary
pack-priv StringBuilder result

Constructor Detail

ParameterSubstitutionRecognizerback to summary
public ParameterSubstitutionRecognizer(SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Method Detail

completeback to summary
public void complete()

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.complete.

Annotations
@Override
getParameterValueBindersback to summary
public List<ParameterBinder> getParameterValueBinders()
jpaPositionalParameterback to summary
public void jpaPositionalParameter(int name, int position)

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.jpaPositionalParameter.

Doc from org.hibernate.engine.query.spi.ParameterParser.Recognizer.jpaPositionalParameter.

Called when a JPA-style named parameter is recognized

Parameters
name:int

The identifier (name) of the JPA-style parameter

position:int

The position within the query

Annotations
@Override
namedParameterback to summary
public void namedParameter(String name, int position)

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.namedParameter.

Doc from org.hibernate.engine.query.spi.ParameterParser.Recognizer.namedParameter.

Called when a named parameter is recognized

Parameters
name:String

The recognized parameter name

position:int

The position within the query

Annotations
@Override
ordinalParameterback to summary
public void ordinalParameter(int position)

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.ordinalParameter.

Doc from org.hibernate.engine.query.spi.ParameterParser.Recognizer.ordinalParameter.

Called when an ordinal parameter is recognized

Parameters
position:int

The position within the query

Annotations
@Override
otherback to summary
public void other(char character)

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.other.

Doc from org.hibernate.engine.query.spi.ParameterParser.Recognizer.other.

Called when a character that is not a parameter (or part of a parameter definition) is recognized.

Parameters
character:char

The recognized character

Annotations
@Override
outParameterback to summary
public void outParameter(int position)

Implements org.hibernate.engine.query.spi.ParameterParser.Recognizer.outParameter.

Doc from org.hibernate.engine.query.spi.ParameterParser.Recognizer.outParameter.

Called when an output parameter is recognized

Parameters
position:int

The position within the query

Annotations
@Override
registerNamedParamBinderback to summary
private void registerNamedParamBinder(String name)
registerPositionParamBinderback to summary
private void registerPositionParamBinder(int label)
org.hibernate.loader.custom.sql back to summary

pack-priv Interface SQLQueryParser.ParserContext

Known Direct Implementers
org.hibernate.loader.custom.sql.SQLCustomQuery.ParserContext

Method Summary

Modifier and TypeMethod and Description
public SQLLoadableCollection
public String
public SQLLoadable
public String
public Map<K, V>
public boolean
public boolean
isEntityAlias(String aliasName)

Method Detail

getCollectionPersisterByAliasback to summary
public SQLLoadableCollection getCollectionPersisterByAlias(String alias)
getCollectionSuffixByAliasback to summary
public String getCollectionSuffixByAlias(String alias)
getEntityPersisterByAliasback to summary
public SQLLoadable getEntityPersisterByAlias(String alias)
getEntitySuffixByAliasback to summary
public String getEntitySuffixByAlias(String alias)
getPropertyResultsMapByAliasback to summary
public Map<K, V> getPropertyResultsMapByAlias(String alias)
isCollectionAliasback to summary
public boolean isCollectionAlias(String aliasName)
isEntityAliasback to summary
public boolean isEntityAlias(String aliasName)