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

Currently I have one dao, that uses generic methods and hibernate criteria to perform
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 have one doubt, that is when we create one-to-many as bidirectional. we will
I have a grails project that is throwing the following exception: org.springframework.dao.DataIntegrityViolationException: could not
Most of the DAO examples I've seen consist of simple queries only involving one
One may not always know the Type of an object at compile-time, but may
I have a wicket page , which contains two Spring-managed beans , one is
I'm trying to make simple many-to-one association, using NHibernate.. I have class Recruit with
I have a JPA/Spring application that uses Hibernate as the JPA provider. In one

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.