我需要两个 Ebean 模型类,分别叫做“States”和“Children”。一个“State”对象可以包含嵌套的 Child 对象(一组 children 列表)。
以下是基本的 States 类:
这是基本的Children类:
这些类需要进行哪些最小的修改才能使用 Ebean ORM 创建状态对象?我阅读了这篇文章:Ebean Query by OneToMany Relationship,但是里面建议做了很多更改,我只想要最小的修改。
以下是基本的 States 类:
@Entity
public class States extends Model {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Constraints.Required(message = "stateName cannot be null")
@Column(nullable = false)
private String statename;
@Column(nullable = true)
private String url;
@Column(nullable = true)
private String parent;
private List<Children> childrenList;
}
这是基本的Children类:
@Entity
public class Children extends Model {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false)
private String statename;
@Column
private String child;
}
这些类需要进行哪些最小的修改才能使用 Ebean ORM 创建状态对象?我阅读了这篇文章:Ebean Query by OneToMany Relationship,但是里面建议做了很多更改,我只想要最小的修改。