Package org.hibernate.param

Examples of org.hibernate.param.ParameterSpecification


            int lhsColumnSpan, int rhsColumnSpan ) {
        String[] lhsElementTexts = extractMutationTexts( getLeftHandOperand(),
                lhsColumnSpan );
        Node rhsNode = (Node) getInList().getFirstChild();

        ParameterSpecification lhsEmbeddedCompositeParameterSpecification = getLeftHandOperand() == null
                || ( !ParameterNode.class.isInstance( getLeftHandOperand() ) ) ? null
                : ( (ParameterNode) getLeftHandOperand() )
                        .getHqlParameterSpecification();
        /**
         * only one element in "in" cluster, e.g.
         * <code> where (a,b) in ( (1,2) ) </code> this will be mutated to
         * <code>where a=1 and b=2 </code>
         */
        if ( rhsNode != null && rhsNode.getNextSibling() == null ) {
            String[] rhsElementTexts = extractMutationTexts( rhsNode,
                    rhsColumnSpan );
            setType( HqlSqlTokenTypes.AND );
            setText( "AND" );
            ParameterSpecification rhsEmbeddedCompositeParameterSpecification = rhsNode == null
                    || ( !ParameterNode.class.isInstance( rhsNode ) ) ? null
                    : ( (ParameterNode) rhsNode )
                            .getHqlParameterSpecification();
            translate( lhsColumnSpan, HqlSqlTokenTypes.EQ, "=", lhsElementTexts,
                    rhsElementTexts,
                    lhsEmbeddedCompositeParameterSpecification,
                    rhsEmbeddedCompositeParameterSpecification, this );
        } else {
            List andElementsNodeList = new ArrayList();
            while ( rhsNode != null ) {
                String[] rhsElementTexts = extractMutationTexts( rhsNode,
                        rhsColumnSpan );
                AST and = getASTFactory().create( HqlSqlTokenTypes.AND, "AND" );
                ParameterSpecification rhsEmbeddedCompositeParameterSpecification = rhsNode == null
                        || ( !ParameterNode.class.isInstance( rhsNode ) ) ? null
                        : ( (ParameterNode) rhsNode )
                                .getHqlParameterSpecification();
                translate( lhsColumnSpan, HqlSqlTokenTypes.EQ, "=",
                        lhsElementTexts, rhsElementTexts,
View Full Code Here


    setType( HqlSqlTokenTypes.AND );
    setText( "AND" );
    String[] lhsElementTexts = extractMutationTexts( getLeftHandOperand(), valueElements );
    String[] rhsElementTexts = extractMutationTexts( getRightHandOperand(), valueElements );

    ParameterSpecification lhsEmbeddedCompositeParameterSpecification =
        getLeftHandOperand() == null || ( !ParameterNode.class.isInstance( getLeftHandOperand() ) )
            ? null
            : ( ( ParameterNode ) getLeftHandOperand() ).getHqlParameterSpecification();

    ParameterSpecification rhsEmbeddedCompositeParameterSpecification =
        getRightHandOperand() == null || ( !ParameterNode.class.isInstance( getRightHandOperand() ) )
            ? null
            : ( ( ParameterNode ) getRightHandOperand() ).getHqlParameterSpecification();

    translate( valueElements, comparisonType, comparisonText,
View Full Code Here

        try {
          ps = session.getBatcher().prepareStatement( idInsertSelect );
          Iterator paramSpecifications = getIdSelectParameterSpecifications().iterator();
          int pos = 1;
          while ( paramSpecifications.hasNext() ) {
            final ParameterSpecification paramSpec = ( ParameterSpecification ) paramSpecifications.next();
            pos += paramSpec.bind( ps, parameters, session, pos );
          }
          resultCount = ps.executeUpdate();
        }
        finally {
          if ( ps != null ) {
View Full Code Here

      try {
        st = session.getBatcher().prepareStatement( sql );
        Iterator parameterSpecifications = this.parameterSpecifications.iterator();
        int pos = 1;
        while ( parameterSpecifications.hasNext() ) {
          final ParameterSpecification paramSpec = ( ParameterSpecification ) parameterSpecifications.next();
          pos += paramSpec.bind( st, parameters, session, pos );
        }
        if ( selection != null ) {
          if ( selection.getTimeout() != null ) {
            st.setQueryTimeout( selection.getTimeout().intValue() );
          }
View Full Code Here

              versionType.getClass() +
                  ".sqlTypes() returns > 1 element; only single-valued versions are allowed."
          );
        }
        versionValueNode = getASTFactory().create( HqlSqlTokenTypes.PARAM, "?" );
        ParameterSpecification paramSpec = new VersionTypeSeedParameterSpecification( versionType );
        ( ( ParameterNode ) versionValueNode ).setHqlParameterSpecification( paramSpec );
        parameters.add( 0, paramSpec );

        if ( sessionFactoryHelper.getFactory().getDialect().requiresCastingOfParametersInSelectClause() ) {
          // we need to wrtap the param in a cast()
View Full Code Here

      eq.setFirstChild( versionPropertyNode );

      AST versionIncrementNode = null;
      if ( isTimestampBasedVersion( versionType ) ) {
        versionIncrementNode = getASTFactory().create( HqlSqlTokenTypes.PARAM, "?" );
        ParameterSpecification paramSpec = new VersionTypeSeedParameterSpecification( versionType );
        ( ( ParameterNode ) versionIncrementNode ).setHqlParameterSpecification( paramSpec );
        parameters.add( 0, paramSpec );
      }
      else {
        // Not possible to simply re-use the versionPropertyNode here as it causes
View Full Code Here

      try {
        st = session.getTransactionCoordinator().getJdbcCoordinator().getStatementPreparer().prepareStatement( sql, false );
        Iterator paramSpecItr = parameterSpecifications.iterator();
        int pos = 1;
        while ( paramSpecItr.hasNext() ) {
          final ParameterSpecification paramSpec = (ParameterSpecification) paramSpecItr.next();
          pos += paramSpec.bind( st, parameters, session, pos );
        }
        if ( selection != null ) {
          if ( selection.getTimeout() != null ) {
            st.setQueryTimeout( selection.getTimeout().intValue() );
          }
View Full Code Here

        try {
          ps = session.getBatcher().prepareStatement( idInsertSelect );
          Iterator paramSpecifications = getIdSelectParameterSpecifications().iterator();
          int pos = 1;
          while ( paramSpecifications.hasNext() ) {
            final ParameterSpecification paramSpec = ( ParameterSpecification ) paramSpecifications.next();
            pos += paramSpec.bind( ps, parameters, session, pos );
          }
          resultCount = ps.executeUpdate();
        }
        finally {
          if ( ps != null ) {
View Full Code Here

    int position = startIndex;
//    List parameterSpecs = queryTranslator.getSqlAST().getWalker().getParameters();
    List parameterSpecs = queryTranslator.getCollectedParameterSpecifications();
    Iterator itr = parameterSpecs.iterator();
    while ( itr.hasNext() ) {
      ParameterSpecification spec = ( ParameterSpecification ) itr.next();
      position += spec.bind( statement, queryParameters, session, position );
    }
    return position - startIndex;
  }
View Full Code Here

              versionType.getClass() +
                  ".sqlTypes() returns > 1 element; only single-valued versions are allowed."
          );
        }
        versionValueNode = getASTFactory().create( HqlSqlTokenTypes.PARAM, "?" );
        ParameterSpecification paramSpec = new VersionTypeSeedParameterSpecification( versionType );
        ( ( ParameterNode ) versionValueNode ).setHqlParameterSpecification( paramSpec );
        parameters.add( 0, paramSpec );

        if ( sessionFactoryHelper.getFactory().getDialect().requiresCastingOfParametersInSelectClause() ) {
          // we need to wrtap the param in a cast()
View Full Code Here

TOP

Related Classes of org.hibernate.param.ParameterSpecification

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.