/** * Get the AnyType with the specified parameters. * * @param metaType meta type * @param identifierType identifier type * @param lazy is teh underlying proeprty lazy * @return AnyType */ public Type any(Type metaType, Type identifierType, boolean lazy) { return new AnyType( typeScope, metaType, identifierType, lazy ); } }
@Override public Object getPropertyValue(Object component, int i, SharedSessionContractImplementor session) throws HibernateException { return i==0 ? session.bestGuessEntityName( component ) : getIdentifier( component, session ); }
@Override public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { nullSafeSet( st, value, index, null, session ); }
@Override public Object resolve(Object value, SharedSessionContractImplementor session, Object owner) throws HibernateException { final ObjectTypeCacheEntry holder = (ObjectTypeCacheEntry) value; return resolveAny( holder.entityName, holder.id, session ); }
@Override public boolean[] toColumnNullness(Object value, Mapping mapping) { final boolean[] result = new boolean[ getColumnSpan( mapping ) ]; if ( value != null ) { Arrays.fill( result, true ); } return result; }
@Override public boolean isDirty(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session) throws HibernateException { return isDirty( old, current, session ); }
@Override public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { return resolveAny( (String) discriminatorType.nullSafeGet( rs, names[0], session, owner ), (Serializable) identifierType.nullSafeGet( rs, names[1], session, owner ), session ); }
public boolean[] toColumnNullness(Object value, Mapping mapping) { boolean[] result = new boolean[ getColumnSpan(mapping) ]; if (value!=null) Arrays.fill(result, true); return result; }
public boolean isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session) throws HibernateException { //TODO!!! return isDirty(old, current, session); }
@Override public Object[] getPropertyValues(Object component, SharedSessionContractImplementor session) throws HibernateException { return new Object[] { session.bestGuessEntityName( component ), getIdentifier( component, session ) }; }
/** * A Hibernate <tt>any</tt> type. * * @param metaType a type mapping <tt>java.lang.Class</tt> to a single column * @param identifierType the entity identifier type * @return the Type */ public static Type any(Type metaType, Type identifierType) { return new AnyType( metaType, identifierType ); }
public Object resolve(Object value, SessionImplementor session, Object owner) throws HibernateException { ObjectTypeCacheEntry holder = (ObjectTypeCacheEntry) value; return resolveAny(holder.entityName, holder.id, session); }
public void nullSafeSet(PreparedStatement st, Object value, int index, 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.nullSafeSet(st, entityName, index, session); identifierType.nullSafeSet(st, id, index+1, session); // metaType must be single-column type }
public boolean[] toColumnNullness(Object value, Mapping mapping) { boolean[] result = new boolean[ getColumnSpan(mapping) ]; if (value!=null) Arrays.fill(result, true); return result; }
public boolean isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session) throws HibernateException { //TODO!!! return isDirty(old, current, session); }
@Override public boolean isModified(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session) throws HibernateException { if ( current == null ) { return old != null; } else if ( old == null ) { return true; } final ObjectTypeCacheEntry holder = (ObjectTypeCacheEntry) old; final boolean[] idCheckable = new boolean[checkable.length-1]; System.arraycopy( checkable, 1, idCheckable, 0, idCheckable.length ); return ( checkable[0] && !holder.entityName.equals( session.bestGuessEntityName( current ) ) ) || identifierType.isModified( holder.id, getIdentifier( current, session ), idCheckable, session ); }
public class X<T> { public static final T c = (T)new AnyType(); }
public Object resolve(Object value, SessionImplementor session, Object owner) throws HibernateException { ObjectTypeCacheEntry holder = (ObjectTypeCacheEntry) value; return resolveAny(holder.entityName, holder.id, session); }
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); } }
public boolean[] toColumnNullness(Object value, Mapping mapping) { boolean[] result = new boolean[ getColumnSpan(mapping) ]; if (value!=null) Arrays.fill(result, true); return result; }