Package antlr

Examples of antlr.SemanticException


    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


    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() );

    final FromElement fromElement;
    if ( dot.getDataType() != null && dot.getDataType().isComponentType() ) {
      FromElementFactory factory = new FromElementFactory(
          getCurrentFromClause(),
          dot.getLhs().getFromElement(),
          dot.getPropertyPath(),
          alias == null ? null : alias.getText(),
          null,
          false
      );
      fromElement = factory.createComponentJoin( (ComponentType) dot.getDataType() );
    }
    else {
      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 );
      }
    }
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(
        inputNode.getLine(),
            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

  protected void validateMapPropertyExpression(AST node) throws SemanticException {
    try {
      FromReferenceNode fromReferenceNode = (FromReferenceNode) node;
      QueryableCollection collectionPersister = fromReferenceNode.getFromElement().getQueryableCollection();
      if ( ! Map.class.isAssignableFrom( collectionPersister.getCollectionType().getReturnedClass() ) ) {
        throw new SemanticException( "node did not reference a map" );
      }
    }
    catch ( SemanticException se ) {
      throw se;
    }
    catch ( Throwable t ) {
      throw new SemanticException( "node did not reference a map" );
    }
  }
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

*/
public class CollectionFunction extends MethodNode implements DisplayableNode {
  public void resolve(boolean inSelect) throws SemanticException {
    initializeMethodNode( this, inSelect );
    if ( !isCollectionPropertyMethod() ) {
      throw new SemanticException( this.getText() + " is not a collection property name!" );
    }
    AST expr = getFirstChild();
    if ( expr == null ) {
      throw new SemanticException( this.getText() + " requires a path!" );
    }
    resolveCollectionProperty( expr );
  }
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

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.