Examples of RootClass


Examples of org.hibernate.mapping.RootClass

    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

Examples of org.hibernate.mapping.RootClass

    }
    persistentClass.setDynamicInsert( dynamicInsert );
    persistentClass.setDynamicUpdate( dynamicUpdate );

    if ( persistentClass instanceof RootClass ) {
      RootClass rootClass = (RootClass) persistentClass;
      boolean mutable = true;
      //priority on @Immutable, then @Entity.mutable()
      if ( annotatedClass.isAnnotationPresent( Immutable.class ) ) {
        mutable = false;
      }
      else {
        org.hibernate.annotations.Entity entityAnn =
            annotatedClass.getAnnotation( org.hibernate.annotations.Entity.class );
        if ( entityAnn != null ) {
          mutable = entityAnn.mutable();
        }
      }
      rootClass.setMutable( mutable );
      rootClass.setExplicitPolymorphism( isExplicitPolymorphism( polymorphismType ) );
      if ( StringHelper.isNotEmpty( where ) ) rootClass.setWhere( where );
      if ( cacheConcurrentStrategy != null ) {
        rootClass.setCacheConcurrencyStrategy( cacheConcurrentStrategy );
        rootClass.setCacheRegionName( cacheRegion );
        rootClass.setLazyPropertiesCacheable( cacheLazyProperty );
      }
      rootClass.setForceDiscriminator( annotatedClass.isAnnotationPresent( ForceDiscriminator.class ) );
    }
    else {
      if ( explicitHibernateEntityAnnotation ) {
        log.warn( "@org.hibernate.annotations.Entity used on a non root entity: ignored for {}",
            annotatedClass.getName() );
View Full Code Here

Examples of org.hibernate.mapping.RootClass

      }
      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

Examples of org.hibernate.mapping.RootClass

    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

Examples of org.hibernate.mapping.RootClass

      }
      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

Examples of org.hibernate.mapping.RootClass

    }
    persistentClass.setDynamicInsert( dynamicInsert );
    persistentClass.setDynamicUpdate( dynamicUpdate );

    if ( persistentClass instanceof RootClass ) {
      RootClass rootClass = (RootClass) persistentClass;
      boolean mutable = true;
      //priority on @Immutable, then @Entity.mutable()
      if ( annotatedClass.isAnnotationPresent( Immutable.class ) ) {
        mutable = false;
      }
      else {
        org.hibernate.annotations.Entity entityAnn =
            annotatedClass.getAnnotation( org.hibernate.annotations.Entity.class );
        if ( entityAnn != null ) {
          mutable = entityAnn.mutable();
        }
      }
      rootClass.setMutable( mutable );
      rootClass.setExplicitPolymorphism( isExplicitPolymorphism( polymorphismType ) );
      if ( StringHelper.isNotEmpty( where ) ) rootClass.setWhere( where );
      if ( cacheConcurrentStrategy != null ) {
        rootClass.setCacheConcurrencyStrategy( cacheConcurrentStrategy );
        rootClass.setCacheRegionName( cacheRegion );
        rootClass.setLazyPropertiesCacheable( cacheLazyProperty );
      }
      rootClass.setNaturalIdCacheRegionName( naturalIdCacheRegion );
      boolean forceDiscriminatorInSelects = forceDiscriminator == null
          ? mappings.forceDiscriminatorInSelectsByDefault()
          : forceDiscriminator;
      rootClass.setForceDiscriminator( forceDiscriminatorInSelects );
      if( insertableDiscriminator != null) {
        rootClass.setDiscriminatorInsertable( insertableDiscriminator );
      }
    }
    else {
            if (explicitHibernateEntityAnnotation) {
        LOG.entityAnnotationOnNonRoot(annotatedClass.getName());
View Full Code Here

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

Examples of org.hibernate.mapping.RootClass

    this.isXToMany = xToMany;
  }

  private Property bind(Property prop) {
    if (isId) {
      final RootClass rootClass = ( RootClass ) holder.getPersistentClass();
      //if an xToMany, it as to be wrapped today.
      //FIXME this pose a problem as the PK is the class instead of the associated class which is not really compliant with the spec
      if ( isXToMany || entityBinder.wrapIdsInEmbeddedComponents() ) {
        Component identifier = (Component) rootClass.getIdentifier();
        if (identifier == null) {
          identifier = AnnotationBinder.createComponent( holder, new PropertyPreloadedData(null, null, null), true, false, mappings );
          rootClass.setIdentifier( identifier );
          identifier.setNullValue( "undefined" );
          rootClass.setEmbeddedIdentifier( true );
          rootClass.setIdentifierMapper( identifier );
        }
        //FIXME is it good enough?
        identifier.addProperty( prop );
      }
      else {
        rootClass.setIdentifier( ( KeyValue ) getValue() );
        if (embedded) {
          rootClass.setEmbeddedIdentifier( true );
        }
        else {
          rootClass.setIdentifierProperty( prop );
          final org.hibernate.mapping.MappedSuperclass superclass = BinderHelper.getMappedSuperclassOrNull(
              declaringClass,
              inheritanceStatePerClass,
              mappings
          );
          if (superclass != null) {
            superclass.setDeclaredIdentifierProperty(prop);
          }
          else {
            //we know the property is on the actual entity
            rootClass.setDeclaredIdentifierProperty( prop );
          }
        }
      }
    }
    else {
View Full Code Here

Examples of org.hibernate.mapping.RootClass

        Session session = mockSession();
        Logger logger = mockLogger();

        replay();

        RootClass persistentClass = new RootClass();
        Property idProperty = new Property();
        idProperty.setName("id");
        persistentClass.setIdentifierProperty(idProperty);
        SampleEntity entity = new SampleEntity();

        HibernateEntityValueEncoder<SampleEntity> encoder = new HibernateEntityValueEncoder<SampleEntity>(
                SampleEntity.class, persistentClass, session, access, typeCoercer, logger);
View Full Code Here

Examples of org.hibernate.mapping.RootClass

        logger.error("Unable to convert client value '12345' into an entity instance.");

        replay();

        RootClass persistentClass = new RootClass();
        Property idProperty = new Property();
        idProperty.setName("id");
        persistentClass.setIdentifierProperty(idProperty);
        SampleEntity entity = new SampleEntity();

        HibernateEntityValueEncoder<SampleEntity> encoder = new HibernateEntityValueEncoder<SampleEntity>(
                SampleEntity.class, persistentClass, session, access, typeCoercer, logger);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.