我有一个简单的Java类,该类通过Spring JPA存储到MongoDB中-
public class PlanRecoveryStrategy {
String planId;
String processId;
String strategyId;
public String getPlanId() {
return planId;
}
public void setPlanId(String planId) {
this.planId = planId;
}
public String getProcessId() {
return processId;
}
public void setProcessId(String processId) {
this.processId = processId;
}
public String getStrategyId() {
return strategyId;
}
public void setStrategyId(String strategyId) {
this.strategyId = strategyId;
}
}
这是我的DataAccessObject类-
@Repository("PlanRecoveryStrategy")
public interface PlanRecoveryStrategyDao extends MongoRepository<PlanRecoveryStrategy, String> {
@Query(value = "{ 'planId' : ?0, 'processId' : ?1, 'strategyId' : ?2}", delete = true)
List<PlanRecoveryStrategy> deletePlanRecoveryStrategy(String planId, String processId, String strategyId);
}
但是,在尝试删除时,出现错误消息-未找到类型为com.apeiron.dataModel.plan.PlanRecoveryStrategy类型的对象的id属性
错误原因是什么?
答案 0 :(得分:0)
只需创建带有@Id
批注的字段并为其创建吸气剂和吸气剂