Hi Olli,

  From what I remember, if you define your primary key field(s) to be
NON-primitive (e.g. Integer instead of int) OJB can correctly set the proxy
reference to null if the primary key field was null (maybe also add
refresh="true" in the reference descriptor but I'm not sure since it's been
a while).

Hope it helps,

Tal

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 10, 2003 5:08 PM
To: [EMAIL PROTECTED]
Subject: RE: How to use Proxies, was: Re: Null References and Proxies


Hej Armin,

thank you for your answer.

> I could kick out the log statement if this
> solve your problem?

That would be an improvement, but not satisfactory:
throwing and catching exceptions is costly.

A better solution would be an API method or some other defined
way to tell whether the proxy wraps a null pointer in order
to avoid that case to happen.

Maybe this is an issue of the java proxy concept
rather than an OJB issue. I am new to proxies, but 
I wonder what other people do in this case?!

Olli

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

> > > > >In short: Is is intended that a null-reference
> > > > >is wrapped by a proxy?
> > 
> > > Suppose I want to output a.b.getMsg() 
> > > if and only if a.b != null.
> > > 
> > > if (a.b!=null)
> > > System.out.println(a.b.getMsg())
> > > 
> > > If b is proxied, however, the above will throw
> > > a NullPointerException.  So, what's the solution?
> > > (An unacceptable solution would be to allow that exception
> > > to be thrown and then catch and ignore it.)
> > 
> > That solution (catching the NullPointerException) 
> > does not work nicely, either, because the 
> > IndirectionHandler logs the stackdump as an error
> > before it re-throws it.

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

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

Reply via email to