参考地址:
http://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/config/EnableJpaRepositories.html#enableDefaultTransactions--
public abstract boolean enableDefaultTransactions
Configures whether to enable default transactions for Spring Data JPA repositories. Defaults to true. If disabled, repositories must be used behind a facade that's configuring transactions (e.g. using Spring's annotation driven transaction facilities) or repository methods have to be used to demarcate transactions.
Returns:
whether to enable default transactions, defaults to true.
Default:
true
原来是在spring配置文件中关闭了jpa默认的事务管理机制
<jpa:repositories base-package="com.xx.order"
enable-default-transactions="false" />

 需要手动开启,所以,用spring的annotation在方法或类里面开启------------------(用@Transactional)

No transactional EntityManager available; nested exception is javax.persistence.TransactionRequiredException: No transactional EntityManager available的更多相关文章

  1. [Spring Data JPA问题]Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException

    JPQL如下: @Modifying(clearAutomatically = true) @Query("UPDATE SyncTestFromTKDO SET stuAns = '' w ...

  2. 报错:org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query

    service实现类上没有加@transaction 事务注解

  3. Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Cannot open connection

    Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceE ...

  4. 使用JPA保存对象时报nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly错误

    使用JPA保存对象时报nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOn ...

  5. javax.persistence.TransactionRequiredException: No transactional EntityManager available

    在操作中加上@Transcational注解,一般是用于修改或者删除操作.

  6. Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query

    org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested ...

  7. org.codehaus.xfire.fault.XFireFault: Could not read XML stream.. Nested exception is javax.xml.strea

    xfire使用中出现故障: 1. [2014-04-16 14:51:07.564]-[ERROR] org.apache.struts2.dispatcher.Dispatcher Exceptio ...

  8. nested exception is javax.management.InstanceAlreadyExistsException: webservice:name=statFilter,type=StatFilter

    Caused by: org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [ ...

  9. javax.persistence.TransactionRequiredException: Executing an update/delete query

    最近在springboot中整合jpa的时候碰到一个异常,异常如下 javax.persistence.TransactionRequiredException: Executing an updat ...

随机推荐

  1. Hacker - 世界上第一个黑客

    http://juliet.iteye.com/blog/176525凯文·米特尼克,1964年生于美国加州的洛杉矶. 13岁时他对电脑着了迷,掌握了丰富的计算机知识和高超的操作技能,但却因为用学校的 ...

  2. jmeter ---集合点使用方法:Synchronizing Timer

    LR中集合点可以设置多个虚拟用户等待到一个点,同时触发一个事务,以达到模拟真实环境下多个用户同时操作,实现性能测试的最终目的. jmeter中使用Synchronizing Timer实现Lr中集合点 ...

  3. Java并发编程(八):线程调度——线程池

    new Thread的弊端 执行一个异步任务你还只是如下new Thread吗? new Thread(new Runnable() { @Override public void run() { / ...

  4. CentOS7:gdb出现没有调试信息:Missing Separate debuginfos

    现在刚刚开始学习用gdb调试程序,结果:在centos下,出现这样的错误: gdb在调试程序时候提示 Missing separate debuginfos, use: debuginfo-insta ...

  5. 浅谈 Objective-C 下对象的初始化

    转自:http://www.oschina.net/question/54100_32468 众所周知,Objective-C是一门面向对象的语言,一般情况下,我们在Objective-C中定义一个类 ...

  6. python之histogram

    histogram A histogram is an accurate representation of the distribution of numerical data. It is an ...

  7. KVC之-setValue:forKey:方法实现原理与验证

    KVC之-setValue:forKey:方法实现原理与验证 - (void)setValue:(id)value forKey:(NSString *)key方法,实现原理与验证 功能:使用一个字符 ...

  8. 跟着百度学PHP[15]-SESSION的应用/网站登陆案例完整案例

    先把几个应该要有的页面建立好.

  9. mui调用webservice

    document.getElementById("confirm").addEventListener('tap', function() {var respnoseEl = do ...

  10. eclipse不自动弹出提示的解决办法(eclipse alt+/快捷键失效)centos 6.7

    1.次方法用于没有一点提示的情况:依次打开eclipse上面的windows ——preferences ——java ——editor —— content assist ,在右上方有一行“sele ...