Package org.hibernate.param

Examples of org.hibernate.param.NamedParameterSpecification


    // create the node initially with the param name so that it shows
    // appropriately in the "original text" attribute
    ParameterNode parameter = ( ParameterNode ) astFactory.create( NAMED_PARAM, name );
    parameter.setText( "?" );

    NamedParameterSpecification paramSpec = new NamedParameterSpecification(
        delimiterNode.getLine(),
            delimiterNode.getColumn(),
        name
    );
    parameter.setHqlParameterSpecification( paramSpec );
View Full Code Here


      if ( PositionalParameterSpecification.class.isAssignableFrom( spec.getClass() ) ) {
        PositionalParameterSpecification ordinalSpec = ( PositionalParameterSpecification ) spec;
        ordinalParameterList.add( new ParameterInfo( i, ordinalSpec.getExpectedType() ) );
      }
      else if ( NamedParameterSpecification.class.isAssignableFrom( spec.getClass() ) ) {
        NamedParameterSpecification namedSpec = ( NamedParameterSpecification ) spec;
        NamedParamTempHolder paramHolder = ( NamedParamTempHolder ) namedParameterMap.get( namedSpec.getName() );
        if ( paramHolder == null ) {
          paramHolder = new NamedParamTempHolder();
          paramHolder.name = namedSpec.getName();
          paramHolder.type = namedSpec.getExpectedType();
          namedParameterMap.put( namedSpec.getName(), paramHolder );
        }
        paramHolder.positions.add( new Integer( i ) );
      }
      else {
        // don't care about other param types here, just those explicitly user-defined...
View Full Code Here

    // create the node initially with the param name so that it shows
    // appropriately in the "original text" attribute
    ParameterNode parameter = ( ParameterNode ) astFactory.create( NAMED_PARAM, name );
    parameter.setText( "?" );

    NamedParameterSpecification paramSpec = new NamedParameterSpecification(
        ( ( Node ) delimiterNode ).getLine(),
            ( ( Node ) delimiterNode ).getColumn(),
        name
    );
    parameter.setHqlParameterSpecification( paramSpec );
View Full Code Here

    // create the node initially with the param name so that it shows
    // appropriately in the "original text" attribute
    ParameterNode parameter = ( ParameterNode ) astFactory.create( NAMED_PARAM, name );
    parameter.setText( "?" );

    NamedParameterSpecification paramSpec = new NamedParameterSpecification(
        delimiterNode.getLine(),
            delimiterNode.getColumn(),
        name
    );
    parameter.setHqlParameterSpecification( paramSpec );
View Full Code Here

    // create the node initially with the param name so that it shows
    // appropriately in the "original text" attribute
    ParameterNode parameter = ( ParameterNode ) astFactory.create( NAMED_PARAM, name );
    parameter.setText( "?" );

    NamedParameterSpecification paramSpec = new NamedParameterSpecification(
        delimiterNode.getLine(),
            delimiterNode.getColumn(),
        name
    );
    parameter.setHqlParameterSpecification( paramSpec );
View Full Code Here

    System.out.println("Named parameters: " + query.getParameterTranslations().getNamedParameterNames());
    @SuppressWarnings("unchecked")
    List<ParameterSpecification> parameterSpecifications = query.getSqlAST().getWalker().getParameters();
    Statement generatedParamList[] = new Statement[parameterSpecifications.size()];
    for (int i = 0; i < parameterSpecifications.size(); i++) {
      NamedParameterSpecification ps = (NamedParameterSpecification) parameterSpecifications.get(i);

      // invoking ErraiParameter(String name, Integer position, Class<T> type)

      generatedParamList[i] = Stmt.newObject(ErraiParameter.class).withParameters(
              ps.getName(),
              Integer.valueOf(i),
              ps.getExpectedType().getReturnedClass());
    }
    return generatedParamList;
  }
View Full Code Here

      traverser.fastForwardToNextSiblingOf(dotNode);
      return dotNodeResolver.resolve(dotNode);

    case HqlSqlTokenTypes.NAMED_PARAM:
      ParameterNode paramNode = (ParameterNode) ast;
      NamedParameterSpecification namedParamSpec = (NamedParameterSpecification) paramNode.getHqlParameterSpecification();
      return Stmt.loadVariable("this").invoke("getParameterValue", namedParamSpec.getName());

    case HqlSqlTokenTypes.QUOTED_STRING:
      return Stmt.loadLiteral(SqlUtil.parseStringLiteral(ast.getText()));

    case HqlSqlTokenTypes.UNARY_MINUS:
View Full Code Here

    // create the node initially with the param name so that it shows
    // appropriately in the "original text" attribute
    ParameterNode parameter = ( ParameterNode ) astFactory.create( NAMED_PARAM, name );
    parameter.setText( "?" );

    NamedParameterSpecification paramSpec = new NamedParameterSpecification(
        delimiterNode.getLine(),
            delimiterNode.getColumn(),
        name
    );
    parameter.setHqlParameterSpecification( paramSpec );
View Full Code Here

    // create the node initially with the param name so that it shows
    // appropriately in the "original text" attribute
    ParameterNode parameter = ( ParameterNode ) astFactory.create( NAMED_PARAM, name );
    parameter.setText( "?" );

    NamedParameterSpecification paramSpec = new NamedParameterSpecification(
        delimiterNode.getLine(),
            delimiterNode.getColumn(),
        name
    );
    parameter.setHqlParameterSpecification( paramSpec );
View Full Code Here

    }
    @SuppressWarnings("unchecked")
    List<ParameterSpecification> parameterSpecifications = query.getSqlAST().getWalker().getParameters();
    Statement generatedParamList[] = new Statement[parameterSpecifications.size()];
    for (int i = 0; i < parameterSpecifications.size(); i++) {
      NamedParameterSpecification ps = (NamedParameterSpecification) parameterSpecifications.get(i);

      // invoking ErraiParameter(String name, Integer position, Class<T> type)

      Class<?> paramType;
      if (ps.getExpectedType() != null) {
        paramType = ps.getExpectedType().getReturnedClass();
      }
      else {
        paramType = Object.class;
      }

      generatedParamList[i] = Stmt.newObject(ErraiParameter.class).withParameters(
              ps.getName(),
              Integer.valueOf(i),
              paramType);
    }
    return generatedParamList;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.param.NamedParameterSpecification

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.