[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6897) serialization of the EntityManager should be possible

Emmanuel Bernard (JIRA) noreply at atlassian.com
Thu Dec 15 03:58:20 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44587#comment-44587 ] 

Emmanuel Bernard commented on HHH-6897:
---------------------------------------

I agree with Steve's assessment. An EntityManager should not trigger the serialization of SessionFactory. It can be due to the fact that it serializes EmtityManagerFactory which in turns serializes SessionFactory. I wonder if this code has changed. I thought I had resolved this problem but maybe I never did.

I see two solutions:

1. have some global naming / registry of EntityManagerFactory (like SessionFactory does) and only serializes the identifier. Since we have a persistence unit name that sounds like a nice idea. That will break the serialization link between the EM and the EMF
2. serializes EMF but have it point to the SessionFactory global identifier and reuse it to deserialize it.

I think option 1. is by far the best solution and we should go with it.

Scott, fancy taking the lead on this one?

Something that surprises me is that we do have a serialization test in the test suite and I wonder why it did not catch the problem. The test is EntityManagerSerializationTest.

> serialization of the EntityManager should be possible
> -----------------------------------------------------
>
>                 Key: HHH-6897
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6897
>             Project: Hibernate Core
>          Issue Type: Task
>    Affects Versions: 4.0.0.CR7
>            Reporter: Scott Marlow
>
> http://pastie.org/3018508 contains the NotSerializableException: org.hibernate.service.internal.StandardServiceRegistryImpl exception and http://pastie.org/3018879 describes some of contained values that don't appear to be serializable.
> I would like to see this fixed in either 4.0.0.Final or a 4.0.1.Final (if that could happen in time).  I'll have more information soon, regarding fix version.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list