Package antlr

Examples of antlr.SemanticException


    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

    }
  }

  private void checkForDuplicateClassAlias(String classAlias) throws SemanticException {
    if ( classAlias != null && fromElementByClassAlias.containsKey( classAlias ) ) {
      throw new SemanticException( "Duplicate definition of alias '" + classAlias + "'" );
    }
  }
View Full Code Here

  private Constructor resolveConstructor(String path) throws SemanticException {
    String importedClassName = getSessionFactoryHelper().getImportedClassName( path );
    String className = StringHelper.isEmpty( importedClassName ) ? path : importedClassName;
    if ( className == null ) {
      throw new SemanticException( "Unable to locate class [" + path + "]" );
    }
    try {
      Class holderClass = ReflectHelper.classForName( className );
      return ReflectHelper.getConstructor( holderClass, constructorArgumentTypes );
    }
View Full Code Here

  public void initialize() throws SemanticException {
    Node lhs = getLeftHandOperand();
    Node rhs = getRightHandOperand();
    if ( lhs == null ) {
      throw new SemanticException( "left-hand operand of a binary operator was null" );
    }
    if ( rhs == null ) {
      throw new SemanticException( "right-hand operand of a binary operator was null" );
    }

    Type lhType = ( lhs instanceof SqlNode ) ? ( ( SqlNode ) lhs ).getDataType() : null;
    Type rhType = ( rhs instanceof SqlNode ) ? ( ( SqlNode ) rhs ).getDataType() : null;
View Full Code Here

public class BetweenOperatorNode extends SqlNode implements OperatorNode {

  public void initialize() throws SemanticException {
    Node fixture = getFixtureOperand();
    if ( fixture == null ) {
      throw new SemanticException( "fixture operand of a between operator was null" );
    }
    Node low = getLowOperand();
    if ( low == null ) {
      throw new SemanticException( "low operand of a between operator was null" );
    }
    Node high = getHighOperand();
    if ( high == null ) {
      throw new SemanticException( "high operand of a between operator was null" );
    }
    check( fixture, low, high );
    check( low, high, fixture );
    check( high, fixture, low );
  }
View Full Code Here

    String text = queryableCollection.getTableName();
    AST ast = createFromElement( text );
    FromElement destination = ( FromElement ) ast;
    Type elementType = queryableCollection.getElementType();
    if ( elementType.isCollectionType() ) {
      throw new SemanticException( "Collections of collections are not supported!" );
    }
    destination.initializeCollection( fromClause, classAlias, tableAlias );
    destination.setType( JOIN_FRAGMENT );    // Tag this node as a JOIN.
    destination.setIncludeSubclasses( false )// Don't include subclasses in the join.
    destination.setCollectionJoin( true );    // This is a clollection join.
View Full Code Here

  }

  public void initialize() throws SemanticException {
    Node lhs = getLeftHandOperand();
    if ( lhs == null ) {
      throw new SemanticException( "left-hand operand of in operator was null" );
    }
    Node inList = getInList();
    if ( inList == null ) {
      throw new SemanticException( "right-hand operand of in operator was null" );
    }

    // for expected parameter type injection, we expect that the lhs represents
    // some form of property ref and that the children of the in-list represent
    // one-or-more params.
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.