The following code should do what you are looking for!
Code:
@Entity
@Table(name = "TBL_PERSON")
public class Person {
    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(name = ID)
    private String id;
    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "parent")
    private Person parent;
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name = "parent")
    @Cascade(value = { org.hibernate.annotations.CascadeType.ALL,
            org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
    private Collection<Person> children = new LinkedList<Person>();
}
HTH
- bitbyter
chandramohan_murkute
chandramohan_murkute wrote:
Can you please share the sample code to achive following using annotations.
public class Person {
   private String id;
   private Person parent;
   private Collection<Person> childs;
}