Hello Wally,

> From: Gelhar, Wallace J. [mailto:[EMAIL PROTECTED]]

> The proxy is used to defer instantiation of the real object 
> until needed.  If you load the object to determine that it is 
> null, you have defeated the purpose of the proxy.
> 
> How would you propose to modify the pattern?

I would like the reference to be null, no matter it is 
configured to be a proxy or not.  Then I can test 
the reference for null before I access the object,
and this works transparently.

If this is at all impossible, then I would
appreciate an API-method isNull(Object obj) 
that returns true iff  
either obj == null or obj is a Proxy that wraps a null.

Without such a method, I will have to catch the 
NullPointerException when I access the object.
Or is there another trick?

Olli


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 

> In short: Is is intended that a null-reference
> is wrapped by a proxy?
> 
> It is unconvenient for several reasons.  It
> particular, proxies are not as transparent
> as they could be.

> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]

> > I have observed the following behaviour in OJB 0.9.9 and just
> > wanted to verify that it is intended this way.
> > 
> > I have classes A and B, and A references B.  (The primary key
> > of B is of type
> > long, which is mapped to jdbc type NUMERIC.)
> > 
> > When I retrieve an A instance from the database and the
> > respective foreign key column has as 0 in it, 
> > the B reference is null.  So far, everything is great.
> > 
> > But when I configure class B (or, alternatively the
> > B-reference inside A) 
> > as dyamic proxy, the reference is not null, but rather a 
> > dynamic proxy that references a null.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to