This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I think this XML should make sure that a transaction should be rolled back whenever an exception occurs in one of my dao-classes.
However when I run this code:
When I run the "createPractice" method (which generates an error), it doesn't rollback the record I added in the first line of this method. Does anyone know what I'm doing wrong here?
Well, based on looking at your code, your DAO is catching all the exceptions instead of them being thrown. So in the end, there is no exception thrown.
Also by default all RuntimeExceptions thrown will cause a rollback, in most cases you won't need the "rollbackFor="Exception.class"
So in your DAO catch code, rethrow the exception up the stack.