In a recent project, I had a requirement of connecting to multiple
databases using hibernate. As tapestry-hibernate module does not provide
an out-of-box support, I thought of adding one. https://github.com/tawus/tapestry5

Now that the application is in production, I thought of writing a simple “How to”.
I have cloned the latest stable(5.3.2) tapestry project at

Injecting into Services

You can inject a session in a service using the marker. As DatabaseOne
is being used as the default configuration, in order to inject its
Session, you have to annotate it with @DefaultFactory. For DatabaseTwo,
you can use @DatabaseTwo annotation.

The Java Zone is brought to you in partnership with AppDynamics. AppDynamics helps you gain the fundamentals behind application performance, and implement best practices so you can proactively analyze and act on performance problems as they arise, and more specifically with your Java applications. Start a Free Trial.