I am much new to hibernate and i am stuck at a point. I am trying to save nested object and out of those nested objects i dont want to save one object. How can i achive this? When i am running this i am getting transient exception "org.hibernate.TransientObjectException: object references an unsaved transient instance". I know i am doing something stupid whihc is not recommended by hibernate. Please help.
Scenario: A, B, C, D are four diffrent tables.
Table A ( field1, field2 , field3[fk to table B]) Table B ( field3, field4 , field5 [fk to table C]) Table C ( field5, field7 , field8) Table D ( field6, field9 , field3[fk to table B])
Objects
A private String field1; private String field2; @OneToOne(cascade=CascadeType.ALL) @JoinColumn(name="field3") private B b; B private String field3; private String field4; /*Want to save D*/ @OneToOne(cascade=CascadeType.ALL) @JoinColumn(name="field3") private List<D> d; // This is a list of D /*Dont want to save C*/ @OneToOne @JoinColumn(name="field5") private C c; C private String field5; private String field7; private String field8; D private String field6; private String field9; private String field3;
Thanks Ashish
|