Package org.hibernate.dialect.function

Examples of org.hibernate.dialect.function.SQLFunction


    return getFunction( criteriaQuery ).render( ARGS, criteriaQuery.getFactory() )
        + " as y" + position + '_';
  }

  protected SQLFunction getFunction(CriteriaQuery criteriaQuery) {
    SQLFunction function = criteriaQuery.getFactory()
        .getSqlFunctionRegistry()
        .findSQLFunction( "count" );
    if ( function == null ) {
      throw new HibernateException( "Unable to locate count function mapping" );
    }
View Full Code Here


   * @param functionName The name of the function to locate
   * @return The sql function.
   * @throws QueryException Indicates no matching sql functions could be found.
   */
  private SQLFunction requireSQLFunction(String functionName) {
    SQLFunction f = findSQLFunction( functionName );
    if ( f == null ) {
      throw new QueryException( "Unable to find SQL function: " + functionName );
    }
    return f;
  }
View Full Code Here

   * @param functionName The function name.
   * @param first        The first argument expression.
   * @return the function return type given the function name and the first argument expression node.
   */
  public Type findFunctionReturnType(String functionName, AST first) {
    SQLFunction sqlFunction = requireSQLFunction( functionName );
    return findFunctionReturnType( functionName, sqlFunction, first );
  }
View Full Code Here

  protected SQLFunction getFunction(CriteriaQuery criteriaQuery) {
    return getFunction( getFunctionName(), criteriaQuery );
  }

  protected SQLFunction getFunction(String functionName, CriteriaQuery criteriaQuery) {
    SQLFunction function = criteriaQuery.getFactory()
        .getSqlFunctionRegistry()
        .findSQLFunction( functionName );
    if ( function == null ) {
      throw new HibernateException( "Unable to locate mapping for function named [" + functionName + "]" );
    }
View Full Code Here

    return getFunction( criteriaQuery ).render( null, ARGS, criteriaQuery.getFactory() )
        + " as y" + position + '_';
  }

  protected SQLFunction getFunction(CriteriaQuery criteriaQuery) {
    SQLFunction function = criteriaQuery.getFactory()
        .getSqlFunctionRegistry()
        .findSQLFunction( "count" );
    if ( function == null ) {
      throw new HibernateException( "Unable to locate count function mapping" );
    }
View Full Code Here

    // checking for "(" is currently redundant because it is checked before getting here;
    // doing the check anyhow, in case that earlier check goes away;
    if ( "(".equals( nextToken ) ) {
      return true;
    }
    SQLFunction function = functionRegistry.findSQLFunction(lcToken);
    if ( function == null ) {
      // lcToken does not refer to a function
      return false;
    }
    // if function.hasParenthesesIfNoArguments() is true, then assume
    // lcToken is not a function (since it is not followed by '(')
    return ! function.hasParenthesesIfNoArguments();
  }
View Full Code Here

   * @param functionName The name of the function to locate
   * @return The sql function.
   * @throws QueryException Indicates no matching sql functions could be found.
   */
  private SQLFunction requireSQLFunction(String functionName) {
    SQLFunction f = findSQLFunction( functionName );
    if ( f == null ) {
      throw new QueryException( "Unable to find SQL function: " + functionName );
    }
    return f;
  }
View Full Code Here

   * @param first        The first argument expression.
   * @return the function return type given the function name and the first argument expression node.
   */
  public Type findFunctionReturnType(String functionName, AST first) {
    // locate the registered function by the given name
    SQLFunction sqlFunction = requireSQLFunction( functionName );

    // determine the type of the first argument...
    Type argumentType = null;
    if ( first != null ) {
      if ( "cast".equals(functionName) ) {
        argumentType = TypeFactory.heuristicType( first.getNextSibling().getText() );
      }
      else if ( first instanceof SqlNode ) {
        argumentType = ( (SqlNode) first ).getDataType();
      }
    }

    return sqlFunction.getReturnType( argumentType, sfi );
  }
View Full Code Here

  public Type getDataType() {
    Type type = super.getDataType();
    if (type != null) return type;
    FromElement fe = getFromElement();
    if (fe != null) return fe.getDataType();
    SQLFunction sf = getWalker().getSessionFactoryHelper().findSQLFunction(getText());
    return sf == null ? null : sf.getReturnType(null, null);
  }
View Full Code Here

   * @param functionName The name of the function to locate
   * @return The sql function.
   * @throws QueryException Indicates no matching sql functions could be found.
   */
  private SQLFunction requireSQLFunction(String functionName) {
    SQLFunction f = findSQLFunction( functionName );
    if ( f == null ) {
      throw new QueryException( "Unable to find SQL function: " + functionName );
    }
    return f;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.dialect.function.SQLFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.