使用spring data jpa 的删除操作,需要加注解@Modifying     @Transactional 否则报错如下: No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call 场景如下: 在service中,先执行 delete 操作,再执行 save操作 报错如下: No EntityManager with actu…
eclipes的Spring注解SequenceGenerator(name="sequenceGenerator")报错的解决方式 右键项目打开Properties—>JAP-->Errors/Warnings—>Queries and generators将Duplicate generator defined改为Ignore即可.…
spring boot 前台GET请求,传递时间类型的字符串,后台无法解析,报错:Failed to convert from type [java.lang.String] to type [java.util.Date] 而POST请求,传入时间类型字符串,后台是可以解析成Date类型的. 出现这个错误,在需要接受Date类型的字符串参数的controller层中,加入: @InitBinder public void initBinder(WebDataBinder binder) { S…
Mybatisplus的AR模式 Active Record(活动记录),是一种领域模型模式,特点是一个模型类对应关系型数据库中的一个表,而模型类的一个实例对应表中的一行记录.ActiveRecord 一直广受动态语言( PHP . Ruby 等)的喜爱,而 Java 作为准静态语言,对于 ActiveRecord 往往只能感叹其优雅,所以 MP 也在 AR 道路上进行了一定的探索,仅仅需要让实体类继承 Model 类且实现主键指定方法,即可开启 AR 之旅.逻辑删除 逻辑删除的本质是修改操作,…
前几天,有个同事在使用JPA的自定义SQL方法时,程序一直报异常,捣鼓了半天也没能解决,咨询我的时候,我看了一眼他的程序,差不多是这个样子的: @Repository public interface UserRepository extends JpaRepository<User,Long> { @Query(value = "delete from pro_user where id = ?1",nativeQuery = true) void deleteUserB…
sqlplus以管理员方式接入数据库,启动时出现报错,如下: > sqlplus "/as sysdba" SQL> startup ...... ORA-01157: cannot identify/lock data file 8 - see DBWR trace file ORA-01110: data file 8: '/tmp/test.dbf' 查看数据库日志文件alert_$ORACLE_SID.log,存在对应报错信息: Errors in file ...…
简单搭建了一个Spring Maven工程就报错: 看到网上说是JDK 7 和 Spring3.x :JDK编译级别设置成1.7,仍然没有得到解决,采用版本为  3.2.0.RELEASE <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId>…
spring boot 2.0.X 的版本,整合zipkin2.10.1 zipkin服务启动后,访问zipkin的UI http://localhost:8002/zipkin/ 页面显示空白,css和js加载失败.后台报错: 2018-11-23 15:04:38.250 ERROR 10764 --- [ XNIO-1 task-15] io.undertow.request : UT005023: Exception handling request to /zipkin/traces_…
spring boot中连接数据库报错500(mybatis) pom.xml中的依赖 <!-- 集成mybatis--> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.3</version> </depend…
在上篇文章springboot(二):web综合开发中简单介绍了一下spring data jpa的基础性使用,这篇文章将更加全面的介绍spring data jpa 常见用法以及注意事项 使用spring data jpa 开发时,发现国内对spring boot jpa全面介绍的文章比较少案例也比较零碎,因此写文章总结一下.本人也正在翻译Spring Data JPA 参考指南,有兴趣的同学欢迎联系我,一起加入翻译中! spring data jpa介绍 首先了解JPA是什么? JPA(Ja…