public Object instantiate(Object parent, SharedSessionContractImplementor session) throws HibernateException { Object result = instantiate( entityMode ); if ( componentTuplizer.hasParentProperty() && parent != null ) { componentTuplizer.setParent( result, session.getPersistenceContext().proxyFor( parent ), session.getFactory() ); } return result; }
@Override public Object read(ResultSet resultSet, ResultSetProcessingContext context) throws SQLException { final EntityReferenceProcessingState processingState = getIdentifierResolutionContext( context ); final EntityKey entityKey = processingState.getEntityKey(); final Object entityInstance = context.getProcessingState( entityReturn ).getEntityInstance(); if ( context.shouldReturnProxies() ) { final Object proxy = context.getSession().getPersistenceContext().proxyFor( entityReturn.getEntityPersister(), entityKey, entityInstance ); if ( proxy != entityInstance ) { ( (HibernateProxy) proxy ).getHibernateLazyInitializer().setImplementation( proxy ); return proxy; } } return entityInstance; } }
@Override public void setReadOnly(Object object, boolean readOnly) { if ( object == null ) { throw new AssertionFailure( "object must be non-null." ); } if ( isReadOnly( object ) == readOnly ) { return; } if ( object instanceof HibernateProxy ) { final HibernateProxy proxy = (HibernateProxy) object; setProxyReadOnly( proxy, readOnly ); if ( Hibernate.isInitialized( proxy ) ) { setEntityReadOnly( proxy.getHibernateLazyInitializer().getImplementation(), readOnly ); } } else { setEntityReadOnly( object, readOnly ); // PersistenceContext.proxyFor( entity ) returns entity if there is no proxy for that entity // so need to check the return value to be sure it is really a proxy final Object maybeProxy = getSession().getPersistenceContext().proxyFor( object ); if ( maybeProxy instanceof HibernateProxy ) { setProxyReadOnly( (HibernateProxy) maybeProxy, readOnly ); } } }
return result == null ? null : persistenceContext.proxyFor( result );
return event.getSession().getPersistenceContext().proxyFor( persister, keyToLoad, entity );
Object proxy = session.getPersistenceContext().proxyFor( persisters[i], keys[i], entity ); if ( entity != proxy ) {
public Object instantiate(Object parent, SessionImplementor session) throws HibernateException { Object result = instantiate( entityMode ); if ( componentTuplizer.hasParentProperty() && parent != null ) { componentTuplizer.setParent( result, session.getPersistenceContext().proxyFor( parent ), session.getFactory() ); } return result; }
public Object instantiate(Object parent, SessionImplementor session) throws HibernateException { Object result = instantiate( entityMode ); if ( componentTuplizer.hasParentProperty() && parent != null ) { componentTuplizer.setParent( result, session.getPersistenceContext().proxyFor( parent ), session.getFactory() ); } return result; }
result = persister.loadByUniqueKey( uniqueKeyPropertyName, key, session ); return result == null ? null : persistenceContext.proxyFor( result );
result = persister.loadByUniqueKey( uniqueKeyPropertyName, key, session ); return result == null ? null : persistenceContext.proxyFor( result );
@Override public void setReadOnly(Object object, boolean readOnly) { if ( object == null ) { throw new AssertionFailure( "object must be non-null." ); } if ( isReadOnly( object ) == readOnly ) { return; } if ( object instanceof HibernateProxy ) { HibernateProxy proxy = ( HibernateProxy ) object; setProxyReadOnly( proxy, readOnly ); if ( Hibernate.isInitialized( proxy ) ) { setEntityReadOnly( proxy.getHibernateLazyInitializer().getImplementation(), readOnly ); } } else { setEntityReadOnly( object, readOnly ); // PersistenceContext.proxyFor( entity ) returns entity if there is no proxy for that entity // so need to check the return value to be sure it is really a proxy Object maybeProxy = getSession().getPersistenceContext().proxyFor( object ); if ( maybeProxy instanceof HibernateProxy ) { setProxyReadOnly( ( HibernateProxy ) maybeProxy, readOnly ); } } }
@Override public void setReadOnly(Object object, boolean readOnly) { if ( object == null ) { throw new AssertionFailure( "object must be non-null." ); } if ( isReadOnly( object ) == readOnly ) { return; } if ( object instanceof HibernateProxy ) { final HibernateProxy proxy = (HibernateProxy) object; setProxyReadOnly( proxy, readOnly ); if ( Hibernate.isInitialized( proxy ) ) { setEntityReadOnly( proxy.getHibernateLazyInitializer().getImplementation(), readOnly ); } } else { setEntityReadOnly( object, readOnly ); // PersistenceContext.proxyFor( entity ) returns entity if there is no proxy for that entity // so need to check the return value to be sure it is really a proxy final Object maybeProxy = getSession().getPersistenceContext().proxyFor( object ); if ( maybeProxy instanceof HibernateProxy ) { setProxyReadOnly( (HibernateProxy) maybeProxy, readOnly ); } } }
@Override public void setReadOnly(Object object, boolean readOnly) { if ( object == null ) { throw new AssertionFailure( "object must be non-null." ); } if ( isReadOnly( object ) == readOnly ) { return; } if ( object instanceof HibernateProxy ) { HibernateProxy proxy = ( HibernateProxy ) object; setProxyReadOnly( proxy, readOnly ); if ( Hibernate.isInitialized( proxy ) ) { setEntityReadOnly( proxy.getHibernateLazyInitializer().getImplementation(), readOnly ); } } else { setEntityReadOnly( object, readOnly ); // PersistenceContext.proxyFor( entity ) returns entity if there is no proxy for that entity // so need to check the return value to be sure it is really a proxy Object maybeProxy = getSession().getPersistenceContext().proxyFor( object ); if ( maybeProxy instanceof HibernateProxy ) { setProxyReadOnly( ( HibernateProxy ) maybeProxy, readOnly ); } } }
return event.getSession().getPersistenceContext().proxyFor( persister, keyToLoad, entity );
return event.getSession().getPersistenceContext().proxyFor( persister, keyToLoad, entity );
Object proxy = session.getPersistenceContext().proxyFor( persisters[i], keys[i], entity ); if ( entity != proxy ) {
return event.getSession().getPersistenceContext().proxyFor( entityDescriptor, keyToLoad, entity );
Object proxy = session.getPersistenceContext().proxyFor( persisters[i], keys[i], entity ); if ( entity != proxy ) {
Object proxy = session.getPersistenceContext().proxyFor( persisters[i], keys[i], entity ); if ( entity != proxy ) {