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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:01:48+00:00 2026-05-25T19:01:48+00:00

I have been trying to figure this out for two days without sucess. I

  • 0

I have been trying to figure this out for two days without sucess. I am using annotation-driven transactions with Spring 3.0.5 and Postgress. I am calling two dao methods from a business logic method:

@Transactional 
public void registerTransaction(GoogleTransaction transaction) {
       long transactionID = DBFactory.getTransactionDBInstance().addTransaction(transaction);
       DBFactory.getGoogleTransactionDBInstance().addGoogleTransaction(transaction, transactionID);

}

The second method (addGoogleTransaction) throws a RuntimeException at the end, however transaction is not rolled back and both rows are inserted.

The DAO method looks like this:

public void addGoogleTransaction(GoogleTransaction transaction, long id) {
    log.trace("Entering addGoogleTransaction DAO method ");
    log.trace(transaction.toString());
    getSimpleJdbcTemplate().update(QRY_ADD_GOOGLE_TRANSACTION, new Object[] {id, transaction.getGoogleSerialNumber() ,
        transaction.getGoogleBuyerID(), transaction.getGoogleOrderID()});
    log.trace("Google transaction added successfully");
    throw new RuntimeException();
}

The Spring configuration file:

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"/>
</bean>
<tx:annotation-driven />

Do I need to configure something else? I have tried to add @Transactional to the business logic class and @Transactional to the dao methods but it doesn’t work neither.
Thanx

It is called from a controller class (annotated with @Controller) for testing pursposes.

@RequestMapping(value = "/registration")
public String sendToRegistrationPage() throws ServiceException {

    GoogleTransaction googleTransaction = new GoogleTransaction(0, "aei", new Date(), TransactionStatus.NEW, BigDecimal.ZERO, "", "", 0, "");
    BillingFactory.getBillingImplementation("").registerTransaction(googleTransaction);
    return "registration";
}
  • 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-25T19:01:49+00:00Added an answer on May 25, 2026 at 7:01 pm

    I’m not quite sure what BillingFactory.getBillingImplementation("") does. Is it a plain Java factory or does ist return a Spring service from the application context? I’m also not sure if you have Spring transactional proxies – if not then what you do is very likely autocommited. I think it’d be a good idea to enable logging for the package org.springframework.transaction.

    Actually I’d expect something like:

    @Controller
    public class MyController {
    
        @Resource
        private BillingService billingService;
    
        @RequestMapping(value = "/registration")
        public String sendToRegistrationPage() throws ServiceException {
            GoogleTransaction googleTransaction = new GoogleTransaction(0, "aei", new Date(), TransactionStatus.NEW, BigDecimal.ZERO, "", "", 0, "");
            billingService.registerTransaction(googleTransaction);
            return "registration";
        }
    }
    

    And in your Spring config something like (or some @Service annotated bean):

    <bean id="billingService" class="foo.bar.BillingImplementation" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to figure this out for days. Hope someone can help.
I obviously new and have been trying to two days to figure out how
I have been trying to figure this out for way to long tonight. I
I have been trying to figure this out for some time. It seems lots
I have been pulling my hair trying to figure this out but nothing is
I have been scratching my head for hours trying to figure out why this
I've been trudging through some code for two days trying to figure out why
I'm been trying to figure this out for a while now, and have just
I'm new to python and have been trying to figure this out all day.
I've been online for days trying to figure this one out and, while I've

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.