Examples of LazyInitializer


Examples of com.impetus.kundera.proxy.LazyInitializer

            return LoadState.NOT_LOADED;
        }

        if (proxy instanceof KunderaProxy)
        {
            LazyInitializer li = ((KunderaProxy) proxy).getKunderaLazyInitializer();
            if (li.isUninitialized())
            {
                return LoadState.NOT_LOADED;
            }
            return LoadState.LOADED;
        }
View Full Code Here

Examples of org.hibernate.proxy.LazyInitializer

  @Override
  public <T> T unenhanceObject(T object) {
    if (object instanceof HibernateProxy) {
      HibernateProxy hibernateProxy = (HibernateProxy) object;
      LazyInitializer lazyInitializer = hibernateProxy.getHibernateLazyInitializer();

      return (T) lazyInitializer.getImplementation();
    }
    return object;
  }
View Full Code Here

Examples of org.hibernate.proxy.LazyInitializer

  }

  @SuppressWarnings("unchecked")
  public <T> T initialize(T proxy) {
    if (proxy instanceof HibernateProxy) {
      LazyInitializer init = ((HibernateProxy) proxy).getHibernateLazyInitializer();
      if (null == init.getSession() || init.getSession().isClosed()) {
        proxy = (T) getHibernateTemplate().get(init.getEntityName(), init.getIdentifier());
      } else {
        getHibernateTemplate().initialize(proxy);
      }
    }
    return proxy;
View Full Code Here

Examples of org.hibernate.proxy.LazyInitializer

            if (Hibernate.isInitialized(instance)) {

                try {
                    HibernateProxy hp = (HibernateProxy) instance;
                    LazyInitializer li = hp.getHibernateLazyInitializer();
                    log.warn("On The Fly initialization: "
                            + li.getEntityName());
                    return li.getImplementation();

                } catch (ClassCastException c) {
                    log.error("error casting to HibernateProxy "
                            + instance);
                    return null;
View Full Code Here

Examples of org.hibernate.proxy.LazyInitializer

     
      if (object==LazyPropertyInitializer.UNFETCHED_PROPERTY) return false; //this is kinda the best we can do...
     
      if ( object instanceof HibernateProxy ) {
        // if its an uninitialized proxy it can't be transient
        LazyInitializer li = ( (HibernateProxy) object ).getHibernateLazyInitializer();
        if ( li.getImplementation(session) == null ) {
          return false;
          // ie. we never have to null out a reference to
          // an uninitialized proxy
        }
        else {
          //unwrap it
          object = li.getImplementation();
        }
      }
 
      // if it was a reference to self, don't need to nullify
      // unless we are using native id generation, in which
View Full Code Here

Examples of org.hibernate.proxy.LazyInitializer

    final SessionImplementor source = event.getSession();
    final Object object = event.getObject();
   
    final Object entity;
    if (object instanceof HibernateProxy) {
      LazyInitializer li = ( (HibernateProxy) object ).getHibernateLazyInitializer();
      if ( li.isUninitialized() ) {
        if ( li.getSession()==source ) {
          return; //NOTE EARLY EXIT!
        }
        else {
          throw new PersistentObjectException("uninitialized proxy passed to persist()");
        }
      }
      entity = li.getImplementation();
    }
    else {
      entity = object;
    }
   
View Full Code Here

Examples of org.hibernate.proxy.LazyInitializer

  }

  public void clear() {
    Iterator itr = proxiesByKey.values().iterator();
    while ( itr.hasNext() ) {
      final LazyInitializer li = ( ( HibernateProxy ) itr.next() ).getHibernateLazyInitializer();
      li.setSession( null );
    }
    Map.Entry[] collectionEntryArray = IdentityMap.concurrentEntries( collectionEntries );
    for ( int i = 0; i < collectionEntryArray.length; i++ ) {
      ( ( PersistentCollection ) collectionEntryArray[i].getKey() ).unsetSession( getSession() );
    }
View Full Code Here

Examples of org.hibernate.proxy.LazyInitializer

      value = ( (ElementWrapper) value ).getElement();
    }
   
    if ( !Hibernate.isInitialized(value) ) {
      HibernateProxy proxy = (HibernateProxy) value;
      LazyInitializer li = proxy.getHibernateLazyInitializer();
      reassociateProxy(li, proxy);
      return true;
    }
    else {
      return false;
View Full Code Here

Examples of org.hibernate.proxy.LazyInitializer

    }
   
    if ( value instanceof HibernateProxy ) {
      if ( log.isDebugEnabled() ) log.debug("setting proxy identifier: " + id);
      HibernateProxy proxy = (HibernateProxy) value;
      LazyInitializer li = proxy.getHibernateLazyInitializer();
      li.setIdentifier(id);
      reassociateProxy(li, proxy);
    }
  }
View Full Code Here

Examples of org.hibernate.proxy.LazyInitializer

      maybeProxy = ( (ElementWrapper) maybeProxy ).getElement();
    }
   
    if ( maybeProxy instanceof HibernateProxy ) {
      HibernateProxy proxy = (HibernateProxy) maybeProxy;
      LazyInitializer li = proxy.getHibernateLazyInitializer();
      if ( li.isUninitialized() ) {
        throw new PersistentObjectException(
            "object was an uninitialized proxy for " +
            li.getEntityName()
        );
      }
      return li.getImplementation(); //unwrap the object
    }
    else {
      return maybeProxy;
    }
  }
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.