-->
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.  [ 4 posts ] 
Author Message
 Post subject: Null child table
PostPosted: Sun Feb 18, 2007 12:40 pm 
Newbie

Joined: Fri Jan 26, 2007 2:35 pm
Posts: 4
Hello All ,


I am new to Hibernate so this might sound like a stupid question but here is goes.
I have 2 tables table A and B. A is the parent to B. A has field called
b_id. which is the Key to my B table. My problem is when I query table A and table
B does not have a record entered into yet I get a null pointer exception. But If table
B does a record that table A can point to all is well. Is there any way around this problem.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 18, 2007 12:46 pm 
Regular
Regular

Joined: Sun Sep 17, 2006 2:48 am
Posts: 81
Location: California
If A is parent of B, then do you really need a bId column in A. aId column in B is what you will need to make the reference.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 18, 2007 2:43 pm 
Newbie

Joined: Fri Jan 26, 2007 2:35 pm
Posts: 4
My bad I do have a Link from B to A. But In my A config I have a one to many that
points to B. If B is NULL I get a java null pointer exception. If there is record in table
B every thing works great. Where should I check for null record in My Bean or DAO or ?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 18, 2007 3:37 pm 
Regular
Regular

Joined: Sun Sep 17, 2006 2:48 am
Posts: 81
Location: California
Please post the config files for A and B as well as the DAO/relevant java codes, and also point out where are you getting the NPE.

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.