I have 3 tables and 2 relations:
1. One to Many from T1 to T2
2. Many to One from T2 to T3
Actually T2 is like many-to-many relationship table with specified role field. So i have 3 java classes for each table with lazy and inverse realations between them.
Next i tried this kind of code indise C1 class:
Code:
add(C3 c3) {
C2 c2 = new C2(); // create new intermediate class
c2.setC3(c3); // set both ends of the relationship, T3
c2.setC1(this); // set both ends of the relationship, T1
c2s.add(inheritance); // add to collection in the c1
c3.addC2(c2); // add to collection in the c3
}
So, all fields and collections are filled out.
Then i tried to store object c1 and c3 and i can't cause hibernate says that either c1 or c3 is "not-null property references a null or transient".
What do i have to do? Remove inverse, lazy or something else?