Package org.hibernate

Examples of org.hibernate.QueryException


  public void setFetch(boolean fetch) {
    this.fetch = fetch;
    // Fetch can't be used with scroll() or iterate().
    if ( fetch && getWalker().isShallowQuery() ) {
      throw new QueryException( QueryTranslator.ERROR_CANNOT_FETCH_WITH_ITERATE );
    }
  }
View Full Code Here


      }
      return buf.toString();
    }
    else {
      if (persister==null) {
        throw new QueryException( "not an entity" );
      }
      String fragment = ( ( Queryable ) persister ).identifierSelectFragment( getTableAlias(), getSuffix( size, k ) );
      return trimLeadingCommaAndSpaces( fragment );
    }
  }
View Full Code Here

          if ( fromElement.getRealOrigin() == null ) {
            // work around that crazy issue where the tree contains
            // "empty" FromElements (no text); afaict, this is caused
            // by FromElementFactory.createCollectionJoin()
            if ( fromElement.getOrigin() == null ) {
              throw new QueryException( "Unable to determine origin of join fetch [" + fromElement.getDisplayText() + "]" );
            }
            else {
              origin = fromElement.getOrigin();
            }
          }
          else {
            origin = fromElement.getRealOrigin();
          }
          if ( !fromElementsForLoad.contains( origin ) ) {
            throw new QueryException(
                "query specified join fetching, but the owner " +
                "of the fetched association was not present in the select list " +
                "[" + fromElement.getDisplayText() + "]"
            );
          }
View Full Code Here

      // we do not actually propogate ANTLRExceptions as a cause, so
      // log it here for diagnostic purposes
      if ( log.isTraceEnabled() ) {
        log.trace( "converted antlr.ANTLRException", e );
      }
      throw new QueryException( e.getMessage(), hql );
    }

    this.enabledFilters = null; //only needed during compilation phase...
  }
View Full Code Here

    }
    else if ( walker.getStatementType() == HqlSqlTokenTypes.INSERT ) {
      return new BasicExecutor( walker, ( ( InsertStatement ) statement ).getIntoClause().getQueryable() );
    }
    else {
      throw new QueryException( "Unexpected statement type" );
    }
  }
View Full Code Here

      // get its state into the database in order to execute query
      flush();
      entry = persistenceContext.getCollectionEntryOrNull( collection );
      CollectionPersister roleAfterFlush = (entry == null) ? null : entry.getLoadedPersister();
      if ( roleAfterFlush == null ) {
        throw new QueryException( "The collection was unreferenced" );
      }
      plan = factory.getQueryPlanCache().getFilterQueryPlan( filter, roleAfterFlush.getRole(), shallow, getEnabledFilters() );
    }
    else {
      // otherwise, we only need to flush if there are in-memory changes
      // to the queried tables
      plan = factory.getQueryPlanCache().getFilterQueryPlan( filter, roleBeforeFlush.getRole(), shallow, getEnabledFilters() );
      if ( autoFlushIfRequired( plan.getQuerySpaces() ) ) {
        // might need to run a different filter entirely after the flush
        // because the collection role may have changed
        entry = persistenceContext.getCollectionEntryOrNull( collection );
        CollectionPersister roleAfterFlush = (entry == null) ? null : entry.getLoadedPersister();
        if ( roleBeforeFlush != roleAfterFlush ) {
          if ( roleAfterFlush == null ) {
            throw new QueryException( "The collection was dereferenced" );
          }
          plan = factory.getQueryPlanCache().getFilterQueryPlan( filter, roleAfterFlush.getRole(), shallow, getEnabledFilters() );
        }
      }
    }
View Full Code Here

    if ( getErrorCount() > 0 ) {
      if ( recognitionExceptions.size() > 0 ) {
        throw QuerySyntaxException.convert( ( RecognitionException ) recognitionExceptions.get( 0 ) );
      }
      else {
        throw new QueryException( getErrorString() );
      }
    }
    else {
      // all clear
      if ( log.isDebugEnabled() ) {
View Full Code Here

      throw me;
    }
    catch ( Exception e ) {
      log.debug( "unexpected query compilation problem", e );
      e.printStackTrace();
      QueryException qe = new QueryException( "Incorrect query syntax", e );
      qe.setQueryString( queryString );
      throw qe;
    }

    postInstantiate();
View Full Code Here

        }
        else {
          addTableAlias( tableAlias );
        }
        if ( upgradeType != null && lockMode != upgradeType ) {
          throw new QueryException( "mixed LockModes" );
        }
        upgradeType = lockMode;
      }
    }
View Full Code Here

    String type = getType( name );
    if ( type == null ) {
      String role = getRole( name );
      if ( role == null ) {
        throw new QueryException( "alias not found: " + name );
      }
      return getCollectionPersister( role ); //.getElementPropertyMapping();
    }
    else {
      Queryable persister = getEntityPersister( type );
      if ( persister == null ) throw new QueryException( "persistent class not found: " + type );
      return persister;
    }
  }
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.