Java QuerySyntaxException:未映射表[Update Table BOMmodel Set PA13=Materialvalue+;ReqQTY]

Java QuerySyntaxException:未映射表[Update Table BOMmodel Set PA13=Materialvalue+;ReqQTY],java,mysql,spring-data-jpa,Java,Mysql,Spring Data Jpa,我试图用另外两列(Materialvalue,ReqQTY)的总和来更新一列,正如您在上面看到的 import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.

我试图用另外两列(Materialvalue,ReqQTY)的总和来更新一列,正如您在上面看到的

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Service;
import com.example.demo2.model.BOMmodel;

public interface BOMrepository extends JpaRepository<BOMmodel, String> {
    @Modifying
    @Query("Update Table BOMmodel Set PA13 = Materialvalue + ReqQTY ")
      int updatePA();
}
但我得到了以下错误:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'controller': Unsatisfied dependency expressed through field 'BOMrepos'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'BOMrepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract void com.example.demo2.repository.BOMrepository.updatePA()!

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'BOMrepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract void com.example.demo2.repository.BOMrepository.updatePA()!

java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: Table is not mapped [Update Table BOMmodel Set PA13 = Materialvalue + ReqQTY ]
我做了一些研究,发现使用表名而不是实体是导致此错误的常见原因,但事实并非如此。 请问还有其他想法吗

Update bom_table Set PA13 = Materialvalue + ReqQTY
用那个


使用该

我找到的解决方案是删除行
@Table(name=“bom_Table”)
并将存储库代码更改为@Transactional@Modifying@Query(“Update BOMmodel Set PA13=Materialvalue+requqty”)int updatePA();
现在它就像一个魔咒。

我找到的解决方案是删除行
@Table(name=“bom_Table”)
并将存储库代码更改为@Transactional@Modifying@Query(“Update BOMmodel Set PA13=Materialvalue+reqty”)int updatePA();
现在它就像一个符咒。

非常感谢@Mayank你启发我解决这个问题。我所做的是删除了行
@Table(name=“bom_Table”)
,并将存储库代码更改为
@Transactional@Modifying@Query(“Update BOMmodel Set PA13=Materialvalue+ReqQTY”)int updatePA()现在它就像一个迷人的精灵。当你处理你的问题时,你会学到很多东西。所以继续下去。非常感谢@Mayank你激励我解决这个问题。我所做的是删除了行
@Table(name=“bom_Table”)
,并将存储库代码更改为
@Transactional@Modifying@Query(“Update BOMmodel Set PA13=Materialvalue+ReqQTY”)int updatePA()现在它就像一个迷人的精灵。当你处理你的问题时,你会学到很多东西。所以继续。。
Update bom_table Set PA13 = Materialvalue + ReqQTY