This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring 2.5 @Transactional not working

 
Lisa Ray
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I'm using annotation-based Spring 2.5 in my service layer. The service calls DAO. It seems that service is not wrapped in a transaction which causes the Hibernate DAO to fail.

My Configuration file looks like this:



Following is the Service impl class:




Please suggest in case I'm missing something here.


Thanks
Lisa
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that the only configuration file, or are there more? I don't see the '<tx:annotation-driven/>' in your configuration. Or a TransactionManager, or a DataSource defined.
 
Lisa Ray
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nathan, Thanks for the post. For the sake of brevity I didn't post the entire app context XML. Here's the Spring XML:




I'm sure that the beans have been wired correctly, else I would have got a fat parser error. The only concern is that the service layer is not wrapped in a transaction. Because of which I get the following exception from the DAO layer:


Thanks
Lisa
 
Lisa Ray
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I'm not sure if this is really a Spring issue or Hibernate ORM problem. I changed the transaction strategy to use AOP, as shown below:


Now even with the new changes in place, I get the following error:







- Lisa
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic