Uploaded image for project: 'Hibernate ORM'
  1. HHH-10900

ExceptionConverter throws an exception if the Proxy is no longer reachable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.0
    • Fix Version/s: 5.2.2
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      The ExceptionConverter tries to adapt the StaleStateException to an OptimisticLockException. Because the OptimisticLockException can also take an entity, we have the following logic:

      final Object entity = sharedSessionContract.load( sose.getEntityName(), identifier, false, true);
      
      if ( entity instanceof Serializable ) {
          //avoid some user errors regarding boundary crossing
          pe = new OptimisticLockException( e.getMessage(), e, entity );
      }
      else {
          pe = new OptimisticLockException( e.getMessage(), e );
      }
      

      The load method tries to load a Proxy, and if the Proxy is no longer reachable (maybe it was removed intentionally), then this method call throws an ObjectNotFoundException, therefore masking the OptimisticLockException.

        Attachments

          Activity

            People

            • Assignee:
              mih_vlad Vlad Mihalcea
              Reporter:
              mih_vlad Vlad Mihalcea
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: