如何编辑Spring和Thymeleaf中的嵌套对象?

时间:2017-03-02 20:14:16

标签: spring-mvc thymeleaf

有Base实体:

sql.ts

有名称实体:

public abstract class BaseEntity<T> implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
}

有Element实体:

public class Name extends BaseEntity {
    private String en;
    private String de;
    private String fr;
}

有分类实体:

public class Element extends BaseEntity {
    @OneToOne(cascade = CascadeType.ALL)
    private Name name;

    @OneToMany(cascade = CascadeType.ALL)
    private List<Category> category;
}

百里香叶中有编辑元素表格:

public class Category extends BaseEntity {
    @OneToOne(cascade = CascadeType.ALL)
    private Name name;
}

我已经为Element实体尝试了各种编辑表单,但我无法编辑与Category实体相对应的Name。那么如何在类别部分中配置表单?

0 个答案:

没有答案