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() ) {
          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


    );
    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

    );
    if ( persistentClass.isPolymorphic() ) {
      @SuppressWarnings( "unchecked" )
      Iterator<Subclass> iter = persistentClass.getSubclassIterator();
      while ( iter.hasNext() ) {
        Subclass sc = iter.next();
        subclassByDiscriminatorValue.put( sc.getSubclassId(), sc.getEntityName() );
      }
    }

    //SPACES
    //TODO: i'm not sure, but perhaps we should exclude
View Full Code Here

    PersistentClass pc = new RootClass();
    assertTrue(c2h.needsTable(pc));
    assertTrue(c2h.needsTable(new JoinedSubclass(pc)));
    assertTrue(c2h.needsTable(new UnionSubclass(pc)));
    assertFalse(c2h.needsTable(new SingleTableSubclass(pc)));
    assertFalse(c2h.needsTable(new Subclass(pc)));
       
  }
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 = sc.getSubclassId();
          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

    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

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

    }

    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

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.