Package org.hibernate.mapping

Examples of org.hibernate.mapping.Subclass


    // SUBCLASSES
    if ( persistentClass.isPolymorphic() ) {
      iter = persistentClass.getSubclassIterator();
      int k=1;
      while ( iter.hasNext() ) {
        Subclass sc = (Subclass) iter.next();
        subclassClosure[k++] = sc.getEntityName();
        if ( sc.isDiscriminatorValueNull() ) {
          addSubclassByDiscriminatorValue( NULL_DISCRIMINATOR, sc.getEntityName() );
        }
        else if ( sc.isDiscriminatorValueNotNull() ) {
          addSubclassByDiscriminatorValue( NOT_NULL_DISCRIMINATOR, sc.getEntityName() );
        }
        else {
          try {
            DiscriminatorType dtype = (DiscriminatorType) discriminatorType;
            addSubclassByDiscriminatorValue(
              dtype.stringToObject( sc.getDiscriminatorValue() ),
              sc.getEntityName()
            );
          }
          catch (ClassCastException cce) {
            throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
          }
View Full Code Here


    }

    iter = persistentClass.getSubclassIterator();
    int k = 0;
    while ( iter.hasNext() ) {
      Subclass sc = (Subclass) iter.next();
      subclassClosure[k] = sc.getEntityName();
      try {
        if ( persistentClass.isPolymorphic() ) {
          final Object discriminatorValue;
          if ( explicitDiscriminatorColumnName != null ) {
            if ( sc.isDiscriminatorValueNull() ) {
              discriminatorValue = NULL_DISCRIMINATOR;
            }
            else if ( sc.isDiscriminatorValueNotNull() ) {
              discriminatorValue = NOT_NULL_DISCRIMINATOR;
            }
            else {
              try {
                discriminatorValue = discriminatorType.stringToObject( sc.getDiscriminatorValue() );
              }
              catch (ClassCastException cce) {
                throw new MappingException( "Illegal discriminator type: " + discriminatorType.getName() );
              }
              catch (Exception e) {
                throw new MappingException( "Could not format discriminator value to SQL string", e);
              }
            }
          }
          else {
            // we now use subclass ids that are consistent across all
            // persisters for a class hierarchy, so that the use of
            // "foo.class = Bar" works in HQL
            discriminatorValue = sc.getSubclassId();
          }

          subclassesByDiscriminatorValue.put( discriminatorValue, sc.getEntityName() );
          discriminatorValues[k] = discriminatorValue.toString();
          int id = getTableId(
              sc.getTable().getQualifiedName(
                  factory.getDialect(),
                  factory.getSettings().getDefaultCatalogName(),
                  factory.getSettings().getDefaultSchemaName()
              ),
              subclassTableNameClosure
View Full Code Here

    // included when one of the collected class names is used in TREAT
    final Set<String> classNames = new HashSet<String>();

    final Iterator itr = persistentClass.getDirectSubclasses();
    while ( itr.hasNext() ) {
      final Subclass subclass = (Subclass) itr.next();
      final Set<String> subclassSubclassNames = processPersistentClassHierarchy(
          subclass,
          false,
          factory,
          mapping
View Full Code Here

      proxyInterfaces.add( mappedClass );
    }

    Iterator subclasses = persistentClass.getSubclassIterator();
    while ( subclasses.hasNext() ) {
      final Subclass subclass = ( Subclass ) subclasses.next();
      final Class subclassProxy = subclass.getProxyInterface();
      final Class subclassClass = subclass.getMappedClass();
      if ( subclassProxy!=null && !subclassClass.equals( subclassProxy ) ) {
        if ( !subclassProxy.isInterface() ) {
          throw new MappingException(
              "proxy must be either an interface, or the class itself: " + subclass.getEntityName()
          );
        }
        proxyInterfaces.add( subclassProxy );
      }
    }
View Full Code Here

      proxyInterfaces.add( mappedClass );
    }

    Iterator iter = persistentClass.getSubclassIterator();
    while ( iter.hasNext() ) {
      Subclass subclass = ( Subclass ) iter.next();
      Class subclassProxy = subclass.getProxyInterface();
      Class subclassClass = subclass.getMappedClass();
      if ( subclassProxy!=null && !subclassClass.equals( subclassProxy ) ) {
        if ( !proxyInterface.isInterface() ) {
          throw new MappingException(
                  "proxy must be either an interface, or the class itself: " +
                  subclass.getEntityName()
          );
        }
        proxyInterfaces.add( subclassProxy );
      }
    }
View Full Code Here

    );
    if ( persistentClass.isPolymorphic() ) {
      Iterator iter = persistentClass.getSubclassIterator();
      int k=1;
      while ( iter.hasNext() ) {
        Subclass sc = (Subclass) iter.next();
        subclassClosure[k++] = sc.getEntityName();
        subclassByDiscriminatorValue.put( new Integer( sc.getSubclassId() ), sc.getEntityName() );
      }
    }
   
    //SPACES
    //TODO: i'm not sure, but perhaps we should exclude
View Full Code Here

    }

    iter = persistentClass.getSubclassIterator();
    int k=0;
    while ( iter.hasNext() ) {
      Subclass sc = (Subclass) iter.next();
      subclassClosure[k] = sc.getEntityName();
      try {
        if ( persistentClass.isPolymorphic() ) {
          // we now use subclass ids that are consistent across all
          // persisters for a class hierarchy, so that the use of
          // "foo.class = Bar" works in HQL
          Integer subclassId = new Integer( sc.getSubclassId() );//new Integer(k+1);
          subclassesByDiscriminatorValue.put( subclassId, sc.getEntityName() );
          discriminatorValues[k] = subclassId.toString();
          int id = getTableId(
            sc.getTable().getQualifiedName(
                factory.getDialect(),
                factory.getSettings().getDefaultCatalogName(),
                factory.getSettings().getDefaultSchemaName()
            ),
            subclassTableNameClosure
View Full Code Here

    // SUBCLASSES
    if ( persistentClass.isPolymorphic() ) {
      iter = persistentClass.getSubclassIterator();
      int k=1;
      while ( iter.hasNext() ) {
        Subclass sc = (Subclass) iter.next();
        subclassClosure[k++] = sc.getEntityName();
        if ( sc.isDiscriminatorValueNull() ) {
          subclassesByDiscriminatorValue.put( NULL_DISCRIMINATOR, sc.getEntityName() );
        }
        else if ( sc.isDiscriminatorValueNotNull() ) {
          subclassesByDiscriminatorValue.put( NOT_NULL_DISCRIMINATOR, sc.getEntityName() );
        }
        else {
          try {
            DiscriminatorType dtype = (DiscriminatorType) discriminatorType;
            subclassesByDiscriminatorValue.put(
              dtype.stringToObject( sc.getDiscriminatorValue() ),
              sc.getEntityName()
            );
          }
          catch (ClassCastException cce) {
            throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
          }
View Full Code Here

      proxyInterfaces.add( mappedClass );
    }

    Iterator iter = persistentClass.getSubclassIterator();
    while ( iter.hasNext() ) {
      Subclass subclass = ( Subclass ) iter.next();
      Class subclassProxy = subclass.getProxyInterface();
      Class subclassClass = subclass.getMappedClass();
      if ( subclassProxy!=null && !subclassClass.equals( subclassProxy ) ) {
        if ( !proxyInterface.isInterface() ) {
          throw new MappingException(
                  "proxy must be either an interface, or the class itself: " +
                  subclass.getEntityName()
          );
        }
        proxyInterfaces.add( subclassProxy );
      }
    }
View Full Code Here

      proxyInterfaces.add( mappedClass );
    }

    Iterator iter = persistentClass.getSubclassIterator();
    while ( iter.hasNext() ) {
      Subclass subclass = ( Subclass ) iter.next();
      Class subclassProxy = subclass.getProxyInterface();
      Class subclassClass = subclass.getMappedClass();
      if ( subclassProxy!=null && !subclassClass.equals( subclassProxy ) ) {
        if ( !proxyInterface.isInterface() ) {
          throw new MappingException(
                  "proxy must be either an interface, or the class itself: " +
                  subclass.getEntityName()
          );
        }
        proxyInterfaces.add( subclassProxy );
      }
    }
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.Subclass

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.