Skip to content

Commit

Permalink
HHH-8822 ValueHolder fields need to be transient if owned by a
Browse files Browse the repository at this point in the history
Serializable class

Conflicts:
	hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataImpl.java

Conflicts:
	hibernate-core/src/main/java/org/hibernate/engine/spi/TypedValue.java
  • Loading branch information
brmeyer committed Jan 30, 2014
1 parent 8567215 commit 1dcdc44
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
/**
* 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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
private final ServiceRegistry serviceRegistry;
private final Options options;

private final ValueHolder<ClassLoaderService> classLoaderService;
private final ValueHolder<PersisterClassResolver> persisterClassResolverService;
private final transient ValueHolder<ClassLoaderService> classLoaderService;
private final transient ValueHolder<PersisterClassResolver> persisterClassResolverService;

private TypeResolver typeResolver = new TypeResolver();

Expand Down

0 comments on commit 1dcdc44

Please sign in to comment.