Package org.hibernate

Examples of org.hibernate.MappingException


  private static boolean isCallable(Element element, boolean supportsCallable)
      throws MappingException {
    Attribute attrib = element.attribute( "callable" );
    if ( attrib != null && "true".equals( attrib.getValue() ) ) {
      if ( !supportsCallable ) {
        throw new MappingException( "callable attribute not supported yet!" );
      }
      return true;
    }
    return false;
  }
View Full Code Here


        }
      }
    }
    else {
      if ( node.elementIterator( "column" ).hasNext() ) {
        throw new MappingException(
          "column attribute may not be used together with <column> subelement" );
      }
      if ( node.elementIterator( "formula" ).hasNext() ) {
        throw new MappingException(
          "column attribute may not be used together with <formula> subelement" );
      }

      Column column = new Column();
      column.setValue( simpleValue );
View Full Code Here

          property.setInsertable( false );
            }
            else {
              // the user specifically supplied insert="true",
              // which constitutes an illegal combo
          throw new MappingException(
              "cannot specify both insert=\"true\" and generated=\"" + generation.getName() +
              "\" for property: " +
              propName
          );
            }
          }

          // properties generated on update can never be updateable...
          if ( property.isUpdateable() && generation == PropertyGeneration.ALWAYS ) {
            if ( updateNode == null ) {
              // updateable only because the user did not specify
              // anything; just override it
              property.setUpdateable( false );
            }
            else {
              // the user specifically supplied update="true",
              // which constitutes an illegal combo
          throw new MappingException(
              "cannot specify both update=\"true\" and generated=\"" + generation.getName() +
              "\" for property: " +
              propName
          );
            }
View Full Code Here

      try {
        collection.setCollectionPersisterClass( ReflectHelper.classForName( persisterNode
          .getValue() ) );
      }
      catch (ClassNotFoundException cnfe) {
        throw new MappingException( "Could not find collection persister class: "
          + persisterNode.getValue() );
      }
    }

    Attribute typeNode = node.attribute( "collection-type" );
View Full Code Here

  }

  private static void validateCascade(Element node, String path) {
    String cascade = node.attributeValue( "cascade" );
    if ( cascade != null && cascade.indexOf( "delete-orphan" ) >= 0 ) {
      throw new MappingException( "single-valued associations do not support orphan delete: " + path );
    }
  }
View Full Code Here

              .attributeValue( "value" ) );
            String entityName = getClassName( metaValue.attribute( "class" ), mappings );
            values.put( value, entityName );
          }
          catch (ClassCastException cce) {
            throw new MappingException( "meta-type was not a DiscriminatorType: "
              + metaType.getName() );
          }
          catch (Exception e) {
            throw new MappingException( "could not interpret meta-value", e );
          }
        }
        any.setMetaValues( values );
      }
View Full Code Here

        false
      );

    if ( "true".equals( node.attributeValue("mapped") ) ) {
      if ( propertyName!=null ) {
        throw new MappingException("cannot combine mapped=\"true\" with specified name");
      }
      Component mapper = new Component(persistentClass);
      bindComponent(
          node,
          mapper,
View Full Code Here

          final Element subnode,
          final Mappings mappings,
      java.util.Map inheritedMetas) throws MappingException {

    if ( StringHelper.isEmpty( propertyName ) ) {
      throw new MappingException( subnode.getName() + " mapping must defined a name attribute [" + className + "]" );
    }

    value.setTypeUsingReflection( className, propertyName );

    // this is done here 'cos we might only know the type here (ugly!)
View Full Code Here

            map.isOneToMany(),
            IndexedCollection.DEFAULT_INDEX_COLUMN_NAME,
            mappings
          );
        if ( !value.isTypeSpecified() ) {
          throw new MappingException( "map index element must specify a type: "
            + map.getRole() );
        }
        map.setIndex( value );
        map.setIndexNodeName( subnode.attributeValue("node") );
      }
View Full Code Here

    if ( collection.isOneToMany() ) {
      OneToMany oneToMany = (OneToMany) collection.getElement();
      String assocClass = oneToMany.getReferencedEntityName();
      PersistentClass persistentClass = (PersistentClass) persistentClasses.get( assocClass );
      if ( persistentClass == null ) {
        throw new MappingException( "Association references unmapped class: " + assocClass );
      }
      oneToMany.setAssociatedClass( persistentClass );
      collection.setCollectionTable( persistentClass.getTable() );

      log.info(
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.