[jboss-dev-forums] [Design of EJB 3.0] - Funky config needed for extended PersistenceContext replicat

bstansberry@jboss.com do-not-reply at jboss.com
Thu Feb 15 22:31:05 EST 2007


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?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017398#4017398

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017398



More information about the jboss-dev-forums mailing list