Friday, May 29, 2009

Grails TransactionManager Config

Today I was asked by one of my colleague "why grails does not ship with a default transaction manager?" I was kind of confused since I am very certain that Grails ships with a HibernateTransactionManager since Gorm is built on top of Hibernate 3. After a little bit discussion I realized the culprit is this message generated by Jetty:

INFO: No Transaction manager found - if your webapp requires one, please configure one.

Since Jetty does not recognize the Spring transaction manager therefore this message is generated, so to verify that Grails does use transaction manager fire up a Grails shell console and type the following:

println ctx.transactionManager

You should see something like this in the output:

org.springframework.orm.hibernate3.HibernateTransactionManager@12f40eb
===> null


So rest for sure all those transactional = true declaration in your service class are not just for show ;-)