HHH-8822 ValueHolder fields need to be transient if owned by a

Serializable class
This commit is contained in:
Brett Meyer 2014-01-30 11:14:36 -05:00
parent 4c6764d1cf
commit 535659d61f
4 changed files with 6 additions and 2 deletions

View File

@ -47,6 +47,7 @@ public class NaturalIdCacheKey implements Serializable {
private final String entityName;
private final String tenantId;
private final int hashCode;
// "transient" is important here -- NaturalIdCacheKey needs to be Serializable
private transient ValueHolder<String> toString;
/**

View File

@ -38,7 +38,8 @@ import org.hibernate.type.Type;
public final class TypedValue implements Serializable {
private final Type type;
private final Object value;
private final ValueHolder<Integer> hashcode;
// "transient" is important here -- NaturalIdCacheKey needs to be Serializable
private final transient ValueHolder<Integer> hashcode;
public TypedValue(final Type type, final Object value) {
this.type = type;

View File

@ -26,6 +26,8 @@ package org.hibernate.internal.util;
/**
* Represents a "final" value that is initialized either {@link #ValueHolder(Object) up front} or once at some point
* {@link #ValueHolder(ValueHolder.DeferredInitializer) after} declaration.
*
* Note: If a Serializable class has a {@link ValueHolder} property, that property should be declared transient!
*
* @author Steve Ebersole
*/

View File

@ -129,7 +129,7 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
private final Options options;
private final ClassLoaderService classLoaderService;
// private final ValueHolder<PersisterClassResolver> persisterClassResolverService;
// private final transient ValueHolder<PersisterClassResolver> persisterClassResolverService;
private final TypeResolver typeResolver;