rendered paste bodypublic class Boxes { @Id @GeneratedValue private Long id; @ManyToOne private Boards parentBoard; @ManyToOne private Boxes parentBox; // the root box will have parentBox == null; @OneToMany (cascade = CascadeType.REMOVE) @JoinTable (name = "Boxes_childboxes", joinColumns = @JoinColumn(name="BoxId"), inverseJoinColumns = @JoinColumn(name="childBoxId") ) private Collection<Boxes> childBoxList = new ArrayList<Boxes>(); // the last leaf box will have childBox == null; @OneToMany (cascade = CascadeType.REMOVE) private Collection<Tasks> taskList = new ArrayList<Tasks>();@Entitypublic class Tasks { @Id @GeneratedValue private Long id; @ManyToOne private Boxes parentBox; @ManyToMany private Collection<TaskPrivileges> taskPrivilegesList = new ArrayList<TaskPrivileges>(); @ManyToOne private Companies company; private String title; @Lob private String description; private String priority; // high , low, critical, normal private String status; //completed, working, pending/queued, in problems. @ManyToMany private Collection <Users> userList = new ArrayList<Users>();