Package org.hibernate

Examples of org.hibernate.MappingException


    Class typeClass;
    try {
      typeClass = ReflectHelper.classForName( typeName );
    }
    catch ( ClassNotFoundException cnfe ) {
      throw new MappingException( "user collection type class not found: " + typeName, cnfe );
    }
    CustomCollectionType result = new CustomCollectionType( typeClass, role, propertyRef, embedded );
    if ( typeParameters != null ) {
      TypeFactory.injectParameters( result.getUserType(), typeParameters );
    }
View Full Code Here


  public static void injectParameters(Object type, Properties parameters) {
    if (type instanceof ParameterizedType) {
      ( (ParameterizedType) type ).setParameterValues(parameters);
    }
    else if ( parameters!=null && !parameters.isEmpty() ) {
      throw new MappingException(
          "type is not parameterized: " +
          type.getClass().getName()
        );
    }
  }
View Full Code Here

  }

  public Index addIndex(Index index) {
    Index current = (Index) indexes.get( index.getName() );
    if ( current != null ) {
      throw new MappingException( "Index " + index.getName() + " already exists!" );
    }
    indexes.put( index.getName(), index );
    return index;
  }
View Full Code Here

  }

  public UniqueKey addUniqueKey(UniqueKey uniqueKey) {
    UniqueKey current = (UniqueKey) uniqueKeys.get( uniqueKey.getName() );
    if ( current != null ) {
      throw new MappingException( "UniqueKey " + uniqueKey.getName() + " already exists!" );
    }
    uniqueKeys.put( uniqueKey.getName(), uniqueKey );
    return uniqueKey;
  }
View Full Code Here

     
      QueryableCollection collectionPersister = (QueryableCollection) factory
          .getCollectionPersister( role );
     
      if ( !collectionPersister.getElementType().isEntityType() ) {
        throw new MappingException(
            "collection was not an association: " +
            collectionPersister.getRole()
          );
      }
     
      return collectionPersister.getElementPersister().getEntityName();
     
    }
    catch (ClassCastException cce) {
      throw new MappingException( "collection role is not queryable " + role );
    }
  }
View Full Code Here

        null;
    hasSubclasses = persistentClass.hasSubclasses();

    optimisticLockMode = persistentClass.getOptimisticLockMode();
    if ( optimisticLockMode > Versioning.OPTIMISTIC_LOCK_VERSION && !dynamicUpdate ) {
      throw new MappingException( "optimistic-lock=all|dirty requires dynamic-update=\"true\": " + name );
    }
    if ( versionPropertyIndex != NO_VERSION_INDX && optimisticLockMode > Versioning.OPTIMISTIC_LOCK_VERSION ) {
      throw new MappingException( "version and optimistic-lock=all|dirty are not a valid combination : " + name );
    }

    hasCollections = foundCollection;
    hasMutableProperties = foundMutable;
View Full Code Here

    return entityMetamodel.getNaturalIdentifierProperties();
  }

  public Object[] getNaturalIdentifierSnapshot(Serializable id, SessionImplementor session) throws HibernateException {
    if ( !hasNaturalIdentifier() ) {
      throw new MappingException( "persistent class did not define a natural-id : " + MessageHelper.infoString( this ) );
    }
    if ( log.isTraceEnabled() ) {
      log.trace( "Getting current natural-id snapshot state for: " + MessageHelper.infoString( this, id, getFactory() ) );
    }
View Full Code Here

    if (className==null) return null;
    try {
      return ReflectHelper.classForName(className);
    }
    catch (ClassNotFoundException cnfe) {
      throw new MappingException("entity class not found: " + className, cnfe);
    }
  }
View Full Code Here

    if (proxyInterfaceName==null) return null;
    try {
      return ReflectHelper.classForName(proxyInterfaceName);
    }
    catch (ClassNotFoundException cnfe) {
      throw new MappingException("proxy class not found: " + proxyInterfaceName, cnfe);
    }
  }
View Full Code Here

  public void addSubclass(Subclass subclass) throws MappingException {
    // inheritance cycle detection (paranoid check)
    PersistentClass superclass = getSuperclass();
    while (superclass!=null) {
      if( subclass.getEntityName().equals( superclass.getEntityName() ) ) {
        throw new MappingException(
          "Circular inheritance mapping detected: " +
          subclass.getEntityName() +
          " will have it self as superclass when extending " +
          getEntityName()
        );
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.