-->
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: many-to-one associations and jsf EL null pointer exception
PostPosted: Fri Jul 29, 2005 5:30 am 
Newbie

Joined: Thu Jul 28, 2005 12:24 pm
Posts: 7
In a jsp i use a jsf EL expression like this :

#{Employee.Department.Name}

In the database the n:1 relation between Employee and Department tables is not mandatory so previous EL expression can raise a null pointer exception because Employee.Department can be null.

This is a very frequent situation so i belive there must be a "standard" approch to solve this problem. My current solution is like this one :

Code:
if (Employee.Department == null)  {
  Employee.Department = new Department();
}


but actually i think this is a bad solution.
Is there a more elegant way to solve this problem ?

TIA

s7


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 4:25 am 
Newbie

Joined: Thu Jul 28, 2005 12:24 pm
Posts: 7
Really no one in this forum with the same problem or with a different solution ?

ssette


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.