[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4451) StatefulPersistenceContext.deserialize must re-inject field interceptors after reading the entities from the input stream
Steve Ebersole (JIRA)
noreply at atlassian.com
Mon Sep 21 14:35:50 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34000#action_34000 ]
Steve Ebersole commented on HHH-4451:
-------------------------------------
Actually the hook should more be part of building the EntityEntry and be along the lines of:
...
Object entity = ois.readObject();
EntityEntry entry = EntityEntry.deserialize( ois, session );
rtn.entityEntries.put( entity, entry );
// Here we use EntityEntry to assert whether the entity contains any uninitialized lazy properties. However,
// EntityEntry#isLoadedWithLazyPropertiesUnfetched only knows about *load time*. Only the
// field-interceptor (lost during serialization) knows whether those were initialized. Perhaps we should
// write that state to the stream as well?
entry.getPersister().afterInitialize( entity, entry.isLoadedWithLazyPropertiesUnfetched(), session );
> StatefulPersistenceContext.deserialize must re-inject field interceptors after reading the entities from the input stream
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-4451
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4451
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Reporter: Hardy Ferentschik
> Assignee: Steve Ebersole
>
> 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 );
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list