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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:48:00+00:00 2026-05-28T13:48:00+00:00

Tried to configure Spring for tests with hibernate and transactions. Getting bean from app

  • 0

Tried to configure Spring for tests with hibernate and transactions. Getting bean from app context which is marked with @Transactional transaction isn’t intercepted. What I could miss in configuration?

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
    <property name="dataSource" ref="dataSource"></property>
</bean>

<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>

<import resource="spring-dao.xml"/>

<tx:annotation-driven transaction-manager="transactionManager" />


<bean id="userService" class="com.test.service.UserServiceimpl">
    <property name="userDao" ref="userDao"/>
</bean>

public interface UserService {

public abstract User loadUserById(long userId);

@Transactional
public abstract void doSomething();

}

public class UserServiceimpl implements UserService {
@Override
public void doSomething() {
    User user = loadUserById(1);
    user.fillUpMoney(999);
    userDao.update(user);
    throw new RuntimeException("Shpould be rollback");
}
  • 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-28T13:48:01+00:00Added an answer on May 28, 2026 at 1:48 pm

    Do not user BeanFactory 😉

    http://forum.springsource.org/showthread.php?122292-Sprinng-doesnt-intercept-transaction

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

Sidebar

Related Questions

I've tried to configure Spring Security through XML for some time now, but I
I have created a WCF service which does not use the app.config to configure
Grails have cofig for spring bean called resources.groovy . And as i understand from
I am trying to configure Spring3 + JPA using Hibernate, but I am getting
I tried to configure google adsense on my drupal site. I used two methods.
I tried to install and configure cakephp 2.0 on my local machine (wamp server),
I tried to compile Qt+Webkit statically with MS VS 2008 and this worked. C:\Qt\4.6.2>configure
Tried following the instructions here: How to use Google app engine with my own
Tried examples from 'php.net' but don't understand what's the problem. Any suggestions? <?php $_SESSION['test']
I am trying to configure some basic HTTP authentication over HTTPS using the spring

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.