Error No EntityManager with actual transaction available for current thread - cannot reliably process persist call

0 votes

I get this error when trying to invoke "persist" method to save entity model to database in my Spring MVC web application. Can't really find any post or page in internet that can relate to this particular error. It seems like something's wrong with EntityManagerFactory bean .


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
 xmlns:xsi="" xmlns:mvc=""

    <context:component-scan base-package="wymysl.Controllers" />
    <jpa:repositories base-package="wymysl.repositories"/> 
    <context:component-scan base-package="wymysl.beans" /> 
    <context:component-scan base-package="wymysl.Validators" /> 
     class="" />
     <bean class="org.springframework.orm.hibernate4.HibernateExceptionTranslator"/>

     <bean id="passwordValidator" class="wymysl.Validators.PasswordValidator"></bean>

     <bean id="dataSource"

        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
        <property name="url" value="jdbc:oracle:thin:@localhost:1521:xe" />
        <property name="username" value="system" />
May 22, 2020 in Java by kartik
• 37,520 points

1 answer to this question.

0 votes

Hii @kartik,

If you have

@Transactional // Spring Transactional
class MyDao extends Dao {

and super-class

class Dao {
    public void save(Entity entity) { getEntityManager().merge(entity); }

and you call

@Autowired MyDao myDao;;

you won't get a Spring TransactionInterceptor (that gives you a transaction).

This is what you need to do:

class MyDao extends Dao {
    public void save(Entity entity) {; }
answered May 22, 2020 by Niroj
• 82,780 points

Related Questions In Java

0 votes
1 answer

How to solve this error: No Persistence provider for EntityManager named

After <persistence-unit name="agisdb">, define the persi ...READ MORE

answered Jan 8, 2019 in Java by Daisy
• 8,110 points
0 votes
1 answer

"No mapping found for HTTP request with URI[....] in DispatherServlet"

Your standard Spring MVC application will serve ...READ MORE

answered Jun 6, 2018 in Java by prasad
• 160 points
0 votes
2 answers

I'm getting following error, while i'm running code in windows xp service pack 3 with JDK 6 version.

Till you send the code, I would ...READ MORE

answered May 16, 2018 in Java by Meci Matt
• 9,460 points
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,249 views
0 votes
0 answers
0 votes
1 answer

Error: setOnItemClickListener cannot be used with a spinner

Hello @kartik, See the first line of your ...READ MORE

answered Jun 1, 2020 in Java by Niroj
• 82,780 points
0 votes
1 answer

What is the reason for no ConcurrentHashSet against ConcurrentHashMap?

Hello, There's no built in type for ConcurrentHashSet because you ...READ MORE

answered Apr 8, 2020 in Java by Niroj
• 82,780 points