现在面临的错误是"找不到能够从类型 [java.lang.String] 转换为类型 [com.marter.travel.model.Picture]
"import java.time.LocalDateTime;
import java.util.ArrayList;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document (collection = "tourpackage")
public class TourPackage {
private ArrayList<Picture> picture;
public ArrayList<Picture> getPicture() {
return picture;
}
public void setPicture(ArrayList<Picture> picture) {
this.picture = picture;
}
}
如果您使用的是 Spring 数据并且Picture
是另一个映射的类 @Document
.您必须在ArrayList<Picture>
上添加@DBRef
注释
@DBRef
private ArrayList<Picture> picture;