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 8964795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:40:13+00:00 2026-06-15T16:40:13+00:00

I have written below code doing below activities I created one transaction using Spring

  • 0

I have written below code doing below activities
I created one transaction using Spring classes.
Inserted one row.
Created other transaction.
Inserted another row.
committed outer transaction.
Rolledback inner transaction.

TransactionStatus trxstsOuter= dsTrxMngr.getTransaction(null);
    jdbcTemplate.update("insert into kau_emp values(6,'xyz' )");
    TransactionStatus trxstsInner= dsTrxMngr.getTransaction(null);
        jdbcTemplate.update("insert into kau_emp values(7,'pqr' )");

dsTrxMngr.commit(trxstsOuter);
System.out.println("trxstsOuter.isCompleted()" + trxstsOuter.isCompleted());
System.out.println("trxstsInner.isCompleted()" + trxstsInner.isCompleted());
dsTrxMngr.rollback(trxstsInner);
    System.out.println("trxstsInner.isCompleted()" + trxstsInner.isCompleted());

I observed that both the rows are committed to DB !!
The output is

trxstsOuter.isCompleted()true
trxstsInner.isCompleted()false
trxstsInner.isCompleted()true

Is it correct behavior ?
Should not inner transaction be first committed/rollbacked before allowing outer transaction to commit ?
If outer transaction was committed, should rollback of inner thrown an error ?

  • 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-06-15T16:40:14+00:00Added an answer on June 15, 2026 at 4:40 pm

    In your example transaction Propagation.REQUIRED is used as the default value, and all the logic transactions are mapped to the single physical transaction

    When the propagation setting is PROPAGATION_REQUIRED, a logical
    transaction scope is created for each method upon which the setting is
    applied. Each such logical transaction scope can determine
    rollback-only status individually, with an outer transaction scope
    being logically independent from the inner transaction scope. Of
    course, in case of standard PROPAGATION_REQUIRED behavior, all these
    scopes will be mapped to the same physical transaction. So a
    rollback-only marker set in the inner transaction scope does affect
    the outer transaction’s chance to actually commit (as you would expect
    it to).

    So in your example two logical transactions are mapped to one physical transaction.

    See the documentation

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

Sidebar

Related Questions

Hi I have written below code function unique(th){ var obj = {}; for(var i
I am trying to fetch wcf service from jquery. I have written below code
I have written grammar for a language (sample code below) //this is a procedure
I have written a very simple WCF service, that worked fine (code below), then
I have written a MapReduce program, code is below: import java.io.IOException; import java.util.Iterator; import
I have written the code below, and it complains the the method defineProperty does
I have pasted a code snip below that I have written which reads a
I have written some test code for comparing the performance of using direct property
I have a fiddle which displays date picker. same code i have written below
This might be a confusing question but I have written below a Directory crawler,

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.