Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 794271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:17:17+00:00 2026-05-14T22:17:17+00:00

in one dao I have 2 @Transactional methods. if i do not provide any

  • 0

in one dao I have 2 @Transactional methods.

if i do not provide any explicit properties,

then what will happen, if

I run one method in the body of another?

Both methods will run within THE SAME ONE TRANSACTION?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:17:18+00:00Added an answer on May 14, 2026 at 10:17 pm

    Proxies in Spring AOP

    When using Transactional, you’re dealing with proxies of classes, so in this scenario:

    @Transactional
    public void doSomeThing(){ // calling this method targets a proxy
    
        doSomeThingElse(); // this method targets the actual class, not the PROXY,
                           // so the transactional annotation has no effect
    }
    
    @Transactional
    public void doSomeThingElse(){
    }
    

    you are calling the proxy from outside, but the second method call is made from inside the proxied object and therefor has no transactional support. So naturally, they run in the same transaction, no matter what the values of the @Transactional annotation in the second method are

    so if you need separate transactions, you have to call

    yourservice.doSomething();
    yourservice.doSomethingElse();
    

    from outside.

    The whole scenario is explained pretty well in the chapter Spring AOP > Understanding AOP proxies, including this “solution”:

    Accessing the Current AOP Proxy object from the inside

    public class SimplePojo implements Pojo {
    
       public void foo() {
          // this works, but... gah!
          ((Pojo) AopContext.currentProxy()).bar();
       }
    
       public void bar() {
          // some logic...
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a spring Web Service, where I have a DAO with one method
One has txtDateReceived and second has txtVendorPackDate. Before insert will add record I have
i have some VB that uses DAO to grab some data, one field being
In a Spring web application I have several DAO and service layer beans. One
I need your help in solving one issue. I have such method in my
I have some problems with my DAO implementation. My scenario: I insert one entity
Most of the DAO examples I've seen consist of simple queries only involving one
One can say a type parameter T must have a specific supertype S_1: class
One car must have one owner, and an owner can have many cars.
I have a wicket page , which contains two Spring-managed beans , one is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.