-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Major
-
Resolution: Done
-
Affects Version/s: 4.2.0.GA_CP07, 4.3.0.GA_CP05, 4.3.0.GA_CP06, EAP 5.0.0
-
Fix Version/s: 4.2.0.GA_CP08, 4.3.0.GA_CP07, EAP 5.0.1.CR1
-
Component/s: Hibernate
-
Labels:None
-
Environment:
Entity manager v3_3_2_GA_CP / RemoveTest, hibernate.jdbc.batch_versioned_data = false
-
Affects:Release Notes
The test testUpdatedAndRemove on RemoveTest is failing due to a wrong exception being thrown when using hibernate.jdbc.batch_versioned_data as false (the default option).
When it is set as "false", the exception is processed on method AbstractEntityManagerImpl#wrapStaleStateException . On line 647 it tries to load the original entity, but it doesn't exists anymore, throwing a EntityNotFoundException.
The suggestion is to wrap line 647 in a try/catch, to catch EntityNotFoundException and rethrow the original exception as OptimisticLockException, as it is the only case I can think of that the identifier is present, it is in the context of a optimistic locking exception and the entity is not found in the database.