-->
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: Null objects
PostPosted: Fri Jan 23, 2004 1:57 pm 
Newbie

Joined: Fri Sep 26, 2003 4:29 pm
Posts: 16
Hi,

I'm currently working on a project using Hibernate and have come across a problem that it's not obvious (to me at least) what the best solution is, and I'd like other people's feedback as to what they think.

I'm using tapestry as the web framework in this application. It uses Ognl a lot to traverse object trees. Eg, the expression,

ognl:visit.assayPlate.assayJob.jobName

would access the jobName attribute within the AssayJob object referenced by the AssayPlate object. The problem comes with what happens when the assayJob object is null. By default, Ognl throws a runtime exception which is caught and rethrown by Tapestry.

Obviously this problem could be solved at any of the three places,

i) Ognl dealing with it different.
ii) Tapestry dealing with it different.
iii) Somehow being able to set a default, or NullObject, within each class mapping of the ORM. This solution is, of course, why I'm bringing this up here. I can see some obvious problem (like how to define NullObjects in all cases) and I'm sure there's some other non-obvious problems I haven't seen.

As I said, I don't know what the best solution is here. All involve doing something out of normal for special cases. Anyone have any opinions?

Jonny


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 10:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You could use a custom type for the NullObject. I'm not sure how its going to provide the approrpiate graph of objects for OGNL to traverse.


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.