9 Replies Latest reply on Mar 22, 2007 6:35 PM by brian.stansberry

    Funky config needed for extended PersistenceContext replicat

    brian.stansberry

      AFAICT, to get replication of an SFSB with an extended PersistenceContext to work, your persistence.xml needs to declare the "hibernate.session_factory_name" property, e.g.:

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence>
       <persistence-unit name="tempdb">
       <jta-data-source>java:/DefaultDS</jta-data-source>
       <properties>
       <property name="hibernate.session_factory_name" value="tempdb"/>
       <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
       </properties>
       </persistence-unit>
      </persistence>
      


      Without this, when the EntityManager is deserialized on the remote node, you get this:

      Caused by: java.io.InvalidObjectException: could not resolve session factory during session deserialization [uuid=8a8b8eac10c785e70110c788056b0001, name=null]
       at org.hibernate.impl.SessionFactoryImpl.deserialize(SessionFactoryImpl.java:1056)
       at org.hibernate.impl.SessionImpl.readObject(SessionImpl.java:1892)
       ... 78 more
      


      To avoid the IOException, Hibernate needs a name for the factory, which is provided via the property. But having to specify that property seems funky. Could the value of the persistence-unit element's name attribute be passed to the SessionFactory as its name?