Proxy null poiter exception with bad references

Martin Heyer <[email protected]>
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
Hello Ojb-Users.

I have a Cocoon + OJB installation running. For performance reasons
there is a dynamic Proxy configured with class B.
For example let's have two classes A and B:

Class A: (has no proxy)
- uid
- link  -> points to uid of class B
- B (foreign key, holds the instance of B associated with link)

Class B: (has a proxy)
- uid
- data

Everything works fine without the proxy. But when proxy is turned on and
A points to an ID that has no B in the DB, it throws a NPE:

...
Caused by: org.apache.ojb.broker.PersistenceBrokerException: Error
invoking method getIndirectionHandler
        at
org.apache.ojb.broker.core.proxy.AbstractIndirectionHandler.invoke(AbstractIndirectionHandler.java:363)
        at $Proxy29.getIndirectionHandler(Unknown Source)
        ... 61 more
Caused by: java.lang.NullPointerException
        at
org.apache.ojb.broker.core.proxy.AbstractIndirectionHandler.invoke(AbstractIndirectionHandler.java:347)
        ... 62 more

Is there a way to catch this? I can load A so it has a proxy instance of
B associated with it. ATM there is no way for me to know if the proxy
will find a real object of B. When I access this reference, it crashes..

I really would appreciate help,

Martin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.