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
|