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

Proxy narrowing loses the initialized state of the original proxy

    Details

    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      Hi,

      This is a followup of a Search bug: see https://hibernate.atlassian.net/browse/HSEARCH-1448?focusedCommentId=59117&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-59117 .

      It is related to StatefulPersistenceContext.narrowProxy ( https://github.com/hibernate/hibernate-orm/blob/4.3/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java#L638 )

      This issue leads to missing results in Search (which filters out uninitialized proxy) but IMHO it's also suboptimal for ORM as, after narrowing of a proxy, the new proxy has to be initialized again.

      AFAICS, we can initialize the new proxy with the entity of the original one.

      I have prepared a pull request with a test case and a fix along those lines.

      Would be nice to have some feedback about it and especially to be sure that it's safe.

      Thanks.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: