1、java.lang.IllegalArgumentException: Name for parameter binding must not be null or empty! For named parameters you need to use @Param for query method parameters on Java versions < 8.
错误原因:在使用@Param注解时,错误地导成了import org.apache.ibatis.annotations.Param;注解,应使用下面的注解:
import org.springframework.data.repository.query.Param;
2、@Quorg.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations [delete from com.yzh.maven.entity.UserInfo u where u.userName =:userName]ery("delete from UserInfo u where u.userName =:userName")
解决办法:在HQL语句上面添加@Modifying注解
3、javax.persistence.TransactionRequiredException: Executing an update/delete query
解决办法:在HQL语句上面添加事务注解 @Transactional
版权声明:本文为yzh18373476791原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。