10
10
import java .io .ObjectInputStream ;
11
11
import java .io .Serializable ;
12
12
13
+ import org .hibernate .AssertionFailure ;
13
14
import org .hibernate .EntityMode ;
14
15
import org .hibernate .LockMode ;
15
16
import org .hibernate .UnsupportedLockAttemptException ;
@@ -51,8 +52,20 @@ public ImmutableEntityEntry(
51
52
final boolean disableVersionIncrement ,
52
53
final boolean lazyPropertiesAreUnfetched ,
53
54
final PersistenceContext persistenceContext ) {
54
- this ( status , loadedState , rowId , id , version , lockMode , existsInDatabase ,
55
- persister ,disableVersionIncrement , lazyPropertiesAreUnfetched , null );
55
+ this (
56
+ status ,
57
+ loadedState ,
58
+ rowId ,
59
+ id ,
60
+ version ,
61
+ lockMode ,
62
+ existsInDatabase ,
63
+ persister ,
64
+ disableVersionIncrement ,
65
+ lazyPropertiesAreUnfetched ,
66
+ // purposefully do not pass along the session/persistence-context : HHH-10251
67
+ null
68
+ );
56
69
}
57
70
58
71
public ImmutableEntityEntry (
@@ -68,8 +81,20 @@ public ImmutableEntityEntry(
68
81
final boolean lazyPropertiesAreUnfetched ,
69
82
final PersistenceContext persistenceContext ) {
70
83
71
- super ( status , loadedState , rowId , id , version , lockMode , existsInDatabase , persister ,
72
- disableVersionIncrement , lazyPropertiesAreUnfetched , null );
84
+ super (
85
+ status ,
86
+ loadedState ,
87
+ rowId ,
88
+ id ,
89
+ version ,
90
+ lockMode ,
91
+ existsInDatabase ,
92
+ persister ,
93
+ disableVersionIncrement ,
94
+ lazyPropertiesAreUnfetched ,
95
+ // purposefully do not pass along the session/persistence-context : HHH-10251
96
+ null
97
+ );
73
98
}
74
99
75
100
/**
@@ -98,13 +123,15 @@ private ImmutableEntityEntry(
98
123
99
124
@ Override
100
125
public void setLockMode (LockMode lockMode ) {
101
-
102
- switch ( lockMode ) {
103
- case NONE : case READ :
126
+ switch ( lockMode ) {
127
+ case NONE :
128
+ case READ : {
104
129
setCompressedValue ( EnumState .LOCK_MODE , lockMode );
105
130
break ;
106
- default :
107
- throw new UnsupportedLockAttemptException ("Lock mode not supported" );
131
+ }
132
+ default : {
133
+ throw new UnsupportedLockAttemptException ( "Lock mode not supported" );
134
+ }
108
135
}
109
136
}
110
137
@@ -140,12 +167,13 @@ public static EntityEntry deserialize(
140
167
ois .readBoolean (),
141
168
ois .readBoolean (),
142
169
ois .readBoolean (),
143
- persistenceContext
170
+ null
144
171
);
145
172
}
146
173
147
- public PersistenceContext getPersistenceContext (){
148
- return persistenceContext ;
174
+ @ Override
175
+ public PersistenceContext getPersistenceContext () {
176
+ throw new AssertionFailure ( "Session/PersistenceContext is not available from an ImmutableEntityEntry" );
149
177
}
150
178
151
179
}
0 commit comments