Additional Hibernate Mappings

Lance Speelmon

The current "state of the art" if to use the relatively new AdditionalHibernateMappingsImpl method that John Ellis introduced (many thanks to John!). This method has the benefit of having ONE Hibernate
SessionFactory and TransactionManager (both of which are required for transactions to work across Managers). Do not worry about transactions failing subtly; you will get a big fat stack trace if you run into this problem.

We are recommending that all Hibernate based tools switch to this new
methodology ASAP. For an example see:

/syllabus/components/src/webapp/WEB-INF/components.xml e.g.:

<beans>

<bean
id="org.sakaiproject.springframework.orm.hibernate.impl.AdditionalHibernateM
appingsImpl.syllabus"


class="org.sakaiproject.springframework.orm.hibernate.impl.AdditionalHiberna
teMappingsImpl">

<property name="mappingResources">

<list>

<value>


org/sakaiproject/component/app/syllabus/SyllabusItemImpl.hbm.xml

</value>

<value>


org/sakaiproject/component/app/syllabus/SyllabusDataImpl.hbm.xml

</value>

<value>


org/sakaiproject/component/app/syllabus/SyllabusAttachment.hbm.xml

</value>

</list>

</property>

</bean>

<bean id="org.sakaiproject.api.app.syllabus.SyllabusManager"

class="org.springframework.transaction.interceptor.TransactionProxyFactoryBe
an">

<property name="transactionManager">

<ref
bean="org.sakaiproject.springframework.orm.hibernate.GlobalTransactionManage
r" />

</property>

<property name="target">

<bean


class="org.sakaiproject.component.app.syllabus.SyllabusManagerImpl"

singleton="true">

<property name="sessionFactory">

<ref
bean="org.sakaiproject.springframework.orm.hibernate.GlobalSessionFactory"
/>

</property>

</bean>

</property>

<property name="transactionAttributes">

<props>

<prop key="*">PROPAGATION_REQUIRED</prop>

</props>

</property>

</bean>

</beans>
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.