Package org.hibernate.mapping

Examples of org.hibernate.mapping.RootClass


      boolean cacheLazyProperty) throws MappingException {
    caches.add( new CacheHolder( entityName, concurrencyStrategy, region, true, cacheLazyProperty ) );
  }

  private void applyCacheConcurrencyStrategy(CacheHolder holder) {
    RootClass rootClass = getRootClassMapping( holder.role );
    if ( rootClass == null ) {
      throw new MappingException( "Cannot cache an unknown entity: " + holder.role );
    }
    rootClass.setCacheConcurrencyStrategy( holder.usage );
    rootClass.setCacheRegionName( holder.region );
    rootClass.setLazyPropertiesCacheable( holder.cacheLazy );
  }
View Full Code Here


        .isEqualTo( SingleTableOgmEntityPersister.class );
  }

  @Test
  public void testPersistentRootSingleTableStrategy() throws Exception {
    RootClass rootClass = new RootClass();
    assertThat( resolver.getEntityPersisterClass( rootClass ) ).isEqualTo( SingleTableOgmEntityPersister.class );
  }
View Full Code Here

    assertThat( resolver.getEntityPersisterClass( rootClass ) ).isEqualTo( SingleTableOgmEntityPersister.class );
  }

  @Test
  public void testSinglePersistentClassTableStrategy() throws Exception {
    Subclass subclass = new SingleTableSubclass( new RootClass() );
    assertThat( resolver.getEntityPersisterClass( subclass ) ).isEqualTo( SingleTableOgmEntityPersister.class );
  }
View Full Code Here

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

  @Test
  public void testTablePerClassPersistentSubclassStrategy() throws Exception {
    Subclass subclass = new UnionSubclass( new RootClass() );
    assertThat( resolver.getEntityPersisterClass( subclass ) ).isEqualTo( UnionSubclassOgmEntityPersister.class );
  }
View Full Code Here

    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

        log.debug( "Ignoring " + table + " as class since rev.eng. says it is a many-to-many" );
        continue;
      }

       
      RootClass rc = new RootClass();
      TableIdentifier tableIdentifier = TableIdentifier.create(table);
      String className = revengStrategy.tableToClassName( tableIdentifier );
      log.debug("Building entity " + className + " based on " + tableIdentifier);
      rc.setEntityName( className );
      rc.setClassName( className );
      rc.setProxyInterfaceName( rc.getEntityName() ); // TODO: configurable ?
      rc.setLazy(true);

      rc.setMetaAttributes( safeMeta(revengStrategy.tableToMetaAttributes( tableIdentifier )) );


      rc.setDiscriminatorValue( rc.getEntityName() );
      rc.setTable(table);
      try {
        mappings.addClass(rc);
      } catch(DuplicateMappingException dme) {
        // TODO: detect this and generate a "permutation" of it ?
        PersistentClass class1 = mappings.getClass(dme.getName());
        Table table2 = class1.getTable();
        throw new JDBCBinderException("Duplicate class name '" + rc.getEntityName() + "' generated for '" + table + "'. Same name where generated for '" + table2 + "'");
      }
      mappings.addImport( rc.getEntityName(), rc.getEntityName() );

      Set processed = new HashSet();


      PrimaryKeyInfo pki = bindPrimaryKeyToProperties(table, rc, processed, mapping, collector);
      bindColumnsToVersioning(table, rc, processed, mapping);
      bindOutgoingForeignKeys(table, rc, processed);
      bindColumnsToProperties(table, rc, processed, mapping);
      List incomingForeignKeys = (List) manyToOneCandidates.get( rc.getEntityName() );
      bindIncomingForeignKeys(rc, processed, incomingForeignKeys, mapping);
      updatePrimaryKey(rc, pki);

    }
View Full Code Here

      }
      else if ( "typedef".equals( elementName ) ) {
        bindTypeDef( element, mappings );
      }
      else if ( "class".equals( elementName ) ) {
        RootClass rootclass = new RootClass();
        bindRootClass( element, rootclass, mappings, inheritedMetas );
        mappings.addClass( rootclass );
      }
      else if ( "subclass".equals( elementName ) ) {
        PersistentClass superModel = getSuperclass( mappings, element );
View Full Code Here

    setCacheConcurrencyStrategy( clazz, concurrencyStrategy, region, true );
  }

  void setCacheConcurrencyStrategy(String clazz, String concurrencyStrategy, String region, boolean includeLazy)
      throws MappingException {
    RootClass rootClass = getRootClassMapping( clazz );
    if ( rootClass == null ) {
      throw new MappingException( "Cannot cache an unknown entity: " + clazz );
    }
    rootClass.setCacheConcurrencyStrategy( concurrencyStrategy );
    rootClass.setCacheRegionName( region );
    rootClass.setLazyPropertiesCacheable( includeLazy );
  }
View Full Code Here

    setCacheConcurrencyStrategy( clazz, concurrencyStrategy, region, true );
  }

  void setCacheConcurrencyStrategy(String clazz, String concurrencyStrategy, String region, boolean includeLazy)
      throws MappingException {
    RootClass rootClass = getRootClassMapping( clazz );
    if ( rootClass == null ) {
      throw new MappingException( "Cannot cache an unknown entity: " + clazz );
    }
    rootClass.setCacheConcurrencyStrategy( concurrencyStrategy );
    rootClass.setCacheRegionName( region );
    rootClass.setLazyPropertiesCacheable( includeLazy );
  }
View Full Code Here

      boolean cacheLazyProperty) throws MappingException {
    caches.add( new CacheHolder( entityName, concurrencyStrategy, region, true, cacheLazyProperty ) );
  }

  private void applyCacheConcurrencyStrategy(CacheHolder holder) {
    RootClass rootClass = getRootClassMapping( holder.role );
    if ( rootClass == null ) {
      throw new MappingException( "Cannot cache an unknown entity: " + holder.role );
    }
    rootClass.setCacheConcurrencyStrategy( holder.usage );
    rootClass.setCacheRegionName( holder.region );
    rootClass.setLazyPropertiesCacheable( holder.cacheLazy );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.RootClass

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.