Package org.hibernate.mapping

Examples of org.hibernate.mapping.JoinedSubclass


    assertThat( resolver.getEntityPersisterClass( subclass ) ).isEqualTo( UnionSubclassOgmEntityPersister.class );
  }

  @Test(expected = UnsupportedOperationException.class)
  public void testPersistenceClassSubclassJoinedStrategy() throws Exception {
    Subclass subclass = new JoinedSubclass( new RootClass() );
    resolver.getEntityPersisterClass( subclass );
  }
View Full Code Here


    mappings.addClass( subclass );
  }

  private static void handleJoinedSubclass(PersistentClass model, Mappings mappings,
      Element subnode, java.util.Map inheritedMetas) throws MappingException {
    JoinedSubclass subclass = new JoinedSubclass( model );
    bindJoinedSubclass( subnode, subclass, mappings, inheritedMetas );
    model.addSubclass( subclass );
    mappings.addClass( subclass );
  }
View Full Code Here

    mappings.addClass( subclass );
  }

  private static void handleJoinedSubclass(PersistentClass model, Mappings mappings,
      Element subnode, java.util.Map inheritedMetas) throws MappingException {
    JoinedSubclass subclass = new JoinedSubclass( model );
    bindJoinedSubclass( subnode, subclass, mappings, inheritedMetas );
    model.addSubclass( subclass );
    mappings.addClass( subclass );
  }
View Full Code Here

    mappings.addClass( subclass );
  }

  private static void handleJoinedSubclass(PersistentClass model, Mappings mappings,
      Element subnode, java.util.Map inheritedMetas) throws MappingException {
    JoinedSubclass subclass = new JoinedSubclass( model );
    bindJoinedSubclass( subnode, subclass, mappings, inheritedMetas );
    model.addSubclass( subclass );
    mappings.addClass( subclass );
  }
View Full Code Here

    final boolean hasSubclasses = inheritanceState.hasSiblings();

    if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) {
      if ( inheritanceState.hasParents() ) {
        onDeleteAppropriate = true;
        final JoinedSubclass jsc = ( JoinedSubclass ) persistentClass;
        SimpleValue key = new DependantValue( mappings, jsc.getTable(), jsc.getIdentifier() );
        jsc.setKey( key );
        ForeignKey fk = clazzToProcess.getAnnotation( ForeignKey.class );
        if ( fk != null && !BinderHelper.isEmptyAnnotationValue( fk.name() ) ) {
          key.setForeignKeyName( fk.name() );
        }
        if ( onDeleteAnn != null ) {
View Full Code Here

    }
    else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) {
      persistentClass = new SingleTableSubclass( superEntity );
    }
    else if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) ) {
      persistentClass = new JoinedSubclass( superEntity );
    }
    else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.getType() ) ) {
      persistentClass = new UnionSubclass( superEntity );
    }
    else {
View Full Code Here

    }
    else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.type ) ) {
      persistentClass = new SingleTableSubclass( superEntity );
    }
    else if ( InheritanceType.JOINED.equals( inheritanceState.type ) ) {
      persistentClass = new JoinedSubclass( superEntity );
    }
    else if ( InheritanceType.TABLE_PER_CLASS.equals( inheritanceState.type ) ) {
      persistentClass = new UnionSubclass( superEntity );
    }
    else {
      throw new AssertionFailure( "Unknown inheritance type: " + inheritanceState.type );
    }
    Proxy proxyAnn = annotatedClass.getAnnotation( Proxy.class );
    BatchSize sizeAnn = annotatedClass.getAnnotation( BatchSize.class );
    Where whereAnn = annotatedClass.getAnnotation( Where.class );
    Entity entityAnn = annotatedClass.getAnnotation( Entity.class );
    org.hibernate.annotations.Entity hibEntityAnn = annotatedClass.getAnnotation(
        org.hibernate.annotations.Entity.class
    );
    org.hibernate.annotations.Cache cacheAnn = annotatedClass.getAnnotation(
        org.hibernate.annotations.Cache.class
    );
    EntityBinder entityBinder = new EntityBinder(
        entityAnn, hibEntityAnn, clazzToProcess, persistentClass, mappings
    );
    entityBinder.setDiscriminatorValue( discrimValue );
    entityBinder.setBatchSize( sizeAnn );
    entityBinder.setProxy( proxyAnn );
    entityBinder.setWhere( whereAnn );
    entityBinder.setCache( cacheAnn );
    entityBinder.setInheritanceState( inheritanceState );
    Filter filterAnn = annotatedClass.getAnnotation( Filter.class );
    if ( filterAnn != null ) {
      entityBinder.addFilter( filterAnn.name(), filterAnn.condition() );
    }
    Filters filtersAnn = annotatedClass.getAnnotation( Filters.class );
    if ( filtersAnn != null ) {
      for (Filter filter : filtersAnn.value()) {
        entityBinder.addFilter( filter.name(), filter.condition() );
      }
    }
    entityBinder.bindEntity();

    if ( inheritanceState.hasTable() ) {
      Check checkAnn = annotatedClass.getAnnotation( Check.class );
      String constraints = checkAnn == null ?
          null :
          checkAnn.constraints();
      entityBinder.bindTable(
          schema, catalog, table, uniqueConstraints,
          constraints, inheritanceState.hasDenormalizedTable() ?
          superEntity.getTable() :
          null
      );
    }
    else {
      if ( annotatedClass.isAnnotationPresent( Table.class ) ) {
        log.warn( "Illegal use of @Table in a subclass of a SINGLE_TABLE hierarchy: " + clazzToProcess
            .getName() );
      }
    }
//    Map<String, Column[]> columnOverride = PropertyHolderBuilder.buildHierarchyColumnOverride(
//        clazzToProcess,
//        persistentClass.getClassName()
//    );
    PropertyHolder propertyHolder = PropertyHolderBuilder.buildPropertyHolder(
        clazzToProcess,
        persistentClass,
        entityBinder, mappings
    );

    javax.persistence.SecondaryTable secTabAnn = annotatedClass.getAnnotation(
        javax.persistence.SecondaryTable.class
    );
    javax.persistence.SecondaryTables secTabsAnn = annotatedClass.getAnnotation(
        javax.persistence.SecondaryTables.class
    );
    entityBinder.firstLevelSecondaryTablesBinding( secTabAnn, secTabsAnn );

    OnDelete onDeleteAnn = annotatedClass.getAnnotation( OnDelete.class );
    boolean onDeleteAppropriate = false;
    if ( InheritanceType.JOINED.equals( inheritanceState.type ) && inheritanceState.hasParents ) {
      onDeleteAppropriate = true;
      final JoinedSubclass jsc = (JoinedSubclass) persistentClass;
      if ( persistentClass.getEntityPersisterClass() == null ) {
        persistentClass.getRootClass().setEntityPersisterClass( JoinedSubclassEntityPersister.class );
      }
      SimpleValue key = new DependantValue( jsc.getTable(), jsc.getIdentifier() );
      jsc.setKey( key );
      ForeignKey fk = annotatedClass.getAnnotation( ForeignKey.class );
      if ( fk != null && !BinderHelper.isDefault( fk.name() ) ) {
        key.setForeignKeyName( fk.name() );
      }
      if ( onDeleteAnn != null ) {
View Full Code Here

    mappings.addClass( subclass );
  }

  private static void handleJoinedSubclass(PersistentClass model, Mappings mappings,
      Element subnode, java.util.Map inheritedMetas) throws MappingException {
    JoinedSubclass subclass = new JoinedSubclass( model );
    bindJoinedSubclass( subnode, subclass, mappings, inheritedMetas );
    model.addSubclass( subclass );
    mappings.addClass( subclass );
  }
View Full Code Here

    mappings.addClass( subclass );
  }

  private static void handleJoinedSubclass(PersistentClass model, Mappings mappings,
      Element subnode, java.util.Map inheritedMetas) throws MappingException {
    JoinedSubclass subclass = new JoinedSubclass( model );
    bindJoinedSubclass( subnode, subclass, mappings, inheritedMetas );
    model.addSubclass( subclass );
    mappings.addClass( subclass );
  }
View Full Code Here

    OnDelete onDeleteAnn = clazzToProcess.getAnnotation( OnDelete.class );
    boolean onDeleteAppropriate = false;
    if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) && inheritanceState.hasParents() ) {
      onDeleteAppropriate = true;
      final JoinedSubclass jsc = ( JoinedSubclass ) persistentClass;
      SimpleValue key = new DependantValue( mappings, jsc.getTable(), jsc.getIdentifier() );
      jsc.setKey( key );
      ForeignKey fk = clazzToProcess.getAnnotation( ForeignKey.class );
      if ( fk != null && !BinderHelper.isEmptyAnnotationValue( fk.name() ) ) {
        key.setForeignKeyName( fk.name() );
      }
      if ( onDeleteAnn != null ) {
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.JoinedSubclass

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.