diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/spi/AbstractEntityManagerImpl.java b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/spi/AbstractEntityManagerImpl.java index 541771ab36..d50a12d93c 100755 --- a/hibernate-entitymanager/src/main/java/org/hibernate/jpa/spi/AbstractEntityManagerImpl.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/jpa/spi/AbstractEntityManagerImpl.java @@ -1780,22 +1780,22 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage Object entity = internalGetSession().load( sose.getEntityName(), identifier ); if ( entity instanceof Serializable ) { //avoid some user errors regarding boundary crossing - pe = new OptimisticLockException( null, e, entity ); + pe = new OptimisticLockException( e.getMessage(), e, entity ); } else { - pe = new OptimisticLockException( e ); + pe = new OptimisticLockException( e.getMessage(), e ); } } catch ( EntityNotFoundException enfe ) { - pe = new OptimisticLockException( e ); + pe = new OptimisticLockException( e.getMessage(), e ); } } else { - pe = new OptimisticLockException( e ); + pe = new OptimisticLockException( e.getMessage(), e ); } } else { - pe = new OptimisticLockException( e ); + pe = new OptimisticLockException( e.getMessage(), e ); } return pe; }