Examples of HibernateProxy


Examples of org.hibernate.proxy.HibernateProxy

   * @param entityMode The entity mode
   * @return The extracted identifier.
   */
  private static Serializable getIdentifier(Object object, EntityPersister persister, EntityMode entityMode) {
    if (object instanceof HibernateProxy) {
      HibernateProxy proxy = (HibernateProxy) object;
      LazyInitializer li = proxy.getHibernateLazyInitializer();
      return li.getIdentifier();
    }
    else {
      return persister.getIdentifier( object, entityMode );
    }
View Full Code Here

Examples of org.hibernate.proxy.HibernateProxy

      ProxyFactory factory = new ProxyFactory();
      factory.setSuperclass( interfaces.length == 1 ? persistentClass : null );
      factory.setInterfaces( interfaces );
      factory.setFilter( FINALIZE_FILTER );
      Class cl = factory.createClass();
      final HibernateProxy proxy = ( HibernateProxy ) cl.newInstance();
      ( ( ProxyObject ) proxy ).setHandler( instance );
      instance.constructed = true;
      return proxy;
    }
    catch ( Throwable t ) {
View Full Code Here

Examples of org.hibernate.proxy.HibernateProxy

            setIdentifierMethod,
            componentIdType,
            session
    );

    final HibernateProxy proxy;
    try {
      proxy = ( HibernateProxy ) factory.newInstance();
    }
    catch ( Exception e ) {
      throw new HibernateException(
View Full Code Here

Examples of org.hibernate.proxy.HibernateProxy

    if ( value instanceof ElementWrapper ) {
      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.HibernateProxy

      value = ( (ElementWrapper) value ).getElement();
    }
   
    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.HibernateProxy

    if ( maybeProxy instanceof ElementWrapper ) {
      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()
        );
View Full Code Here

Examples of org.hibernate.proxy.HibernateProxy

    if ( maybeProxy instanceof ElementWrapper ) {
      maybeProxy = ( (ElementWrapper) maybeProxy ).getElement();
    }
   
    if ( maybeProxy instanceof HibernateProxy ) {
      HibernateProxy proxy = (HibernateProxy) maybeProxy;
      LazyInitializer li = proxy.getHibernateLazyInitializer();
      reassociateProxy(li, proxy);
      return li.getImplementation(); //initialize + unwrap the object
    }
    else {
      return maybeProxy;
View Full Code Here

Examples of org.hibernate.proxy.HibernateProxy

    if ( mergeMap != null ) {
      Iterator mergeMapItr = mergeMap.entrySet().iterator();
      while ( mergeMapItr.hasNext() ) {
        final Map.Entry mergeMapEntry = ( Map.Entry ) mergeMapItr.next();
        if ( mergeMapEntry.getKey() instanceof HibernateProxy ) {
          final HibernateProxy proxy = ( HibernateProxy ) mergeMapEntry.getKey();
          if ( persister.isSubclassEntityName( proxy.getHibernateLazyInitializer().getEntityName() ) ) {
            boolean found = isFoundInParent(
                propertyName,
                childEntity,
                persister,
                collectionPersister,
                mergeMap.get( proxy )
            );
            if ( !found ) {
              found = isFoundInParent(
                  propertyName,
                  mergeMap.get( childEntity ),
                  persister,
                  collectionPersister,
                  mergeMap.get( proxy )
              );
            }
            if ( found ) {
              return proxy.getHibernateLazyInitializer().getIdentifier();
            }
          }
        }
      }
    }
View Full Code Here

Examples of org.hibernate.proxy.HibernateProxy

   * @param entityMode The entity mode
   * @return The extracted identifier.
   */
  private static Serializable getIdentifier(Object object, EntityPersister persister, EntityMode entityMode) {
    if (object instanceof HibernateProxy) {
      HibernateProxy proxy = (HibernateProxy) object;
      LazyInitializer li = proxy.getHibernateLazyInitializer();
      return li.getIdentifier();
    }
    else {
      return persister.getIdentifier( object, entityMode );
    }
View Full Code Here

Examples of org.hibernate.proxy.HibernateProxy

    if (obj == null) {
      return null;
    }

    if (obj instanceof HibernateProxy) {
      HibernateProxy hibernateProxy = (HibernateProxy) obj;
      return hibernateProxy.getHibernateLazyInitializer().getIdentifier();
    }


    return session.getEntityPersister( null, obj ).getIdentifier( obj, session );
  }
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.