ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alistair Young" <alistair.j.yo...@gmail.com>
Subject iBATIS with JTA
Date Tue, 08 Apr 2008 10:51:41 GMT
Hello all,

I've been using iBATIS for a while quite successfully with a
transactionManager type of "JDBC" - however, I now want to use JTA and
am not having so much luck.

I have a block of code like this:

	// start a transaction
	dao.startTransaction();

	// get and update a database entry
	ColourDto colour = dao.findColour(1L);
	colour.setColour("PINK");
	dao.update(colour);

	// rollback
	dao.endTransaction();

The methods on my 'dao' object are pretty trivial calls onto the
methods of an instance of SqlMapClient.

With a JDBC SqlMap, I get the behaviour I expect: the database is
unchanged.  However, with a JTA SqlMap, the rollback is ignored (and
so the database is updated).

The relevant bit of my SqlMap configuration is like this:

	<transactionManager type="JTA">

		<property name="UserTransaction"
			value="java:comp/UserTransaction"/>
		<dataSource type="JNDI">
			<property name="DataSource" value="java:my/ds"/>
		</dataSource>

	</transactionManager>

I'm executing my code within Oracle's OC4J container.  For my
DataSource I've tried both a very simple (bespoke) implementation of
the DataSource interface, and also an instance of the
OracleXADataSource class.  It's probably also worth mentioning that
I'm not using EJBs.

Can anybody help?  I think I must be missing something pretty
fundamental - so apologies if this is a stupid question...

Much appreciated!


Alistair.

Mime
View raw message