Examples of AccessType


Examples of org.hibernate.cache.spi.access.AccessType

      model.prepareTemporaryTables( mapping, getDialect() );
      final String cacheRegionName = cacheRegionPrefix + model.getRootClass().getCacheRegionName();
      // cache region is defined by the root-class in the hierarchy...
      EntityRegionAccessStrategy accessStrategy = ( EntityRegionAccessStrategy ) entityAccessStrategies.get( cacheRegionName );
      if ( accessStrategy == null && settings.isSecondLevelCacheEnabled() ) {
        final AccessType accessType = AccessType.fromExternalName( model.getCacheConcurrencyStrategy() );
        if ( accessType != null ) {
          LOG.tracef( "Building shared cache region for entity data [%s]", model.getEntityName() );
          EntityRegion entityRegion = regionFactory.buildEntityRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) );
          accessStrategy = entityRegion.buildAccessStrategy( accessType );
          entityAccessStrategies.put( cacheRegionName, accessStrategy );
          cacheAccess.addCacheRegion( cacheRegionName, entityRegion );
        }
      }

      NaturalIdRegionAccessStrategy naturalIdAccessStrategy = null;
      if ( model.hasNaturalId() && model.getNaturalIdCacheRegionName() != null ) {
        final String naturalIdCacheRegionName = cacheRegionPrefix + model.getNaturalIdCacheRegionName();
        naturalIdAccessStrategy = ( NaturalIdRegionAccessStrategy ) entityAccessStrategies.get( naturalIdCacheRegionName );

        if ( naturalIdAccessStrategy == null && settings.isSecondLevelCacheEnabled() ) {
          final CacheDataDescriptionImpl cacheDataDescription = CacheDataDescriptionImpl.decode( model );

          NaturalIdRegion naturalIdRegion = null;
          try {
            naturalIdRegion = regionFactory.buildNaturalIdRegion( naturalIdCacheRegionName, properties,
                cacheDataDescription );
          }
          catch ( UnsupportedOperationException e ) {
            LOG.warnf(
                "Shared cache region factory [%s] does not support natural id caching; " +
                    "shared NaturalId caching will be disabled for not be enabled for %s",
                regionFactory.getClass().getName(),
                model.getEntityName()
            );
          }

          if (naturalIdRegion != null) {
            naturalIdAccessStrategy = naturalIdRegion.buildAccessStrategy( regionFactory.getDefaultAccessType() );
            entityAccessStrategies.put( naturalIdCacheRegionName, naturalIdAccessStrategy );
            cacheAccess.addCacheRegionnaturalIdCacheRegionName, naturalIdRegion );
          }
        }
      }

      EntityPersister cp = persisterFactory.createEntityPersister(
          model,
          accessStrategy,
          naturalIdAccessStrategy,
          this,
          mapping
      );
      entityPersisters.put( model.getEntityName(), cp );
      classMeta.put( model.getEntityName(), cp.getClassMetadata() );
    }
    this.classMetadata = Collections.unmodifiableMap(classMeta);

    Map<String,Set<String>> tmpEntityToCollectionRoleMap = new HashMap<String,Set<String>>();
    collectionPersisters = new HashMap<String,CollectionPersister>();
    Map<String,CollectionMetadata> tmpCollectionMetadata = new HashMap<String,CollectionMetadata>();
    Iterator collections = cfg.getCollectionMappings();
    while ( collections.hasNext() ) {
      Collection model = (Collection) collections.next();
      final String cacheRegionName = cacheRegionPrefix + model.getCacheRegionName();
      final AccessType accessType = AccessType.fromExternalName( model.getCacheConcurrencyStrategy() );
      CollectionRegionAccessStrategy accessStrategy = null;
      if ( accessType != null && settings.isSecondLevelCacheEnabled() ) {
        LOG.tracev( "Building shared cache region for collection data [{0}]", model.getRole() );
        CollectionRegion collectionRegion = regionFactory.buildCollectionRegion( cacheRegionName, properties, CacheDataDescriptionImpl
            .decode( model ) );
View Full Code Here

Examples of org.hibernate.cache.spi.access.AccessType

          model.getHierarchyDetails().getCaching() != null &&
          model.getHierarchyDetails().getCaching().getAccessType() != null ) {
        final String cacheRegionName = cacheRegionPrefix + rootEntityBinding.getHierarchyDetails().getCaching().getRegion();
        accessStrategy = EntityRegionAccessStrategy.class.cast( entityAccessStrategies.get( cacheRegionName ) );
        if ( accessStrategy == null ) {
          final AccessType accessType = model.getHierarchyDetails().getCaching().getAccessType();
          if ( traceEnabled ) {
            LOG.tracev( "Building cache for entity data [{0}]", model.getEntity().getName() );
          }
          EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion(
              cacheRegionName, properties, CacheDataDescriptionImpl.decode( model )
          );
          accessStrategy = entityRegion.buildAccessStrategy( accessType );
          entityAccessStrategies.put( cacheRegionName, accessStrategy );
          cacheAccess.addCacheRegion( cacheRegionName, entityRegion );
        }
      }
      EntityPersister cp = serviceRegistry.getService( PersisterFactory.class ).createEntityPersister(
          model, accessStrategy, this, metadata
      );
      entityPersisters.put( model.getEntity().getName(), cp );
      classMeta.put( model.getEntity().getName(), cp.getClassMetadata() );
    }
    this.classMetadata = Collections.unmodifiableMap(classMeta);

    Map<String,Set<String>> tmpEntityToCollectionRoleMap = new HashMap<String,Set<String>>();
    collectionPersisters = new HashMap<String,CollectionPersister>();
    Map<String, CollectionMetadata> tmpCollectionMetadata = new HashMap<String, CollectionMetadata>();
    for ( PluralAttributeBinding model : metadata.getCollectionBindings() ) {
      if ( model.getAttribute() == null ) {
        throw new IllegalStateException( "No attribute defined for a AbstractPluralAttributeBinding: " +  model );
      }
      if ( model.getAttribute().isSingular() ) {
        throw new IllegalStateException(
            "AbstractPluralAttributeBinding has a Singular attribute defined: " + model.getAttribute().getName()
        );
      }
      final String cacheRegionName = cacheRegionPrefix + model.getCaching().getRegion();
      final AccessType accessType = model.getCaching().getAccessType();
      CollectionRegionAccessStrategy accessStrategy = null;
      if ( accessType != null && settings.isSecondLevelCacheEnabled() ) {
        if ( traceEnabled ) {
          LOG.tracev( "Building cache for collection data [{0}]", model.getAttribute().getRole() );
        }
View Full Code Here

Examples of org.hibernate.cache.spi.access.AccessType

      model.prepareTemporaryTables( mapping, getDialect() );
      final String cacheRegionName = cacheRegionPrefix + model.getRootClass().getCacheRegionName();
      // cache region is defined by the root-class in the hierarchy...
      EntityRegionAccessStrategy accessStrategy = ( EntityRegionAccessStrategy ) entityAccessStrategies.get( cacheRegionName );
      if ( accessStrategy == null && settings.isSecondLevelCacheEnabled() ) {
        final AccessType accessType = AccessType.fromExternalName( model.getCacheConcurrencyStrategy() );
        if ( accessType != null ) {
          if ( LOG.isTraceEnabled() ) {
            LOG.tracev( "Building cache for entity data [{0}]", model.getEntityName() );
          }
          EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) );
          accessStrategy = entityRegion.buildAccessStrategy( accessType );
          entityAccessStrategies.put( cacheRegionName, accessStrategy );
          allCacheRegions.put( cacheRegionName, entityRegion );
        }
      }
      EntityPersister cp = serviceRegistry.getService( PersisterFactory.class ).createEntityPersister(
          model,
          accessStrategy,
          this,
          mapping
      );
      entityPersisters.put( model.getEntityName(), cp );
      classMeta.put( model.getEntityName(), cp.getClassMetadata() );
    }
    this.classMetadata = Collections.unmodifiableMap(classMeta);

    Map<String,Set<String>> tmpEntityToCollectionRoleMap = new HashMap<String,Set<String>>();
    collectionPersisters = new HashMap();
    Iterator collections = cfg.getCollectionMappings();
    while ( collections.hasNext() ) {
      Collection model = (Collection) collections.next();
      final String cacheRegionName = cacheRegionPrefix + model.getCacheRegionName();
      final AccessType accessType = AccessType.fromExternalName( model.getCacheConcurrencyStrategy() );
      CollectionRegionAccessStrategy accessStrategy = null;
      if ( accessType != null && settings.isSecondLevelCacheEnabled() ) {
        if ( LOG.isTraceEnabled() ) {
          LOG.tracev("Building cache for collection data [{0}]", model.getRole() );
        }
View Full Code Here

Examples of org.hibernate.cache.spi.access.AccessType

          model.getHierarchyDetails().getCaching() != null &&
          model.getHierarchyDetails().getCaching().getAccessType() != null ) {
        final String cacheRegionName = cacheRegionPrefix + rootEntityBinding.getHierarchyDetails().getCaching().getRegion();
        accessStrategy = EntityRegionAccessStrategy.class.cast( entityAccessStrategies.get( cacheRegionName ) );
        if ( accessStrategy == null ) {
          final AccessType accessType = model.getHierarchyDetails().getCaching().getAccessType();
          if ( LOG.isTraceEnabled() ) {
            LOG.tracev( "Building cache for entity data [{0}]", model.getEntity().getName() );
          }
          EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion(
              cacheRegionName, properties, CacheDataDescriptionImpl.decode( model )
          );
          accessStrategy = entityRegion.buildAccessStrategy( accessType );
          entityAccessStrategies.put( cacheRegionName, accessStrategy );
          allCacheRegions.put( cacheRegionName, entityRegion );
        }
      }
      EntityPersister cp = serviceRegistry.getService( PersisterFactory.class ).createEntityPersister(
          model, accessStrategy, this, metadata
      );
      entityPersisters.put( model.getEntity().getName(), cp );
      classMeta.put( model.getEntity().getName(), cp.getClassMetadata() );
    }
    this.classMetadata = Collections.unmodifiableMap(classMeta);

    Map<String,Set<String>> tmpEntityToCollectionRoleMap = new HashMap<String,Set<String>>();
    collectionPersisters = new HashMap();
    for ( PluralAttributeBinding model : metadata.getCollectionBindings() ) {
      if ( model.getAttribute() == null ) {
        throw new IllegalStateException( "No attribute defined for a AbstractPluralAttributeBinding: " +  model );
      }
      if ( model.getAttribute().isSingular() ) {
        throw new IllegalStateException(
            "AbstractPluralAttributeBinding has a Singular attribute defined: " + model.getAttribute().getName()
        );
      }
      final String cacheRegionName = cacheRegionPrefix + model.getCaching().getRegion();
      final AccessType accessType = model.getCaching().getAccessType();
      CollectionRegionAccessStrategy accessStrategy = null;
      if ( accessType != null && settings.isSecondLevelCacheEnabled() ) {
        if ( LOG.isTraceEnabled() ) {
          LOG.tracev( "Building cache for collection data [{0}]", model.getAttribute().getRole() );
        }
View Full Code Here

Examples of org.hibernate.cfg.AccessType

      this.propertyAccessType = propertyAccessor;
    }
  }

  public AccessType getPropertyAccessor(XAnnotatedElement element) {
    AccessType accessType = getExplicitAccessType( element );
    if ( accessType == null ) {
       accessType = propertyAccessType;
    }
    return accessType;
  }
View Full Code Here

Examples of org.hibernate.cfg.AccessType

    }
    return accessType;
  }

  public AccessType getExplicitAccessType(XAnnotatedElement element) {
    AccessType accessType = null;

    AccessType hibernateAccessType = null;
    AccessType jpaAccessType = null;

    org.hibernate.annotations.AccessType accessTypeAnnotation = element.getAnnotation( org.hibernate.annotations.AccessType.class );
    if ( accessTypeAnnotation != null ) {
      hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() );
    }
View Full Code Here

Examples of org.hibernate.cfg.AccessType

        // 'property' is the collection XProperty
        propertyHolder.startingProperty( property );
        holder.prepare( property );

        PersistentClass owner = mapValue.getOwner();
        AccessType accessType;
        // FIXME support @Access for collection of elements
        // String accessType = access != null ? access.value() : null;
        if ( owner.getIdentifierProperty() != null ) {
          accessType = owner.getIdentifierProperty().getPropertyAccessorName().equals( "property" )
              ? AccessType.PROPERTY
View Full Code Here

Examples of org.hibernate.cfg.AccessType

      this.propertyAccessType = propertyAccessor;
    }
  }

  public AccessType getPropertyAccessor(XAnnotatedElement element) {
    AccessType accessType = getExplicitAccessType( element );
    if ( accessType == null ) {
       accessType = propertyAccessType;
    }
    return accessType;
  }
View Full Code Here

Examples of org.hibernate.cfg.AccessType

    }
    return accessType;
  }

  public AccessType getExplicitAccessType(XAnnotatedElement element) {
    AccessType accessType = null;

    AccessType hibernateAccessType = null;
    AccessType jpaAccessType = null;

    org.hibernate.annotations.AccessType accessTypeAnnotation = element.getAnnotation( org.hibernate.annotations.AccessType.class );
    if ( accessTypeAnnotation != null ) {
      hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() );
    }
View Full Code Here

Examples of org.hibernate.cfg.AccessType

      this.propertyAccessType = propertyAccessor;
    }
  }

  public AccessType getPropertyAccessor(XAnnotatedElement element) {
    AccessType accessType = getExplicitAccessType( element );
    if ( accessType == null ) {
       accessType = propertyAccessType;
    }
    return accessType;
  }
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.