I am using spring-data-jpa, I want update something, I have annotated my method in PaySupplierSettleBillRepository as
public interface PaySupplierSettleBillRepository extends JpaRepository<PaySupplierSettleBillEntity, Long>,
JpaSpecificationExecutor<PaySupplierSettleBillEntity> {
@Modifying
@Query("update PaySupplierSettleBillEntity p set p.payTime=:payTime,p.paymentOrder=:paymentOrder, p.transferTime=:transferTime, p.transferBank=:transferBank, p.transferOrder=:transferOrder, p.operatorName=:operatorName, p.remark=:remark where p.orderNumber=:orderNumber")
int updatePayInfo(PaySupplierSettleBillEntity entity);
}
That is not how you write a @Query
with named parameters. Take a look at the example from Spring documentation here ( https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.named-parameters ).
If you want to provide an object as param, you can do something like this.
@Query("UPDATE Entity E SET E.name = :#{#entity.name}")
public void updateEntity(@Param("entity") Entity entity);
Caused by: java.lang.IllegalStateException: Using named parameters for method<\/code> can be thrown when a method has redundant parameter which is not used in the
@Query<\/code> .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.