【spring data jpa】使用jpa的@Query,自己写的语句,报错:org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'status' cannot be found on null

报错:

org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'status' cannot be found on null

如果检查 自己写的SQL语句完全没有问题的情况下,并且已经使用了@Param(value ="")

那么你需要注意,@Param()这个注解引入的jar包是jpa的jar包还是ibatis的jar包。

注意@Param()引用的jar包是否正确

package com.pisen.cloud.luna.ms.report.base.dao;

import javax.transaction.Transactional;


import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;

import com.pisen.cloud.luna.ms.report.base.domain.Report;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface ReportDao extends JpaRepository<Report, Long>,JpaSpecificationExecutor<Report> {

    Report findByUid(String uid);

    
    @Modifying
    @Transactional
    int deleteByUid(String uid);

    @Modifying
    @Transactional
    @Query("update  Report rp set  rp.status = :#{#report.status}, " +
            "rp.feedback = :#{#report.feedback} where rp.uid = :#{#report.uid}")
    int update(@Param("report") Report report);

}

猜你喜欢

转载自www.cnblogs.com/sxdcgaq8080/p/9176319.html
今日推荐