32
32
import org .hibernate .cfg .Configuration ;
33
33
import org .hibernate .cfg .Environment ;
34
34
import org .hibernate .testing .junit4 .BaseCoreFunctionalTestCase ;
35
+ import org .hibernate .testing .FailureExpected ;
35
36
import org .hibernate .testing .TestForIssue ;
36
37
37
38
import static org .junit .Assert .assertEquals ;
@@ -184,6 +185,7 @@ public void testNaturalIdChangeAfterResolveEntityFrom2LCache() {
184
185
}
185
186
186
187
@ Test
188
+ @ FailureExpected (jiraKey = "HHH-7513" )
187
189
public void testReattachementUnmodifiedInstance () {
188
190
Session session = openSession ();
189
191
session .beginTransaction ();
@@ -199,49 +201,7 @@ public void testReattachementUnmodifiedInstance() {
199
201
200
202
session = openSession ();
201
203
session .beginTransaction ();
202
- session .buildLockRequest (LockOptions .NONE ).lock (b );
203
- // org.hibernate.PropertyAccessException: could not get a field value by reflection getter of org.hibernate.test.naturalid.mutable.cached.A.oid
204
- // at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:62)
205
- // at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:341)
206
- // at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:4425)
207
- // at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:4147)
208
- // at org.hibernate.engine.internal.ForeignKeys.isTransient(ForeignKeys.java:209)
209
- // at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:248)
210
- // at org.hibernate.type.ManyToOneType.disassemble(ManyToOneType.java:214)
211
- // at org.hibernate.cache.spi.NaturalIdCacheKey.<init>(NaturalIdCacheKey.java:84)
212
- // at org.hibernate.engine.internal.StatefulPersistenceContext$1.removeSharedNaturalIdCrossReference(StatefulPersistenceContext.java:1991)
213
- // at org.hibernate.persister.entity.AbstractEntityPersister.handleNaturalIdReattachment(AbstractEntityPersister.java:4134)
214
- // at org.hibernate.persister.entity.AbstractEntityPersister.afterReassociate(AbstractEntityPersister.java:4106)
215
- // at org.hibernate.event.internal.AbstractReassociateEventListener.reassociate(AbstractReassociateEventListener.java:100)
216
- // at org.hibernate.event.internal.DefaultLockEventListener.onLock(DefaultLockEventListener.java:81)
217
- // at org.hibernate.internal.SessionImpl.fireLock(SessionImpl.java:811)
218
- // at org.hibernate.internal.SessionImpl.fireLock(SessionImpl.java:804)
219
- // at org.hibernate.internal.SessionImpl.access$11(SessionImpl.java:803)
220
- // at org.hibernate.internal.SessionImpl$LockRequestImpl.lock(SessionImpl.java:2365)
221
- // at org.hibernate.test.naturalid.mutable.cached.CachedMutableNaturalIdTest.testSimone(CachedMutableNaturalIdTest.java:308)
222
- // at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
223
- // at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
224
- // at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
225
- // at java.lang.reflect.Method.invoke(Unknown Source)
226
- // at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
227
- // at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
228
- // at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
229
- // at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:63)
230
- // at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
231
- // at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
232
- // at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
233
- // at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:62)
234
- // Caused by: java.lang.IllegalArgumentException: Can not set long field org.hibernate.test.naturalid.mutable.cached.A.oid to java.lang.Long
235
- // at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
236
- // at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
237
- // at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source)
238
- // at sun.reflect.UnsafeLongFieldAccessorImpl.getLong(Unknown Source)
239
- // at sun.reflect.UnsafeLongFieldAccessorImpl.get(Unknown Source)
240
- // at java.lang.reflect.Field.get(Unknown Source)
241
- // at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:59)
242
- // ... 29 more
243
-
244
-
204
+ session .buildLockRequest (LockOptions .NONE ).lock (b ); // HHH-7513 failure during reattachment
245
205
session .delete (b .assA );
246
206
session .delete (b );
247
207
0 commit comments