Hello!
Simple question:
I have two tables, table1 and table2.
table1 has one column table2id.
Now I want to create a new entry in table1.
Table1 t1 = new Table1();
Table2 just holds a status:
Table2 t2 = new Table2(); t2.setId(1);
t1.setTable2(t2);
...save...
Well, sometimes this scenario works, sometimes not. In my case it just works for table id 1. If I set t2 to id 0 i get an exception not-null property references a null or transient value: ...
How does hibernate check if the object exists ( for database integrity ). I donĀ“t want hibernate to check if it exists because a) it exists and b) there should be no additional database call for getting this second object every time.
Thanks a lot!
|