I need two classes of the Ebean model called States and Children. The State object may contain nested child objects (list of children).
Here is the main class of 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;
}
Here is the base class 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;
}
What are the minimum changes that must be made for these classes to create state objects using Ebean ORM? I went through the mail
Ebean Query by OneToMany Relationship
But there were many changes suggested. I just want minimal changes.
source
share