1 package org.hibernate.type; 3 4 import java.util.Map ; 5 6 import org.hibernate.EntityMode; 7 import org.hibernate.HibernateException; 8 import org.hibernate.engine.SessionFactoryImplementor; 9 import org.hibernate.engine.SessionImplementor; 10 11 15 public abstract class MutableType extends NullableType { 16 17 public final boolean isMutable() { 18 return true; 19 } 20 21 protected abstract Object deepCopyNotNull(Object value) throws HibernateException; 22 23 public final Object deepCopy(Object value, EntityMode entityMode, SessionFactoryImplementor factory) 24 throws HibernateException { 25 return (value==null) ? null : deepCopyNotNull(value); 26 } 27 28 public Object replace( 29 Object original, 30 Object target, 31 SessionImplementor session, 32 Object owner, 33 Map copyCache) 34 throws HibernateException { 35 if ( isEqual( original, target, session.getEntityMode() ) ) return original; 36 return deepCopy( original, session.getEntityMode(), session.getFactory() ); 37 } 38 39 } 40 | Popular Tags |