Package org.hibernate

Examples of org.hibernate.HibernateException


        closeSearcher( searcher, searchFactory.getReaderProvider() );
      }
      catch ( SearchException ee ) {
        //we have the initial issue already
      }
      throw new HibernateException( "Unable to query Lucene index", e );
    }
  }
View Full Code Here


      else {
        return resultTransformer.transformList( list );
      }
    }
    catch ( IOException e ) {
      throw new HibernateException( "Unable to query Lucene index", e );
    }
    finally {
      try {
        closeSearcher( searcher, searchFactoryImplementor.getReaderProvider() );
      }
View Full Code Here

      org.apache.lucene.search.Query query = filterQueryByClasses( luceneQuery );
      buildFilters();
      explanation = searcher.explain( query, documentId );
    }
    catch ( IOException e ) {
      throw new HibernateException( "Unable to query Lucene index and build explanation", e );
    }
    finally {
      //searcher cannot be null
      try {
        closeSearcher( searcher, searchFactoryImplementor.getReaderProvider() );
View Full Code Here

    //TODO check if caching this work for the last n list of classes makes a perf boost
    if ( classes == null || classes.length == 0 ) {
      // empty classes array means search over all indexed enities,
      // but we have to make sure there is at least one
      if ( builders.isEmpty() ) {
        throw new HibernateException(
            "There are no mapped entities. Don't forget to add @Indexed to at least one class."
        );
      }

      for ( DocumentBuilder builder : builders.values() ) {
        searcherSimilarity = checkSimilarity( searcherSimilarity, builder );
        if ( builder.getIdKeywordName() != null ) {
          idFieldNames.add( builder.getIdKeywordName() );
          allowFieldSelectionInProjection = allowFieldSelectionInProjection && builder.allowFieldSelectionInProjection();
        }
        final DirectoryProvider[] directoryProviders = builder.getDirectoryProviderSelectionStrategy()
            .getDirectoryProvidersForAllShards();
        populateDirectories( directories, directoryProviders );
      }
      classesAndSubclasses = null;
    }
    else {
      Set<Class<?>> involvedClasses = new HashSet<Class<?>>( classes.length );
      Collections.addAll( involvedClasses, classes );
      for ( Class<?> clazz : classes ) {
        DocumentBuilder<?> builder = builders.get( clazz );
        if ( builder != null ) {
          involvedClasses.addAll( builder.getMappedSubclasses() );
        }
      }

      for ( Class clazz : involvedClasses ) {
        DocumentBuilder builder = builders.get( clazz );
        //TODO should we rather choose a polymorphic path and allow non mapped entities
        if ( builder == null ) {
          throw new HibernateException( "Not a mapped entity (don't forget to add @Indexed): " + clazz );
        }
        if ( builder.getIdKeywordName() != null ) {
          idFieldNames.add( builder.getIdKeywordName() );
          allowFieldSelectionInProjection = allowFieldSelectionInProjection && builder.allowFieldSelectionInProjection();
        }
View Full Code Here

  private Similarity checkSimilarity(Similarity similarity, DocumentBuilder builder) {
    if ( similarity == null ) {
      similarity = builder.getSimilarity();
    }
    else if ( !similarity.getClass().equals( builder.getSimilarity().getClass() ) ) {
      throw new HibernateException(
          "Cannot perform search on two entities with differing Similarity implementations (" + similarity.getClass()
              .getName() + " & " + builder.getSimilarity().getClass().getName() + ")"
      );
    }
View Full Code Here

        try {
          hits = getQueryHits( searcher ).topDocs;
          resultSize = hits.totalHits;
        }
        catch ( IOException e ) {
          throw new HibernateException( "Unable to query Lucene index", e );
        }
        finally {
          //searcher cannot be null
          try {
            closeSearcher( searcher, searchFactoryImplementor.getReaderProvider() );
View Full Code Here

    this.resultTransformer = transformer;
    return this;
  }

  public int executeUpdate() throws HibernateException {
    throw new HibernateException( "Not supported operation" );
  }
View Full Code Here

        try {
          exporter.export( formatted );
        }
        catch (Exception e) {
          if ( haltOnError ) {
            throw new HibernateException( "Error during DDL export", e );
          }
          exceptions.add( e );
          LOG.unsuccessfulCreate( sqlCommand );
          LOG.error( e.getMessage() );
        }
View Full Code Here

    return instantiateDialect( dialectName );
  }

  private static Dialect instantiateDialect(String dialectName) throws HibernateException {
    if ( dialectName == null ) {
      throw new HibernateException( "The dialect was not set. Set the property hibernate.dialect." );
    }
    try {
      return ( Dialect ) ReflectHelper.classForName( dialectName ).newInstance();
    }
    catch ( ClassNotFoundException cnfe ) {
      throw new HibernateException( "Dialect class not found: " + dialectName );
    }
    catch ( Exception e ) {
      throw new HibernateException( "Could not instantiate given dialect class: " + dialectName, e );
    }
  }
View Full Code Here

   * @throws HibernateException If no mapping was specified for that type.
   */
  public String getTypeName(int code) throws HibernateException {
    String result = typeNames.get( code );
    if ( result == null ) {
      throw new HibernateException( "No default type mapping for (java.sql.Types) " + code );
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.HibernateException

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.