Hello,

I am using almost fresh OJB head and the ODMG API.

I am still concerned how Proxies can be used in case 
null references are allowed and frequent.  In our object model,
there are proxied references which are often null.

This causes the following (ugly) warning message when the object is
read from the database.

15:11:13,278 WARN  [main      ] DEFAULT - OJB broker could not materialize
...{0}

Among other problems, this causes the following exception 
when lock(..) is applied to an object that has previously 
been read from the database:

java.lang.NullPointerException
        at
org.apache.ojb.odmg.TransactionImpl.assertFkAssignment(TransactionImpl.java:
812)
        at
org.apache.ojb.odmg.TransactionImpl.assignReferenceFKs(TransactionImpl.java:
853)
        at
org.apache.ojb.odmg.TransactionImpl.lock(TransactionImpl.java:260)

The code fragment (TransactionImpl) is:

  ... 
  else if (ref instanceof Proxy)
  {
    IndirectionHandler ih = (IndirectionHandler)
Proxy.getInvocationHandler(ref);
    refInstance = ih.getRealSubject();  // in my case, refInstance is null
now.  Olli
  }
  ClassDescriptor refCld =
this.getBroker().getClassDescriptor(refInstance.getClass());

I would write a test case for that, but in the OJB JUnit database 
this situation cannot be reproduced because there is a foreign key
constraint for 
all proxied references.


Olli



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

Reply via email to