I need two Ebean model classes called "States" and "Children". A "State" object can contain nested Child objects(List of children).
Here is the basic States class,
@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;
}
Here is the basic Children class,
@Entity
public class Children extends Model {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false)
private String statename;
@Column
private String child;
}
What are the minimal modifications that should be done to these classes to create State objects using Ebean ORM? I went through the post,
But there, a lot of changes have been suggested. I just want the minimal modifications.