Package org.hibernate

Examples of org.hibernate.QueryException


    return list( session, queryParameters, queryTranslator.getQuerySpaces(), queryReturnTypes );
  }

  private void checkQuery(QueryParameters queryParameters) {
    if ( hasSelectNew() && queryParameters.getResultTransformer() != null ) {
      throw new QueryException( "ResultTransformer is not allowed for 'select new' queries." );
    }
  }
View Full Code Here


    try {

      final PreparedStatement st = prepareQueryStatement( queryParameters, false, session );

      if(queryParameters.isCallable()) {
        throw new QueryException("iterate() not supported for callable statements");
      }
      final ResultSet rs = getResultSet(st, queryParameters.hasAutoDiscoverScalarTypes(), false, queryParameters.getRowSelection(), session);
      final Iterator result = new IteratorImpl(
          rs,
              st,
View Full Code Here

    inAst.addChild( ast );
  }

  static public void panic() {
    //overriden to avoid System.exit
    throw new QueryException("Parser: panic");
  }
View Full Code Here

  private void addJoin(String name, AssociationType joinableType) throws QueryException {
    try {
      joinSequence.addJoin( joinableType, name, joinType, currentColumns() );
    }
    catch ( MappingException me ) {
      throw new QueryException( me );
    }
  }
View Full Code Here

  private void addJoin(String name, AssociationType joinableType, String[] foreignKeyColumns) throws QueryException {
    try {
      joinSequence.addJoin( joinableType, name, joinType, foreignKeyColumns );
    }
    catch ( MappingException me ) {
      throw new QueryException( me );
    }
  }
View Full Code Here

        JoinSequence ojf = q.getPathJoin( path.toString() );
        try {
          joinSequence.addCondition( ojf.toJoinFragment( q.getEnabledFilters(), true ).toWhereFragmentString() ); //after reset!
        }
        catch ( MappingException me ) {
          throw new QueryException( me );
        }
        // we don't need to worry about any condition in the ON clause
        // here (toFromFragmentString), since anything in the ON condition
        // is already applied to the whole query
      }
    }
    else if ( ".".equals( token ) ) {
      dotcount++;
    }
    else {
      if ( dotcount == 0 ) {
        if ( !continuation ) {
          if ( !q.isName( token ) ) throw new QueryException( "undefined alias: " + token );
          currentName = token;
          currentPropertyMapping = q.getPropertyMapping( currentName );
        }
      }
      else if ( dotcount == 1 ) {
        if ( currentName != null ) {
          currentProperty = token;
        }
        else if ( collectionName != null ) {
          //processCollectionProperty(token, q.getCollectionPersister(collectionRole), collectionName);
          continuation = false;
        }
        else {
          throw new QueryException( "unexpected" );
        }
      }
      else { // dotcount>=2

        // Do the corresponding RHS
        Type propertyType = getPropertyType();

        if ( propertyType == null ) {
          throw new QueryException( "unresolved property: " + path );
        }

        if ( propertyType.isComponentType() ) {
          dereferenceComponent( token );
        }
        else if ( propertyType.isEntityType() ) {
          if ( !isCollectionValued() ) dereferenceEntity( token, ( EntityType ) propertyType, q );
        }
        else if ( propertyType.isCollectionType() ) {
          dereferenceCollection( token, ( ( CollectionType ) propertyType ).getRole(), q );

        }
        else {
          if ( token != null ) throw new QueryException( "dereferenced: " + path );
        }

      }
    }
  }
View Full Code Here

    final String idPropertyName;
    try {
      idPropertyName = propertyType.getIdentifierOrUniqueKeyPropertyName( q.getFactory() );
    }
    catch ( MappingException me ) {
      throw new QueryException( me );
    }
    boolean isNamedIdPropertyShortcut = idPropertyName != null
        && idPropertyName.equals( propertyName )
        && propertyType.isReferenceToPrimaryKey();
View Full Code Here

  protected Type getPropertyType() throws QueryException {
    String propertyPath = getPropertyPath();
    Type propertyType = getPropertyMapping().toType( propertyPath );
    if ( propertyType == null ) {
      throw new QueryException( "could not resolve property type: " + propertyPath );
    }
    return propertyType;
  }
View Full Code Here

  protected String[] currentColumns() throws QueryException {
    String propertyPath = getPropertyPath();
    String[] propertyColumns = getPropertyMapping().toColumns( currentName, propertyPath );
    if ( propertyColumns == null ) {
      throw new QueryException( "could not resolve property columns: " + propertyPath );
    }
    return propertyColumns;
  }
View Full Code Here

  private void prepareForIndex(QueryTranslatorImpl q) throws QueryException {

    QueryableCollection collPersister = q.getCollectionPersister( collectionRole );

    if ( !collPersister.hasIndex() ) throw new QueryException( "unindexed collection before []: " + path );
    String[] indexCols = collPersister.getIndexColumnNames();
    if ( indexCols.length != 1 ) throw new QueryException( "composite-index appears in []: " + path );
    //String[] keyCols = collPersister.getKeyColumnNames();

    JoinSequence fromJoins = new JoinSequence( q.getFactory() )
        .setUseThetaStyle( useThetaStyleJoin )
        .setRoot( collPersister, collectionName )
View Full Code Here

TOP

Related Classes of org.hibernate.QueryException

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.