休眠
我有一个实体:工厂
detailsOfPans.forEach(map -> map.forEach((k, v) -> {
// Do something with k, v
}));
在百里香叶中向工厂添加电子邮件,
@Entity
public class Factories extends BaseEntity {
@Id
@SequenceGenerator(name = "factories_id_seq", sequenceName = "factories_id_seq", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "factories_id_seq")
private Integer id;
@ElementCollection
private Set<String> emails = new HashSet<String>();
//get set...
}
当我尝试保存时,我得到了
org.springframework.beans.InvalidPropertyException:无效的属性 Bean类[com.lcm.model.Factories]的“ emails [0]”:属性 索引属性路径“ emails [0]”中引用的数组都不是 既不是列表也不是地图;返回值是[[]]
答案 0 :(得分:1)
这是不可能的,因为设置没有顺序...请检查此帖子,还有其他选择...