Hi there,
I'm trying to deal with an issue that maybe some of you have run into, but I can't seem to find any previous forum discussions on the subject.
For the record this is using 2.1.4 on Oracle 8i.
My basic architecture is this:
I have a class called Channel which has a collection of Admins mapped as such:
Code:
<set name="admins" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="CHANNEL_ID"/>
<one-to-many class="foo.Admin"/>
</set>
In turn, each Admin object has an Employee object:
Code:
<many-to-one
name="employee"
column="EMPLID"
class="foo.Employee"/>
The Employee object is mapped to a materialized view of all the
active employees in the company. This view gets refreshed nightly by a DB job, and employees that have been terminated disappear. Thus, I can't guarantee that an Employee exists for an Admin.
My problem is that when I load the Channel (which loads the collection of Admins), I get an UnresolvableObjectException, which is understandable.
My question is, how does one best handle this situation? I can't guarantee the consistency of Employee data, so should I write a custom type for Employee? Should I delve into the mysterious of the Lifecycle and Interceptor interfaces? Should I catch the exception, and if so, what do I do then -- will it just load a null object?
Any advice is appreciated. I'd be happy to share more code but I don't want to cloud the issue in a huge stack trace. Thanks in advance, Dolan