-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: relation
PostPosted: Tue Nov 29, 2011 12:23 pm 
Newbie

Joined: Tue Nov 22, 2011 6:49 am
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: relation
PostPosted: Wed Nov 30, 2011 7:46 am 
Newbie

Joined: Thu Jan 27, 2011 10:53 am
Posts: 12
Hi,
Adding your mapping will be usefull to help you.
Sounds like you have a join table (i.e. Master_Detail).
Modifying your config to have hibernate logging sql will be of great help too.
Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.