Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

@Transactional: data not committed

 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've a simple use-case: Controller calls Service calls DAO to persist data into HSQL.
Everything is OK except data is not committed. (No rows in the table)

Looking for a hint to check where the issue be for the @Transactional

 
Ranch Hand
Posts: 35
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you enabled annotation-driven transactions with a line like this in your Spring config file?



If you have then try enabling DEBUG-level logging for the org.springframework package and exercise the code to see what output is logged. This will let you see what Spring is doing behind the scenes; e.g. which transactional methods it discovers, committing or rolling-back at transactional boundaries, etc. I've done this before to diagnose transaction-related problems.
 
H Paul
Ranch Hand
Posts: 491
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Thanks. I had that line of code.

2. Basically, I unit test the DAO alone and from log, it show committed:
10 Apr 2014 20:06:56,100 321746 [main] DEBUG JpaTransactionManager - Initiating transaction commit

3. While testing another thing, I got exception and found some how my web.xml is missing OpenEntityManagerInViewFilter for JPA.
Once I put the filter the initial flow worked OK.

 
Evildoers! Eat my justice! And this tiny ad's justice too!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic