You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by javaxmlsoapdev <vi...@yahoo.com> on 2006/08/23 22:48:09 UTC

Transaction Boundry Spring DAO and Producer

In my service layer when I call DAO method to insert a record,
subsequently(in the same logical block) I call producer to put a message in
the queue. I need to bind this logical block in one transaction so that if
insertion of a record fails, call to producer should not occur

I am using Jencks. should Jencks transaction be used or Spring declarative
transaction? Any example?

-- 
View this message in context: http://www.nabble.com/Transaction-Boundry-Spring-DAO-and-Producer-tf2154808.html#a5952450
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Transaction Boundry Spring DAO and Producer

Posted by James Strachan <ja...@gmail.com>.
On 8/23/06, javaxmlsoapdev <vi...@yahoo.com> wrote:
>
> In my service layer when I call DAO method to insert a record,
> subsequently(in the same logical block) I call producer to put a message in
> the queue. I need to bind this logical block in one transaction so that if
> insertion of a record fails, call to producer should not occur
>
> I am using Jencks. should Jencks transaction be used or Spring declarative
> transaction? Any example?

If you wire up your DAO to JTA then you just need to do a JTA rollback
to rollback the JDBC and JMS operations. So you should be able to
achieve this purely by using Jencks for both the JMS and JDBC. e.g.
see this example of creating a JDBC DataSource which is automatically
wired to the JTA transaction...

http://jencks.org/Outbound+JDBC

You could use spring's declarative transactions to do the
commit/rollback for you if you like.

-- 

James
-------
http://radio.weblogs.com/0112098/