JMS and Hibernate transaction sharing in Spring MDB using Oracle Streams AQ?

I am using Oracle 11g for my database and its Oracle Streams AQ function as a JMS implementation.

As far as I know, it should be possible to implement a message-based POJO (MDP) based on w760, which uses the same data source to access transactional data as well as JMS transactions - all without XA transactions (IIRC, this was implemented as a function of the extended SpringSource package for Oracle).

Is it possible to use Hibernate? Ideally, my MDP will start a JMS transaction and read the message from the queue, and then reuse the transaction to access data through Hibernate. If something goes wrong, the JMS and database transaction will be canceled without using two-phase commit (2PC).

I am not a transaction guru, so before I start digging deeper, can anyone confirm that this is possible and makes sense?

Update:
I want this implementation of a Transactional Resource Template . The sample code demonstrates it for ActiveMQ and JDBC, but I need to use Oracle Streams AQ and Hibernate.

Update2: SpringSource Advanced Pack for Oracle was open source as part of Spring Data JDBC, and it provides the ability to use one local transaction manager for both database and message access without resorting to the expensive distributed 2-phase transaction management commit. "

+5
source share
1 answer

2PC should not be necessary, as you say, since the application server must take care of this. However, you will have to pretty much use JTA transactions (like JavaEE container) rather than vanilla DataSource transactions, since JMS only works with JTA.

, :

  • Spring <jee:jndi-lookup/>, DataSource, spring - hibernate SessionFactory.
  • (<tx:jta-transaction-manager/> -).
  • Spring JMS MessageListenerContainer .
, ? , , , JMS Hibernate.
+3

All Articles