冬眠
我有一个实体:工厂
@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...
}
在百里香为工厂添加电子邮件,
<table id="emailsTable" class="table table-striped table-hover responsive">
<thead>
<tr>
<th th:text="#{value}">Value</th>
<th></th>
</tr>
</thead>
<tbody>
<tr th:each="email, stat : *{emails}">
<td><input type="text" class="form-control" th:placeholder="#{email.placeholder}" placeholder="Name" th:field="*{emails[__${stat.index}__]}" /></td>
<td class="align-middle"><button type="button" class="btn btn-default pull-right delete"><i class="fas fa-trash-alt"></i></button></td>
</tr>
</tbody>
</table>
当我试图拯救,我得到
org.springframework.beans.InvalidPropertyException:属性无效
bean类[com.lcm.model.Factories]的'emails[0]:属性
索引属性路径“emails[0]中引用的既不是数组
不是列表也不是映射;返回值是[[]]