Package org.hibernate.mapping

Examples of org.hibernate.mapping.Subclass


      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


    mappings.addClass( subclass );
  }

  private static void handleSubclass(PersistentClass model, Mappings mappings, Element subnode,
      java.util.Map inheritedMetas) throws MappingException {
    Subclass subclass = new SingleTableSubclass( model );
    bindSubclass( subnode, subclass, mappings, inheritedMetas );
    model.addSubclass( subclass );
    mappings.addClass( subclass );
  }
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

      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

    // 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

    mappings.addClass( subclass );
  }

  private static void handleSubclass(PersistentClass model, Mappings mappings, Element subnode,
      java.util.Map inheritedMetas) throws MappingException {
    Subclass subclass = new SingleTableSubclass( model );
    bindSubclass( subnode, subclass, mappings, inheritedMetas );
    model.addSubclass( subclass );
    mappings.addClass( subclass );
  }
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

    // 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

    // 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

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.