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

The following examples show how to use org.hibernate.engine.SessionImplementor#internalLoad() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnyType.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public Object replace(
		Object original, 
		Object target,
		SessionImplementor session, 
		Object owner, 
		Map copyCache)
throws HibernateException {
	if (original==null) {
		return null;
	}
	else {
		String entityName = session.bestGuessEntityName(original);
		Serializable id = ForeignKeys.getEntityIdentifierIfNotUnsaved( 
				entityName, 
				original, 
				session 
			);
		return session.internalLoad( 
				entityName, 
				id, 
				false, 
				false
			);
	}
}
 
Example 2
Source File: EntityType.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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 &&
			session.getFactory()
					.getEntityPersister( getAssociatedEntityName() )
					.isInstrumented( session.getEntityMode() );

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

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

	return proxyOrEntity;
}
 
Example 3
Source File: AnyType.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Object assemble(
	Serializable cached,
	SessionImplementor session,
	Object owner)
throws HibernateException {

	ObjectTypeCacheEntry e = (ObjectTypeCacheEntry) cached;
	return e==null ? null : session.internalLoad(e.entityName, e.id, false, false);
}
 
Example 4
Source File: MultiplicityType.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Object assemble(
	Serializable cached,
	SessionImplementor session,
	Object owner) throws HibernateException {
	if (cached==null) return null;
	Serializable[] o = (Serializable[]) cached;
	Multiplicity m = new Multiplicity();
	m.count = ( (Integer) o[0] ).intValue();
	m.glarch = o[1]==null ? 
		null : 
		(GlarchProxy) session.internalLoad( Glarch.class.getName(), o[1], false, false );
	return m;
}
 
Example 5
Source File: AnyType.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private Object resolveAny(String entityName, Serializable id, SessionImplementor session)
throws HibernateException {
	return entityName==null || id==null ?
			null : session.internalLoad( entityName, id, false, false );
}