Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with commit in a method marked with @Transactional

 
Alexey Saenko
Ranch Hand
Posts: 30
Chrome Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

The problem is in the following. There is Websphere 8.5 application server where is set up XA datasource. And there is an application which is written on Spring 3.2.2 with Hibernate 4.1.7. I have a DAO class which has one persist() method marked with @Transactional annotation and should just persist an object to the database. As a result it returns persisted object with id (hibernate performs request for the new one), but actually the object is not written to the database and there are no stacktraces in the logs. TransactionSynchronizationManager.isActualTransactionActive() returns true in the method persist().

All persistence objects are configured with annotations.

Spring configuration is in xml-form and looks like this:

Do you have any ideas how could I make DAO save an object to the database?

Thanks in advance.
 
Kathleen Angeles
Ranch Hand
Posts: 123
Firefox Browser Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And there are no other transactions in that unit flow? In other words, are there other resources involved, that could have caused a rollback, which cascaded to your persist? E.g. you can have 2 datasources, this one succeeded and the other one failed, and since you are using XA, I guess you are capable of multi-resource rollback.

- k


----------------------------------------------------------------------------------------
[SpringSource Certified Spring Professional (Spring Certification) - Practice Tests]
 
Alexey Saenko
Ranch Hand
Posts: 30
Chrome Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Kathleen for the moment there is only one datasource.

I've also forgotten to mention that persisting runs as follows
 
Alexey Saenko
Ranch Hand
Posts: 30
Chrome Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally, it started to work with the following configuration.

persistence.xml

web.xml

spring-beans.xml
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic