Dear all
I have problem when I want to store data in two tables which have Master-Detail relation (I mean 1 to many relation). I program in this way :
IMasterDao masterDao = RemixDaoFactory.getMasterDao(); IDetailDao detailDao = RemixDaoFactory.getDetailDao(); Master master = masterDao.findMasterById("1"); Detail detail = new Detail(); detail.setDetailName("detail"); detail.setMaster(master);
detailDao.createDetail(detail);
As you see in the red line, I set the relation between two tables. So I don't know why I get an error saying that the foreign key in the Detail table is null. It seems that setMaster method does not work. Any idea?
Thanks, Arman
|