今天使用JPA自定义了一个删除方法deleteByUserIdAndCommentId发现并没有删除掉对应的数据,只执行了查询语句 Hibernate: select good0_.id as id1_6_, good0_.commentId as commenti2_6_, good0_.userId as userid3_6_ from tbl_good good0_ where good0_.userId=? and good0_.commentId=? 解决方法: 在删除方法前加注解@T
使用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
1)接收输入 check_status() { echo --Check hi_repo status is ok? y or n read var if [ "$var" != "y" ] then echo --input is not 'y' exit fi } 1.编写函数check_status,调用时直接写check_status,不用括号: 2.输入read var, 使用时用$var 3.if判断,可以用!=,注意if []的空格: 2)删除空行 #