Skip to content
Use Spring Transaction Manager inside your Tapestry 5 application
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Tapestry 5 Spring Tx Plugin

How to

This contribution allows you to access to a Hibernate session factory configured via Spring through your Tapestry businness layer in the same transaction. To configure you only need to specify the name of the Hibernate Session Factory spring bean, and the name of the Spring transaction manager.

Ex :

public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration)
    configuration.add(SpringHibernateConstants.SESSION_FACTORY_BEAN_NAME, "sessionFactory");
    configuration.add(SpringHibernateConstants.TX_MANAGER_BEAN_NAME, "transactionManager");

With this contribution Tapestry will not initialize Hibernate and will simply wrap its session source and transaction handling using the bean provided by Spring. Also, the spring transaction context will be initialized.


This contribution also provide an extension to the default spring LocalSessionFactoryBean that will allow you to specify a list of packages that contain your domain objects. All the beans annotated with @Entity will be added to the Hibernate configuration.

Ex :

<bean id="sessionFactory"
    <property name="dataSource" ref="dataSource" />
    <property name="configLocation" value="classpath:hibernate.cfg.xml" />
    <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />
    <property name="packageNames">

For more information, you can have a look at the test application provided with this contribution.

Maven dependency

To use this plugin, add the following dependency in your pom.xml.





More Informations & contacts


This project is distributed under Apache 2 License. See LICENSE.txt for more information.

Something went wrong with that request. Please try again.