Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Problems configuring spring aop transaction,really need some help here

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just finished integrating struts 1.3 ,hibernate 3.2 and spring 2.5,a problem came up when I was doing some test work,here is my simplified ItemManager class:


and part of my xml configuration:



If I call addItem() and send in a well-formed Item object,it works just fine,but if I choose to explicitly throw a RuntimeException after saving a Item,shouldn't Spring do a rollback for me?Well it doesn't, I have spent hours checking and altering my code and still can't figure out the reason,is there anyone can explain this for me?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please see the JavaRanch naming policy and change your display name to conform with this policy. Thanks!
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post the relevant DEBUG-level logs?
 
Simon wilson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Can you post the relevant DEBUG-level logs?


Trust me ,It's just one piece of insert sql generated hy hibernate and something like:

Servlet.service() for servlet action threw exception
java.lang.RuntimeException (the exception I throw explicitly)
at com.bjsxt.drp.basedata.dao.ItemDao4OracleImpl.addItem(ItemDao4OracleImpl.java:34)
at com.bjsxt.drp.basedata.model.ItemAction.add(ItemAction.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
nothing else,nothing helpful
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I find that difficult to believe, since at the DEBUG level you'll see object creation, AOP info, transaction rollback info, and so on.

See this section of the Spring declaractive transaction management docs.
 
Simon wilson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:I find that difficult to believe, since at the DEBUG level you'll see object creation, AOP info, transaction rollback info, and so on.

See this section of the Spring declaractive transaction management docs.


I read the docs and realize that I misunderstood "debug level" for "info level", and the log4j in my project is not working :banghead:.Apparently I screw up,better go back to recharge and start over,thanks a lot for your help.
 
Why is the word "abbreviation" so long? And this ad is so short?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic