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

The following examples show how to use org.hibernate.engine.SessionImplementor#bestGuessEntityName() . 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: AnyType.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void nullSafeSet(PreparedStatement st, Object value,	int index, boolean[] settable, SessionImplementor session)
throws HibernateException, SQLException {

	Serializable id;
	String entityName;
	if (value==null) {
		id=null;
		entityName=null;
	}
	else {
		entityName = session.bestGuessEntityName(value);
		id = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, value, session);
	}
	
	// metaType is assumed to be single-column type
	if ( settable==null || settable[0] ) {
		metaType.nullSafeSet(st, entityName, index, session);
	}
	if (settable==null) {
		identifierType.nullSafeSet(st, id, index+1, session);
	}
	else {
		boolean[] idsettable = new boolean[ settable.length-1 ];
		System.arraycopy(settable, 1, idsettable, 0, idsettable.length);
		identifierType.nullSafeSet(st, id, index+1, idsettable, session);
	}
}
 
Example 3
Source File: AnyType.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Serializable disassemble(Object value, SessionImplementor session, Object owner)
throws HibernateException {
	return value==null ?
		null :
		new ObjectTypeCacheEntry(
					session.bestGuessEntityName(value),
					ForeignKeys.getEntityIdentifierIfNotUnsaved( 
							session.bestGuessEntityName(value), value, session 
						)
				);
}
 
Example 4
Source File: AnyType.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Object getPropertyValue(Object component, int i, SessionImplementor session)
	throws HibernateException {

	return i==0 ?
			session.bestGuessEntityName(component) :
			getIdentifier(component, session);
}
 
Example 5
Source File: AnyType.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Object[] getPropertyValues(Object component, SessionImplementor session)
	throws HibernateException {

	return new Object[] { session.bestGuessEntityName(component), getIdentifier(component, session) };
}