Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-2839

HHH-4451 StatefulPersistenceContext.deserialize must re-inject field interceptors after reading the entities from the input stream

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 4.2.0.GA_CP08, 4.3.0.GA_CP07, 4.3.0.GA_CP07_FP01
    • Fix Version/s: TBD EAP 4
    • Component/s: Hibernate
    • Labels:
      None
    • Affects:
      Release Notes
    • Release Notes Text:
      Failing to re-inject the interceptors for instrumented entities causes <exceptionname>NullPointerException</exceptionname>s when entities are retrieved from a deserialized <literal>PersistenceContext</literal>.
    • Release Notes Docs Status:
      Not Required

      Description

      http://opensource.atlassian.com/projects/hibernate/browse/HHH-4451

      Not re-injecting the interceptors for instrumented entities will cause NullPointerExceptions when entities get retrieved from a deserialized PersistenceContext. This manifests itself for example in the unit test EntityManagerSerializationTest in the entity manager module (when run instrumented of course).

      Currently the problem occurs in line 1406 of StatefulPersistenceContext: rtn.entitiesByKey.put( EntityKey.deserialize( ois, session ), ois.readObject() )

      I think FieldInterceptionHelper.injectFieldInterceptor should be called here. Something along these lines:

      Object key = EntityKey.deserialize( ois, session );
      Object value = ois.readObject();
      FieldInterceptionHelper.injectFieldInterceptor( value, value.getClass().getName(), null, session );

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  stliu Strong Liu
                  Reporter:
                  stliu Strong Liu
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: