Package org.hibernate.bytecode.instrumentation.spi

Examples of org.hibernate.bytecode.instrumentation.spi.FieldInterceptor


  }

  @Override
    public boolean hasUninitializedLazyProperties(Object entity) {
    if ( getEntityMetamodel().hasLazyProperties() ) {
      FieldInterceptor callback = FieldInterceptionHelper.extractFieldInterceptor( entity );
      return callback != null && !callback.isInitialized();
    }
    else {
      return false;
    }
  }
View Full Code Here


      this.version = nextVersion;
      getPersister().setPropertyValue( entity, getPersister().getVersionProperty(), nextVersion );
    }

    if ( getPersister().getInstrumentationMetadata().isInstrumented() ) {
      final FieldInterceptor interceptor = getPersister().getInstrumentationMetadata().extractInterceptor( entity );
      if ( interceptor != null ) {
        interceptor.clearDirty();
      }
    }

    if( entity instanceof SelfDirtinessTracker) {
      ((SelfDirtinessTracker) entity).$$_hibernate_clearDirtyAttributes();
View Full Code Here

      entity = proxy;
    }

    //we are instrumenting but we can't assume we are the only ones
    if ( FieldInterceptionHelper.isInstrumented( entity ) ) {
      FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );
      final boolean isInitialized = interceptor == null || interceptor.isInitialized( property );
      LoadState state;
      if (isInitialized && interceptor != null) {
        //property is loaded according to bytecode enhancement, but is it loaded as far as association?
        //it's ours, we can read
        state = isLoaded( get( entity, property, cache ) );
View Full Code Here

      entity = proxy;
    }

    //we are instrumenting but we can't assume we are the only ones
    if ( FieldInterceptionHelper.isInstrumented( entity ) ) {
      FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );
      final boolean isInitialized = interceptor == null || interceptor.isInitialized( property );
      LoadState state;
      if (isInitialized && interceptor != null) {
        //property is loaded according to bytecode enhancement, but is it loaded as far as association?
        //it's ours, we can read
        state = isLoaded( get( entity, property, cache ) );
View Full Code Here

      entity = proxy;
    }

    //we are instrumenting but we can't assume we are the only ones
    if ( FieldInterceptionHelper.isInstrumented( entity ) ) {
      FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );
      final boolean isInitialized = interceptor == null || interceptor.isInitialized( property );
      LoadState state;
      if (isInitialized && interceptor != null) {
        //property is loaded according to bytecode enhancement, but is it loaded as far as association?
        //it's ours, we can read
        state = isLoaded( get( entity, property, cache ) );
View Full Code Here

    if ( reference instanceof HibernateProxy ) {
      final boolean isInitialized = !( (HibernateProxy) reference ).getHibernateLazyInitializer().isUninitialized();
      return isInitialized ? LoadState.LOADED : LoadState.NOT_LOADED;
    }
    else if ( FieldInterceptionHelper.isInstrumented( reference ) ) {
      FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( reference );
      final boolean isInitialized = interceptor == null || interceptor.isInitialized();
      return isInitialized ? LoadState.LOADED : LoadState.NOT_LOADED;
    }
    else if ( reference instanceof PersistentCollection ) {
      final boolean isInitialized = ( (PersistentCollection) reference ).wasInitialized();
      return isInitialized ? LoadState.LOADED : LoadState.NOT_LOADED;
View Full Code Here

      sureFromUs = true;
    }

    // we are instrumenting but we can't assume we are the only ones
    if ( FieldInterceptionHelper.isInstrumented( entity ) ) {
      FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );
      final boolean isInitialized = interceptor == null || interceptor.isInitialized( attributeName );
      LoadState state;
      if (isInitialized && interceptor != null) {
        // attributeName is loaded according to bytecode enhancement, but is it loaded as far as association?
        // it's ours, we can read
        try {
View Full Code Here

    //if ( hasLazyProperties() ) {
    InstrumentationService instrumentationService = session.getFactory()
        .getServiceRegistry()
        .getService( InstrumentationService.class );
    if ( instrumentationService.isInstrumented( entity ) ) {
      FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );
      if ( interceptor != null ) {
        interceptor.setSession( session );
      }
      else {
        FieldInterceptor fieldInterceptor = FieldInterceptionHelper.injectFieldInterceptor(
            entity,
            getEntityName(),
            null,
            session
        );
        fieldInterceptor.dirty();
      }
    }
  }
View Full Code Here

    else {
      entity = proxy;
    }

    if ( FieldInterceptionHelper.isInstrumented( entity ) ) {
      FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );
      return interceptor == null || interceptor.isInitialized( propertyName );
    }
    else {
      return true;
    }
   
View Full Code Here

  public static FieldInterceptor extractFieldInterceptor(Object entity) {
    if ( entity == null ) {
      return null;
    }
    FieldInterceptor interceptor = null;
    for ( Delegate delegate : INSTRUMENTATION_DELEGATES ) {
      interceptor = delegate.extractInterceptor( entity );
      if ( interceptor != null ) {
        break;
      }
View Full Code Here

TOP

Related Classes of org.hibernate.bytecode.instrumentation.spi.FieldInterceptor

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.