give UserType.replace() a sensible default impl that's essentially always correct
This commit is contained in:
parent
fe9f909dce
commit
5fb04fb6f6
|
@ -94,11 +94,5 @@ public class BitSetUserType implements UserType<BitSet> {
|
|||
public BitSet assemble(Serializable cached, Object owner) {
|
||||
return deepCopy((BitSet) cached);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BitSet replace(BitSet original, BitSet target, Object owner)
|
||||
throws HibernateException {
|
||||
return deepCopy(original);
|
||||
}
|
||||
}
|
||||
//end::basic-custom-type-BitSetUserType-example[]
|
||||
|
|
|
@ -112,9 +112,4 @@ public abstract class BaseUserTypeSupport<T> implements UserType<T> {
|
|||
public T assemble(Serializable cached, Object owner) throws HibernateException {
|
||||
return javaType().getMutabilityPlan().assemble( cached, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public T replace(T original, T target, Object owner) throws HibernateException {
|
||||
return deepCopy( original );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,10 +158,4 @@ public class StaticUserTypeSupport<T> implements UserType<T> {
|
|||
public T assemble(Serializable cached, Object owner) throws HibernateException {
|
||||
return javaType.getMutabilityPlan().assemble( cached, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public T replace(T original, T target, Object owner) throws HibernateException {
|
||||
return deepCopy( original );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -102,11 +102,6 @@ import org.hibernate.type.spi.TypeConfiguration;
|
|||
* public Period assemble(Serializable cached, Object owner) {
|
||||
* return (Period) cached; //Period is immutable
|
||||
* }
|
||||
*
|
||||
* @Override
|
||||
* public Period replace(Period detached, Period managed, Object owner) {
|
||||
* return detached;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
|
@ -395,7 +390,9 @@ public interface UserType<J> {
|
|||
*
|
||||
* @see org.hibernate.Session#merge(Object)
|
||||
*/
|
||||
J replace(J detached, J managed, Object owner);
|
||||
default J replace(J detached, J managed, Object owner) {
|
||||
return deepCopy( detached );
|
||||
}
|
||||
|
||||
/**
|
||||
* The default column length, for use in DDL generation.
|
||||
|
|
Loading…
Reference in New Issue