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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:52:10+00:00 2026-05-23T16:52:10+00:00

i have the same problem , my Transactions not write into DB. I think

  • 0

i have the same problem, my Transactions not write into DB. I think this Spring problem regard is not a bug of framework, but is a problem of configuration file (applicationContext.xml for understand) so I put my configuration file:

...    
            <!-- this is a bridge for entityManager and PersistenceUnit -->
        <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
            <property name="persistenceUnitName" value="fb-persistence" />
        </bean>


    <bean id="myTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> 
        <property name="entityManagerFactory" ref="entityManagerFactory"/> 
    </bean>

    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
    <bean name="pluginDaoImpl" class="it.synclab.fb.jpa.dao.impl.PluginDaoImpl" />
</beans>

a interface is:

public interface PluginDao {

    public Plugin load (int id);

    public void save(Plugin plg);
}

a implementation of interface is:

public class PluginDaoImpl implements PluginDao {

    @PersistenceContext (unitName="fb-persistence")
    private EntityManager em;

    public void setEntityManager(EntityManager entityManager) {
        this.em = entityManager;
    }

    @Transactional
    public Plugin load(int id) {
        return em.find(Plugin.class, id);

    }
    @Transactional(readOnly=false, propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
    public void save(Plugin plg) {
        em.persist(plg);
        //em.flush();

    }
}

and dulcis in fundo, my PluginTest (for dirty-testing) is:

public class PluginTest{

    public static void main(String[] args) {        
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        PluginDao dao = (PluginDao) applicationContext.getBean("pluginDaoImpl");

        Plugin plugin1 = new Plugin();
        //inserisco un nuovo plugin
        //plugin.setId(14);
        plugin1.setMethod("prova");
        plugin1.setDescrizione("questa Bean Class!");
        dao.save(plugin1);

        Plugin plugin = new Plugin();
        //carico un plugin per id
        plugin =  dao.load(9);

        System.out.println("id: " + plugin.getId() + 
                         " Descrizione: " + plugin.getDescrizione() + 
                         " Method: " + plugin.getMethod());
    }

If I now add the method PluginDaoImpl.save (), em.flush line-code I get this error:

Exception in thread "main" javax.persistence.TransactionRequiredException: no transaction is in progress *

*the cause is not specificated.

  • 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-23T16:52:10+00:00Added an answer on May 23, 2026 at 4:52 pm

    You are missing <tx:annotation-driven transaction-manager="myTransactionManager"/>
    in your context.xml

    (See Using @Transactional)

    Add the tx namespace like this:

    <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:aop="http://www.springframework.org/schema/aop"
         xmlns:tx="http://www.springframework.org/schema/tx"
         xsi:schemaLocation="
         http://www.springframework.org/schema/beans 
         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
         http://www.springframework.org/schema/tx 
         http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
         http://www.springframework.org/schema/aop 
         http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I actually have two questions regarding the same problem but I think it is
I have basically the same problem outlined in this question, however I am using
This is pretty much the same problem i have, except with very different code:
I have a deadlock problem with two transactions that do not access any common
I have the same problem as described in the posts listed below. That is,
I have the same problem as described in ( Last record of Join table
I have the same problem as in the following post . So I am
Solution: if you have the same problem, addElement() instead of addChild() is what did
Does anyone have the same problem as I do? ... I've upgraded to the
I have essentially the same problem discussed here: http://khason.net/blog/dependency-property-getters-and-setters-in-multithreaded-environment/ public static readonly DependencyProperty MyPropertyProperty

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.