Hi,

I'm new to Axis. I'm using Axis2 1.1.1.

I'm creating a service that retrieves data from a database. I'm using 
Hibernate. For those of you not familiar with it, the basic pattern of usage is 
that you create something called a SessionFactory once when the application 
starts, and then for each request/response cycle you create a Session. When the 
response finishes, you commit the session.

In regular web applications I create the session factory in the 
ApplicationContext. Then I make a servlet filter that creates the session and 
starts a transaction on the way in, and then commits the transaction and closes 
the session on the way out.

I'm trying to figure out how to do this in Axis. I created a module called 
hibernateTransactionModule. I've got two handlers, one for the way in and one 
for the way out, each attached to a new phase. Right now they're just saying 
'hello world' and it works, they do execute when I expect them to.

So I've got three classes:

HibernateTransactionModule implements org.apache.axis2.modules.Module
HibernateTransactionHandlerBegin extends AbstractHandler implements Handler
HibernateTransactionHandlerEnd extends AbstractHandler implements Handler

My intuition tells me that HibernateTransactionModule.init() would be the 
appropriate place to create the hibernate session factory, 
HibernateTransactionHandlerBegin.invoke() could create a session for a request 
and put it into the messageContext, and HibernateTransactionHandlerEnd.invoke() 
could commit the transaction and close the session.

But I can't see a place where I can store the session factory where it can be 
accessible to the handlers.

One possibility would be to use a static field in 
HibernateTransactionHandlerBegin but that would be an ugly hack. Any 
suggestions?

Thanks
Michael Davis
www.damaru.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to