Package org.hibernate.mapping

Examples of org.hibernate.mapping.PersistentClass


          stackOfPersistentClassesBeingProcessed.size() - 1
      );
  }

  public PersistentClass getPersistentClassHostingProperties(MappedSuperclassTypeImpl<?> mappedSuperclassType) {
    final PersistentClass persistentClass = mappedSuperClassTypeToPersistentClass.get( mappedSuperclassType );
    if (persistentClass == null) {
      throw new AssertionFailure( "Could not find PersistentClass for MappedSuperclassType: "
          + mappedSuperclassType.getJavaType() );
    }
    return persistentClass;
View Full Code Here


    String defaultCatalog = properties.getProperty( Environment.DEFAULT_CATALOG );
    String defaultSchema = properties.getProperty( Environment.DEFAULT_SCHEMA );

    Iterator iter = classes.values().iterator();
    while ( iter.hasNext() ) {
      PersistentClass pc = (PersistentClass) iter.next();

      if ( !pc.isInherited() ) {

        IdentifierGenerator ig = pc.getIdentifier()
            .createIdentifierGenerator(
                dialect,
                defaultCatalog,
                defaultSchema,
                (RootClass) pc
View Full Code Here

    iter = propertyReferences.iterator();
    while ( iter.hasNext() ) {
      Mappings.PropertyReference upr = (Mappings.PropertyReference) iter.next();

      PersistentClass clazz = getClassMapping( upr.referencedClass );
      if ( clazz == null ) {
        throw new MappingException(
            "property-ref to unmapped class: " +
            upr.referencedClass
          );
      }

      Property prop = clazz.getReferencedProperty( upr.propertyName );
      if ( upr.unique ) {
        ( (SimpleValue) prop.getValue() ).setAlternateUniqueKey( true );
      }
    }
View Full Code Here

            );
        }
        if ( log.isDebugEnabled() ) {
          log.debug( "resolving reference to class: " + referencedEntityName );
        }
        PersistentClass referencedClass = (PersistentClass) classes.get( referencedEntityName );
        if ( referencedClass == null ) {
          throw new MappingException(
              "An association from the table " +
              fk.getTable().getName() +
              " refers to an unmapped class: " +
              referencedEntityName
            );
        }
        if ( referencedClass.isJoinedSubclass() ) {
          secondPassCompileForeignKeys( referencedClass.getSuperclass().getTable(), done );
        }
        fk.setReferencedTable( referencedClass.getTable() );
        fk.alignColumns();
      }
    }
  }
View Full Code Here

    return new Mapping() {
      /**
       * Returns the identifier type of a mapped class
       */
      public Type getIdentifierType(String persistentClass) throws MappingException {
        PersistentClass pc = ( (PersistentClass) classes.get( persistentClass ) );
        if ( pc == null ) {
          throw new MappingException( "persistent class not known: " + persistentClass );
        }
        return pc.getIdentifier().getType();
      }

      public String getIdentifierPropertyName(String persistentClass) throws MappingException {
        final PersistentClass pc = (PersistentClass) classes.get( persistentClass );
        if ( pc == null ) {
          throw new MappingException( "persistent class not known: " + persistentClass );
        }
        if ( !pc.hasIdentifierProperty() ) {
          return null;
        }
        return pc.getIdentifierProperty().getName();
      }

      public Type getReferencedPropertyType(String persistentClass, String propertyName) throws MappingException {
        final PersistentClass pc = (PersistentClass) classes.get( persistentClass );
        if ( pc == null ) {
          throw new MappingException( "persistent class not known: " + persistentClass );
        }
        Property prop = pc.getReferencedProperty( propertyName );
        if ( prop == null ) {
          throw new MappingException(
              "property not known: " +
              persistentClass + '.' + propertyName
            );
View Full Code Here

      new SingletonIterator(model),
      model.getSubclassIterator()
    );

    while ( siter.hasNext() ) {
      PersistentClass clazz = (PersistentClass) siter.next();
      Table table = clazz.getTable();
      if ( !table.isAbstractUnionTable() ) {
        //TODO: move to .sql package!!
        buf.append("select ");
        Iterator citer = columns.iterator();
        while ( citer.hasNext() ) {
          Column col = (Column) citer.next();
          if ( !table.containsColumn(col) ) {
            int sqlType = col.getSqlTypeCode(mapping);
            buf.append( dialect.getSelectClauseNullString(sqlType) )
              .append(" as ");
          }
          buf.append( col.getName() );
          buf.append(", ");
        }
        buf.append( clazz.getSubclassId() )
          .append(" as clazz_");
        buf.append(" from ")
          .append( table.getQualifiedName(
              dialect,
              settings.getDefaultCatalogName(),
View Full Code Here

    public void addToExtendsQueue(ExtendsQueueEntry entry) {
      extendsQueue.put( entry, null );
    }

  public PersistentClass locatePersistentClassByEntityName(String entityName) {
    PersistentClass persistentClass = ( PersistentClass ) classes.get( entityName );
    if ( persistentClass == null ) {
      String actualEntityName = ( String ) imports.get( entityName );
      if ( StringHelper.isNotEmpty( actualEntityName ) ) {
        persistentClass = ( PersistentClass ) classes.get( actualEntityName );
      }
View Full Code Here

    deleteCallable = new boolean[tableSpan];
    insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
    updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
    deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];

    PersistentClass pc = persistentClass;
    int jk = tableSpan-1;
    while (pc!=null) {
      customSQLInsert[jk] = pc.getCustomSQLInsert();
      insertCallable[jk] = customSQLInsert[jk] != null && pc.isCustomInsertCallable();
      insertResultCheckStyles[jk] = pc.getCustomSQLInsertCheckStyle() == null
                                    ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLInsert[jk], insertCallable[jk] )
                                      : pc.getCustomSQLInsertCheckStyle();
      customSQLUpdate[jk] = pc.getCustomSQLUpdate();
      updateCallable[jk] = customSQLUpdate[jk] != null && pc.isCustomUpdateCallable();
      updateResultCheckStyles[jk] = pc.getCustomSQLUpdateCheckStyle() == null
                                    ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLUpdate[jk], updateCallable[jk] )
                                      : pc.getCustomSQLUpdateCheckStyle();
      customSQLDelete[jk] = pc.getCustomSQLDelete();
      deleteCallable[jk] = customSQLDelete[jk] != null && pc.isCustomDeleteCallable();
      deleteResultCheckStyles[jk] = pc.getCustomSQLDeleteCheckStyle() == null
                                    ? ExecuteUpdateResultCheckStyle.determineDefault( customSQLDelete[jk], deleteCallable[jk] )
                                      : pc.getCustomSQLDeleteCheckStyle();
      jk--;
      pc = pc.getSuperclass();
    }
    if ( jk != -1 ) {
      throw new AssertionFailure( "Tablespan does not match height of joined-subclass hiearchy." );
    }
View Full Code Here

    if ( persistentClass.hasPojoRepresentation() ) {
      //TODO: this is currently specific to pojos, but need to be available for all entity-modes
      Iterator iter = persistentClass.getSubclassIterator();
      while ( iter.hasNext() ) {
        PersistentClass pc = ( PersistentClass ) iter.next();
        entityNameBySubclass.put( pc.getMappedClass(), pc.getEntityName() );
      }
    }
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    int batch = persistentClass.getBatchSize();
View Full Code Here

    Map components = new HashMap();
   
    for (Iterator classes = cfg.getClassMappings(); classes.hasNext(); ) {
        if(exporter.startMapping(cfg) ) {
            PersistentClass clazz = (PersistentClass) classes.next();
            collectComponents(components,clazz);
           
            if(exporter.startPersistentClass(clazz) ) {
                if(clazz.hasIdentifierProperty() ) {
                    exporter.startIdentifierProperty(clazz.getIdentifierProperty() );
                    exporter.endIdentifierProperty(clazz.getIdentifierProperty() );
                }
                else if (clazz.hasEmbeddedIdentifier() ) {
            exporter.startEmbeddedIdentifier( (Component)clazz.getKey() );
            exporter.endEmbeddedIdentifier( (Component)clazz.getKey() );
                }
                Iterator unjoinedPropertyIterator = clazz.getUnjoinedPropertyIterator();
                while(unjoinedPropertyIterator.hasNext() ) {
                    Property prop = (Property)unjoinedPropertyIterator.next();
                    exporter.startProperty(prop);
                    exporter.endProperty(prop);
                }
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.PersistentClass

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.