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

  • Home
  • SEARCH
  • 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 1070137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:31:04+00:00 2026-05-16T20:31:04+00:00

class MyService { public void a() { synchronized(somekey) { b(); } } @Transactional(propagation =

  • 0


class MyService {

public void a() { synchronized(somekey) { b(); } }

@Transactional(propagation = Propagation.REQUIRES_NEW) public void b() { ...do DB works... } }

My aim is

    1 - get the key
    2 - start transaction
    3 - commit transaction
    4 - release the key

When i call a() method from outside, transaction doesn't work.

Any suggestions ?

Thanks.

  • 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-16T20:31:05+00:00Added an answer on May 16, 2026 at 8:31 pm

    Unless you’re using code weaving, this can’t work.

    The default way Spring handles transactions is through AOP proxies. The call to a transactional method goes like this:

     caller --> ProxyClass.a() --> YourClass.a()
    

    If you call another method on the same object, you’re not going through the proxy, so there is no transactional behaviour.

     caller --> ProxyClass.a() --> YourClass.a() --> YourClass.b()
    

    If you don’t want to use AspectJ, you can get the proxy object using AopContext.currentProxy().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 531k
  • Answers 531k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Did I have it wrong the whole time and is… May 16, 2026 at 11:54 pm
  • Editorial Team
    Editorial Team added an answer I got this answer after posting to the Apple Dev… May 16, 2026 at 11:54 pm
  • Editorial Team
    Editorial Team added an answer (resolve 'foo) returns the Var named "foo", with its fully-qualified… May 16, 2026 at 11:54 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Example I have a repository class (DAL): public class MyRepository : IMyRepository { public
I have a web service that accepts and returns a custom class. The problem
I have a simple Fire and Forget service operation that works fine and doesn't
I have a GWT serializable class, lets call it Foo. Foo implements IsSerializable, has
I want to inherit from a class which is located in a WCF Service.
My service spawns a new thread, and stops it according to the typically recommended
I'm developing a GPS tracking software on android. I need IPC to control the
I currently have a database that gets updated from a legacy application. I'd like
I have a self-hosted WCF service with the InstanceContextMode set to PerSession. How can
I am trying to create a common service library shared between a WCF web

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.