I have parent and child entries in same table, For differentiate i have added one column which have parent id.
description of table as below
create table temp(id bigint(20) PK,name varchar(50),parent_id bigint(20) references temp(id));
for Ex..
id | name | parent_id
------------------------
1 | text1 | null
2 | text1.1 | 1
3 | text1.2 | 1
How do i maintain this table with hibernate save / saveOrUpdate ?
When i m going to save records in this table it has ID as auto generated so at the time of save i would get parent_id = 0 instead of actual ID.
Please give some needful Answers..
You can use hibernate annotation here Supose i have two entity Question and Answer.
Now you can set Answer before actually creating question like :