Package antlr

Examples of antlr.SemanticException


      throw new UnsupportedOperationException();
    }

    String propertyName = getOriginalText();
    if (!getDataType().isCollectionType()) {
      throw new SemanticException("Collection expected; [" + propertyName + "] does not refer to a collection property");
    }

    // TODO : most of below was taken verbatim from DotNode; should either delegate this logic or super-type it
    CollectionType type = (CollectionType) getDataType();
    String role = type.getRole();
View Full Code Here


   * nodes and setting their expected type, if possible.
   */
  public void initialize() throws SemanticException {
    Node lhs = getLeftHandOperand();
    if ( lhs == null ) {
      throw new SemanticException( "left-hand operand of a binary operator was null" );
    }
    Node rhs = getRightHandOperand();
    if ( rhs == null ) {
      throw new SemanticException( "right-hand operand of a binary operator was null" );
    }

    Type lhsType = extractDataType( lhs );
    Type rhsType = extractDataType( rhs );

View Full Code Here

    return methodName;
  }

  private void collectionProperty(AST path, AST name) throws SemanticException {
    if ( path == null ) {
      throw new SemanticException( "Collection function " + name.getText() + " has no path!" );
    }

    SqlNode expr = ( SqlNode ) path;
    Type type = expr.getDataType();
    if ( log.isDebugEnabled() ) {
View Full Code Here

      prepareSelectColumns( selectColumns );
      setText( selectColumns[0] );
      setType( SqlTokenTypes.SQL_TOKEN );
    }
    else {
      throw new SemanticException(
          "Unexpected expression " + expr +
          " found for collection function " + propertyName
        );
    }
  }
View Full Code Here

    if ( fetch && isSubQuery() ) {
      throw new QueryException( "fetch not allowed in subquery from-elements" );
    }
    // The path AST should be a DotNode, and it should have been evaluated already.
    if ( path.getType() != SqlTokenTypes.DOT ) {
      throw new SemanticException( "Path expected for join!" );
    }
    DotNode dot = ( DotNode ) path;
    int hibernateJoinType = JoinProcessor.toHibernateJoinType( joinType );
    dot.setJoinType( hibernateJoinType )// Tell the dot node about the join type.
    dot.setFetch( fetch );
    // Generate an explicit join for the root dot node.   The implied joins will be collected and passed up
    // to the root dot node.
    dot.resolve( true, false, alias == null ? null : alias.getText() );
    FromElement fromElement = dot.getImpliedJoin();
    fromElement.setAllPropertyFetch(propertyFetch!=null);

    if ( with != null ) {
      if ( fetch ) {
        throw new SemanticException( "with-clause not allowed on fetched associations; use filters" );
      }
      handleWithFragment( fromElement, with );
    }

    if ( log.isDebugEnabled() ) {
View Full Code Here

    }
    catch( InvalidWithClauseException e ) {
      throw e;
    }
    catch ( Exception e) {
      throw new SemanticException( e.getMessage() );
    }
  }
View Full Code Here

    }
  }

  protected AST generatePositionalParameter(AST inputNode) throws SemanticException {
    if ( namedParameters.size() > 0 ) {
      throw new SemanticException( "cannot define positional parameter after any named parameters have been defined" );
    }
    ParameterNode parameter = ( ParameterNode ) astFactory.create( PARAM, "?" );
    PositionalParameterSpecification paramSpec = new PositionalParameterSpecification(
        ( ( Node ) inputNode ).getLine(),
            ( ( Node ) inputNode ).getColumn(),
View Full Code Here

    FromClause fromClause = updateStatement.getFromClause();
    if ( versioned != null ) {
      // Make sure that the persister is versioned
      Queryable persister = fromClause.getFromElement().getQueryable();
      if ( !persister.isVersioned() ) {
        throw new SemanticException( "increment option specified for update of non-versioned entity" );
      }

      VersionType versionType = persister.getVersionType();
      if ( versionType instanceof UserVersionType ) {
        throw new SemanticException( "user-defined version types not supported for increment option" );
      }

      AST eq = getASTFactory().create( HqlSqlTokenTypes.EQ, "=" );
      AST versionPropertyNode = generateVersionPropertyNode( persister );
View Full Code Here

    SessionFactoryHelper sessionFactoryHelper = getSessionFactoryHelper();
    collectionNode.resolveIndex( this );    // Fully resolve the map reference, create implicit joins.

    Type type = collectionNode.getDataType();
    if ( !type.isCollectionType() ) {
      throw new SemanticException( "The [] operator cannot be applied to type " + type.toString() );
    }
    String collectionRole = ( ( CollectionType ) type ).getRole();
    QueryableCollection queryableCollection = sessionFactoryHelper.requireQueryableCollection( collectionRole );
    if ( !queryableCollection.hasIndex() ) {
      throw new QueryException( "unindexed fromElement before []: " + collectionNode.getPath() );
View Full Code Here

    SessionFactoryHelper sessionFactoryHelper = getSessionFactoryHelper();
    collectionNode.resolveIndex( this );    // Fully resolve the map reference, create implicit joins.

    Type type = collectionNode.getDataType();
    if ( !type.isCollectionType() ) {
      throw new SemanticException( "The [] operator cannot be applied to type " + type.toString() );
    }
    String collectionRole = ( ( CollectionType ) type ).getRole();
    QueryableCollection queryableCollection = sessionFactoryHelper.requireQueryableCollection( collectionRole );
    if ( !queryableCollection.hasIndex() ) {
      throw new QueryException( "unindexed fromElement before []: " + collectionNode.getPath() );
View Full Code Here

TOP

Related Classes of antlr.SemanticException

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.