Top Description Fields Constructors Methods
org.hibernate.dialect.function

public Class StandardSQLFunction

extends Object
implements SQLFunction
Class Inheritance
All Implemented Interfaces
org.hibernate.dialect.function.SQLFunction
Known Direct Subclasses
org.hibernate.dialect.function.ConditionalParenthesisFunction, org.hibernate.dialect.function.DB2SubstringFunction, org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.CountFunction, org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.AvgFunction, org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.MaxFunction, org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.MinFunction, org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.SumFunction, org.hibernate.dialect.function.StandardJDBCEscapeFunction
Imports
java.util.List, org.hibernate.engine.spi.Mapping, .SessionFactoryImplementor, org.hibernate.type.Type

Provides a standard implementation that supports the majority of the HQL functions that are translated to SQL. The Dialect and its sub-classes use this class to provide details required for processing of the associated function.
Author
David Channon

Field Summary

Modifier and TypeField and Description
private final String
private final Type

Constructor Summary

AccessConstructor and Description
public
StandardSQLFunction(String
The name of the function.
name
)

Construct a standard SQL function definition with a variable return type; the actual return type will depend on the types to which the function is applied.

public
StandardSQLFunction(String
The name of the function.
name
,
Type
The static return type.
registeredType
)

Construct a standard SQL function definition with a static return type.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The function name.
getName
()

Function name accessor

protected String
getRenderedName(List<E> arguments)

public Type
getReturnType(Type
The type of the first argument
firstArgumentType
,
Mapping
The mapping source.
mapping
)

Implements org.hibernate.dialect.function.SQLFunction.getReturnType.

The return type of the function.
public Type

Returns:

The static function return type; or null if return type is not static.
getType
()

Function static return type accessor.

public boolean
hasArguments()

Implements org.hibernate.dialect.function.SQLFunction.hasArguments.

Does this function have any arguments?
public boolean
hasParenthesesIfNoArguments()

Implements org.hibernate.dialect.function.SQLFunction.hasParenthesesIfNoArguments.

If there are no arguments, are parentheses required?
public String
render(Type
The type of the first argument
firstArgumentType
,
List<E>
The function arguments
arguments
,
SessionFactoryImplementor
The SessionFactory
sessionFactory
)

Implements org.hibernate.dialect.function.SQLFunction.render.

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Render the function call as SQL fragment.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

nameback to summary
private final String name
registeredTypeback to summary
private final Type registeredType

Constructor Detail

StandardSQLFunctionback to summary
public StandardSQLFunction(String name)

Construct a standard SQL function definition with a variable return type; the actual return type will depend on the types to which the function is applied.

Using this form, the return type is considered non-static and assumed to be the type of the first argument.

Parameters
name:String

The name of the function.

StandardSQLFunctionback to summary
public StandardSQLFunction(String name, Type registeredType)

Construct a standard SQL function definition with a static return type.

Parameters
name:String

The name of the function.

registeredType:Type

The static return type.

Method Detail

getNameback to summary
public String getName()

Function name accessor

Returns:String

The function name.

getRenderedNameback to summary
protected String getRenderedName(List<E> arguments)
getReturnTypeback to summary
public Type getReturnType(Type firstArgumentType, Mapping mapping)

Implements org.hibernate.dialect.function.SQLFunction.getReturnType.

Doc from org.hibernate.dialect.function.SQLFunction.getReturnType.

The return type of the function. May be either a concrete type which is preset, or variable depending upon the type of the first function argument.

Note, the 'firstArgumentType' parameter should match the one passed into render

Parameters
firstArgumentType:Type

The type of the first argument

mapping:Mapping

The mapping source.

Returns:Type

The type to be expected as a return.

Annotations
@Override
getTypeback to summary
public Type getType()

Function static return type accessor.

Returns:Type

The static function return type; or null if return type is not static.

hasArgumentsback to summary
public boolean hasArguments()

Implements org.hibernate.dialect.function.SQLFunction.hasArguments.

Doc from org.hibernate.dialect.function.SQLFunction.hasArguments.

Does this function have any arguments?

Returns:boolean

True if the function expects to have parameters; false otherwise.

Annotations
@Override
hasParenthesesIfNoArgumentsback to summary
public boolean hasParenthesesIfNoArguments()

Implements org.hibernate.dialect.function.SQLFunction.hasParenthesesIfNoArguments.

Doc from org.hibernate.dialect.function.SQLFunction.hasParenthesesIfNoArguments.

If there are no arguments, are parentheses required?

Returns:boolean

True if a no-arg call of this function requires parentheses.

Annotations
@Override
renderback to summary
public String render(Type firstArgumentType, List<E> arguments, SessionFactoryImplementor sessionFactory)

Implements org.hibernate.dialect.function.SQLFunction.render.

Doc from org.hibernate.dialect.function.SQLFunction.render.

Deprecated

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

Render the function call as SQL fragment.

Note, the 'firstArgumentType' parameter should match the one passed into getReturnType

Parameters
firstArgumentType:Type

The type of the first argument

arguments:List<E>

The function arguments

sessionFactory:SessionFactoryImplementor

The SessionFactory

Returns:String

The rendered function call

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override