Hibernate ORM HibernateProxy - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM HibernateProxy class.

This code example shows how to use the following methods:getHibernateLazyInitializer
import com.google.gson.JsonSerializer;
 
public class HibernateProxySerializer implements JsonSerializer<HibernateProxy> {
 
	public JsonElement serialize(HibernateProxy proxyObj, Type type, JsonSerializationContext ctx) {
		Object deProxied = proxyObj.getHibernateLazyInitializer().getImplementation();
		return ctx.serialize(deProxied);
	} 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHibernateLazyInitializer
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHibernateLazyInitializer
    @Override 
    public void initialize(Object owner, String propertyName, Object propertyValue) {
        Hibernate.initialize(propertyValue);
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHibernateLazyInitializer
    @Override 
    public void initialize(Object owner, String propertyName, Object propertyValue) {
        Hibernate.initialize(propertyValue);
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHibernateLazyInitializer
        TargetNotAuditedEntity rev1 = getAuditReader().find(TargetNotAuditedEntity.class, tnae1.getId(), 1);
 
        assert rev1.getReference() instanceof HibernateProxy;
 
        HibernateProxy proxyCreateByEnvers = (HibernateProxy) rev1.getReference();
        LazyInitializer lazyInitializer = proxyCreateByEnvers.getHibernateLazyInitializer();
 
        assert lazyInitializer.isUninitialized();
        assert lazyInitializer.getIdentifier() != null;
        assert lazyInitializer.getIdentifier().equals(tnae1.getId());
        assert lazyInitializer.isUninitialized();
 
        assert rev1.getReference().getId().equals(uste1.getId());
        assert rev1.getReference().getStr().equals(uste1.getStr());
        assert !lazyInitializer.isUninitialized();
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHibernateLazyInitializer
				componentIdType, 
				getId(), 
				null 
			); 
			setReadOnlyBeforeAttachedToSession( ( JavassistLazyInitializer ) proxy.getHibernateLazyInitializer() ); 
			return proxy; 
		} 
		catch (NoSuchMethodException nsme) { 
			throw new HibernateException("could not create proxy for entity: " + getEntityName(), nsme); 
		} 
	} 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHibernateLazyInitializer
 
		if ( object instanceof HibernateProxy ) { 
			LazyInitializer li = ( (HibernateProxy) object ).getHibernateLazyInitializer(); 
			Serializable id = li.getIdentifier(); 
			EntityPersister persister = source.getFactory().getEntityPersister( li.getEntityName() ); 
			if ( id == null ) { 
				throw new IllegalArgumentException("null identifier"); 
			} 
 
			final EntityKey key = source.generateEntityKey( id, persister ); 
			persistenceContext.removeProxy( key ); 
 
			if ( !li.isUninitialized() ) { 
				final Object entity = persistenceContext.removeEntity( key ); 
				if ( entity != null ) { 
					EntityEntry e = event.getSession().getPersistenceContext().removeEntry( entity ); 
					doEvict( entity, key, e.getPersister(), event.getSession() ); 
				} 
			} 
			li.unsetSession(); 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHibernateLazyInitializer
 
    public Class getTargetClass(Object obj) {
        if (obj instanceof HibernateProxy) {
            return HibernateProxyHelper.getClassWithoutInitializingProxy(obj);
        } 
        return obj.getClass(); 
    } 
 
    public Object initalizeProxy(Object obj) { 
        if (initializePorxy) {
            Hibernate.initialize(obj);
            if (obj instanceof HibernateProxy) {
                // further initialize the object since initlaize does not init lazy fields 
                return ((HibernateProxy) obj).getHibernateLazyInitializer().getImplementation();
            } 
        } 
        return obj; 
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHibernateLazyInitializer
import java.util.List;
 
/** 
 * @author Tomasz Bech 
 */ 
public class RelationNotAuditedTarget extends AbstractEntityTest { 
	private Integer tnae1_id;
	private Integer tnae2_id;
 
	private Integer uste1_id;
	private Integer uste2_id;
 
	public void configure(Ejb3Configuration cfg) {
		cfg.addAnnotatedClass(TargetNotAuditedEntity.class);
		cfg.addAnnotatedClass(UnversionedStrTestEntity.class);
	} 
 
	@Test
    @Priority(10)
	public void initData() { 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHibernateLazyInitializer
	 
			// if it was a reference to self, don't need to nullify 
			// unless we are using native id generation, in which 
			// case we definitely need to nullify 
			if ( object == self ) { 
				return isEarlyInsert || (
					isDelete &&
					session.getFactory()
						.getDialect()
						.hasSelfReferentialForeignKeyBug()
				); 
			} 
	 
			// See if the entity is already bound to this session, if not look at the 
			// entity identifier and assume that the entity is persistent if the 
			// id is not "unsaved" (that is, we rely on foreign keys to keep 
			// database integrity) 
	 
			EntityEntry entityEntry = session.getPersistenceContext().getEntry(object);
			if ( entityEntry==null ) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Hibernate ORM HibernateProxy Methods: