直接说一下解决方案

Dao层,一定要是Dao层。

1 增加Transactional,必须要事务!

2 增加Modifying,告诉jpa这是修改!

    @Transactional
@Modifying
@Query(value = "update A set s= :s where id=:id",nativeQuery = true)
Integer updateReport(@Param(value = "s")String s,
@Param(value = "id")String id);

JPA javax.persistence.TransactionRequiredException的更多相关文章

  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. Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query

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

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

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

  4. No transactional EntityManager available; nested exception is javax.persistence.TransactionRequiredException: No transactional EntityManager available

    参考地址:http://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/ ...

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

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

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

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

  7. websphere部署 hibernate jpa & Error 500: javax/persistence/OneToOne.orphanRemoval()Z

    WebSphere 7 & Javax/Persistence/OneToMany.OrphanRemoval() Error 文章出处:http://www.mkyong.com/websp ...

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

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

  9. 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 ...

随机推荐

  1. cocos creator主程入门教程(九)—— 瓦片地图

    五邑隐侠,本名关健昌,10年游戏生涯,现隐居五邑.本系列文章以TypeScript为介绍语言. 这一篇介绍瓦片地图,在开发模拟经营类游戏.SLG类游戏.RPG游戏,都会使用到瓦片地图.瓦片地图地面是通 ...

  2. 使用LR编写windows sockets协议xml报文格式脚本实战

    以下是测试脚本Demo: #include "lrs.h" Action() { char * resultCode;//结果代码 char * time; //系统时间 char ...

  3. CentOS6.8 安装node.js npm

    环境:CentOS6.8_X64系统 一.到官方下载最新的编译好的安装文件,目前是6.9.4. $>cd /usr/local/src #定位到这个目录,下载的文件会在这个目录#使用wget下载 ...

  4. 【转】IIS上的反向代理

    http://blog.csdn.net/yuanguozhengjust/article/details/23576033 一直说在IIS上做反向代理,由于沉迷在nginx一行指令完事的美好情景当中 ...

  5. Linux高级运维 第二章 Linux基本操作和自己动手组装服务器

    2.1  Linux网络相关概念和修改IP地址的方法 2.1.1  网卡的命名规则       Centos 6的网卡命名方式:它会根据情况有所改变而非唯一且固定,在CENTOS6之前,网络接口使用连 ...

  6. ArcPy 拷贝数据库

    使用Python脚本进行图形数据库的拷贝. 原始帖子地址:https://www.2cto.com/database/201302/187391.html 整理Python代码: # -*- codi ...

  7. 【English】十五、“a”和“one”的区别是什么?

    一."a"和"one"的区别是什么 参考:“a”和“one”的区别是什么-百度知道 a和one的区别是什么?-作业帮 1.尽管a和one这两个在意义上有些相似, ...

  8. 小程序开发基础-view视图容器

    view 视图容器. // wxml <view class="section"> <view class="section__title"& ...

  9. 查看CPU使用率

    rem 如果wmi服务(服务名为Winmgmt)坏掉了,需要到system32\webm目录下执行如下注释的命令 rem for %i in (*.dll) do RegSvr32 -s %i rem ...

  10. Delphi IfThen语句

    function IfThen(AValue: Boolean; const ATrue: string; AFalse: string = ''): string; overload; $[StrU ...