From 268e778d5ce6be6f46b45e86926f4df967aeee04 Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Wed, 10 Mar 2010 09:59:43 +0000 Subject: [PATCH] HHH-4958 : Immutable entity snapshot is retained after insert git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18953 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- core/src/main/java/org/hibernate/engine/EntityEntry.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/hibernate/engine/EntityEntry.java b/core/src/main/java/org/hibernate/engine/EntityEntry.java index 7c69186c0a..7667ece2dd 100644 --- a/core/src/main/java/org/hibernate/engine/EntityEntry.java +++ b/core/src/main/java/org/hibernate/engine/EntityEntry.java @@ -74,7 +74,8 @@ public final class EntityEntry implements Serializable { final boolean lazyPropertiesAreUnfetched) { this.status=status; this.previousStatus = null; - this.loadedState=loadedState; + // only retain loaded state if the status is not Status.READ_ONLY + if ( status != Status.READ_ONLY ) { this.loadedState = loadedState; } this.id=id; this.rowId=rowId; this.existsInDatabase=existsInDatabase;