Package org.hibernate

Examples of org.hibernate.MappingException


    // Bind the filters
    Iterator filters = manyToManyNode.elementIterator( "filter" );
    if ( ( filters.hasNext() || whereCondition != null ) &&
            collection.getFetchMode() == FetchMode.JOIN &&
            collection.getElement().getFetchMode() != FetchMode.JOIN ) {
      throw new MappingException(
              "many-to-many defining filter or where without join fetching " +
              "not valid within collection using join fetching [" + collection.getRole() + "]"
        );
    }
    while ( filters.hasNext() ) {
      final Element filterElement = ( Element ) filters.next();
      final String name = filterElement.attributeValue( "name" );
      String condition = filterElement.getTextTrim();
      if ( StringHelper.isEmpty(condition) ) condition = filterElement.attributeValue( "condition" );
      if ( StringHelper.isEmpty(condition) ) {
        condition = model.getFilterDefinition(name).getDefaultFilterCondition();
      }
      if ( condition==null) {
        throw new MappingException("no filter condition found for filter: " + name);
      }
      log.debug(
          "Applying many-to-many filter [" + name +
          "] as [" + condition +
          "] to role [" + collection.getRole() + "]"
View Full Code Here


    }
    else if ( "always".equals( flushMode ) ) {
      return FlushMode.ALWAYS;
    }
    else {
      throw new MappingException( "unknown flushmode" );
    }
  }
View Full Code Here

  }

  private SQLLoadable getSQLLoadable(String entityName) throws MappingException {
    EntityPersister persister = factory.getEntityPersister( entityName );
    if ( !(persister instanceof SQLLoadable) ) {
      throw new MappingException( "class persister is not SQLLoadable: " + entityName );
    }
    return (SQLLoadable) persister;
  }
View Full Code Here

    if ( "get".equals( cacheMode ) ) return CacheMode.GET;
    if ( "ignore".equals( cacheMode ) ) return CacheMode.IGNORE;
    if ( "normal".equals( cacheMode ) ) return CacheMode.NORMAL;
    if ( "put".equals( cacheMode ) ) return CacheMode.PUT;
    if ( "refresh".equals( cacheMode ) ) return CacheMode.REFRESH;
    throw new MappingException("Unknown Cache Mode: " + cacheMode);
  }
View Full Code Here

      String qualifiedExtendsName = getClassName( extendsName, mappings );
      superModel = mappings.getClass( qualifiedExtendsName );
    }

    if ( superModel == null ) {
      throw new MappingException( "Cannot extend unmapped class " + extendsName );
    }
    return superModel;
  }
View Full Code Here

    }
    else if ( "none".equals( olMode ) ) {
      return Versioning.OPTIMISTIC_LOCK_NONE;
    }
    else {
      throw new MappingException( "Unsupported optimistic-lock style: " + olMode );
    }
  }
View Full Code Here

    //      persisters).
    if ( StringHelper.isEmpty(condition) ) {
      condition = model.getFilterDefinition(name).getDefaultFilterCondition();
    }
    if ( condition==null) {
      throw new MappingException("no filter condition found for filter: " + name);
    }
    log.debug( "Applying filter [" + name + "] as [" + condition + "]" );
    filterable.addFilter( name, condition );
  }
View Full Code Here

  }

  private OuterJoinLoadable getOuterJoinLoadable(String entityName) throws MappingException {
    EntityPersister persister = factory.getEntityPersister(entityName);
    if ( !(persister instanceof OuterJoinLoadable) ) {
      throw new MappingException( "class persister is not OuterJoinLoadable: " + entityName );
    }
    return ( OuterJoinLoadable ) persister;
  }
View Full Code Here

  public CustomCollectionType(Class userTypeClass, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) {
    super(role, foreignKeyPropertyName, isEmbeddedInXML);

    if ( !UserCollectionType.class.isAssignableFrom( userTypeClass ) ) {
      throw new MappingException( "Custom type does not implement UserCollectionType: " + userTypeClass.getName() );
    }

    try {
      userType = ( UserCollectionType ) userTypeClass.newInstance();
    }
    catch ( InstantiationException ie ) {
      throw new MappingException( "Cannot instantiate custom type: " + userTypeClass.getName() );
    }
    catch ( IllegalAccessException iae ) {
      throw new MappingException( "IllegalAccessException trying to instantiate custom type: " + userTypeClass.getName() );
    }

    customLogging = LoggableUserType.class.isAssignableFrom( userTypeClass );
  }
View Full Code Here

        if ( Type.class.isAssignableFrom( typeClass ) ) {
          try {
            type = (Type) typeClass.newInstance();
          }
          catch (Exception e) {
            throw new MappingException(
                "Could not instantiate Type: " + typeClass.getName(),
                e
              );
          }
          injectParameters(type, parameters);
View Full Code Here

TOP

Related Classes of org.hibernate.MappingException

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.