posted 14 years ago
I have this scenario, where i have three tables.
TABLE A has a_id (PK)
TABLE B has b_id (PK), c_id (FK), a_id (FK)
TABLE C has c_id (PK)
I am using JPA , now in Object terms, if i define the relationships, it is like
Now, if want to have class B as self referencing class, i.e If the Object of B will have an extra property of parentId, which refers to the different B object, then how to achieve that and code sample of how can i persist A object with all the relationships set to it directly by calling entityManager.saveobject(a);
example
A object contains collection of B objects which are say b1, b2, b3 and b2 and b3 object in that collection has parentId set as b1_id.
I want to save Object A such that all the records of B also gets saved normally without giving any transaction exception of transient object not being saved.
If anyone of you here can help me out in this, this will be really a great help.
regards
Akhil.
-------------------------------<br />you can't move ahead, unless you try for it.