_
MongoRepository中变量的正确方法名称是什么。
历史.java
@Document(collection = "spring-history")
public class History {
private Long record_id;
//getter - setter
}
HistoryRepository.java
public interface HistoryRepository extends MongoRepository<History, String>{
List<History> findAllByRecordid(Long recordId);
}
我得到了以下异常
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property recordid found for type History! Did you mean 'record_id'?
我尝试了以下变量选项,但这些都不起作用。
List<History> findAllByRecordId(Long recordId);
List<History> findAllByRecord_id(Long recordId);
List<History> findAllByRecord__id(Long recordId);