title: OJB Reference Descriptor 1:0 relationship? Should I set auto-retrieve to false?
body: <p>I am having an issue while using <a href="http://db.apache.org/ojb/" rel="nofollow noreferrer">Apache OJB</a> with Spring 2 inside my web app. </p>
  
  <p>I'm using OJB reference-descriptor with 2 foreign key properties. I have an object A (parent) and object B (referenced object).  The thing is, for an object A, there may or may not be an object B.</p>
  
  <p>In the case where there is no object B to go with Object A, the object B seems to be instantiated (through Spring?) anyways.  However, I am unable to access object B's members.  </p>
  
  <p>Whenever I test if Object B == null, it always returns false even though there is no matching value in the database.</p>
  
  <p>Since this Object is never null, I figured I can test the object's member like so:</p>
  
  <p>if( objectb.getDocumentNumber == null) { return false; }</p>
  
  <p>However, I get an exception in the jsp: </p>
  
  <pre><code>javax.servlet.jsp.el.ELException: An error occurred while getting property
  "documentNumber" from an instance class
  org.sample.pojo.Objectb$$EnhancerByCGLIB$$78022a2
  </code></pre>
  
  <p>and this exception in the debugger when it's creating the objectB:</p>
  
  <pre><code>com.sun.jdi.InvocationException occurred invoking method.
  </code></pre>
  
  <p>I am guessing that the reference-descriptor must be a 1:1+ relationship, instead of a 1:0+
  relationship.  I was wondering if I should set the property 'auto-retrieve' to false, and then use the PersistenceBroker.retrieveAllReferences(Object obj); method as directed.  However, this method's return value is 'void', so I am guessing that Spring somehow creates, and sets the reference class for me.  (Returning me back to the same issue I'm having.)</p>
  
  <p>I will need a way to test whether the reference object exists first.  If not, don't call this retrieveAllReferences method, but I don't see how.</p>
  
  <p>Am I going about this all wrong?  Does reference-descriptor not allow 1:0 relations?
  Any work around to my problem?</p>
  
  <p>Your suggestions are greatly appreciated!</p>