Java Code Examples for org.hibernate.engine.spi.SessionImplementor.internalLoad()

The following are Jave code examples for showing how to use internalLoad() of the org.hibernate.engine.spi.SessionImplementor class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: lams   File: EntityType.java   View Source Code Vote up 6 votes
/**
 * Resolve an identifier via a load.
 *
 * @param id The entity id to resolve
 * @param session The orginating session.
 * @return The resolved identifier (i.e., loaded entity).
 * @throws org.hibernate.HibernateException Indicates problems performing the load.
 */
protected final Object resolveIdentifier(Serializable id, SessionImplementor session) throws HibernateException {
	boolean isProxyUnwrapEnabled = unwrapProxy &&
			getAssociatedEntityPersister( session.getFactory() )
					.isInstrumented();

	Object proxyOrEntity = session.internalLoad(
			getAssociatedEntityName(),
			id,
			eager,
			isNullable() && !isProxyUnwrapEnabled
	);

	if ( proxyOrEntity instanceof HibernateProxy ) {
		( ( HibernateProxy ) proxyOrEntity ).getHibernateLazyInitializer()
				.setUnwrap( isProxyUnwrapEnabled );
	}

	return proxyOrEntity;
}
 
Example 2
Project: lams   File: AnyType.java   View Source Code Vote up 5 votes
@Override
public Object replace(Object original, Object target, SessionImplementor session, Object owner, Map copyCache)
		throws HibernateException {
	if ( original == null ) {
		return null;
	}
	else {
		final String entityName = session.bestGuessEntityName( original );
		final Serializable id = ForeignKeys.getEntityIdentifierIfNotUnsaved( entityName, original, session );
		return session.internalLoad( entityName, id, false, false );
	}
}
 
Example 3
Project: lams   File: AnyType.java   View Source Code Vote up 4 votes
private Object resolveAny(String entityName, Serializable id, SessionImplementor session)
		throws HibernateException {
	return entityName==null || id==null
			? null
			: session.internalLoad( entityName, id, false, false );
}
 
Example 4
Project: lams   File: AnyType.java   View Source Code Vote up 4 votes
@Override
public Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException {
	final ObjectTypeCacheEntry e = (ObjectTypeCacheEntry) cached;
	return e == null ? null : session.internalLoad( e.entityName, e.id, false, false );
}