title: Lazy fetching OneToMany collection throws NPE in Collections.processReachableCollection when referenced column is null
body: <p>I have a problem with lazy loading when in a one to many unidirectional mapping the referenced column is null. Here is my &quot;dummy&quot; code example:</p>
  <pre class="lang-java prettyprint-override"><code>public class A {
  
      @Column(name = &quot;id&quot;)
      private UUID id;
  
      @Column(name = &quot;b_reference&quot;)
      private UUID bReference;
      
      @OneToMany
      @JoinColumn(name = &quot;b_id&quot;, referencedColumnName = &quot;b_reference&quot;, insertable = false, updatable = false)
      private List&lt;B&gt; bList;
  }
  
  public class B {
  
      @Column(name = &quot;id&quot;)
      private UUID id;
  
      @Column(name = &quot;b_id&quot;)
      private UUID bId;
  
  }
  </code></pre>
  <p>With eager loading, everything works fine, but I have too many entries so it really affects the performance.</p>
  <p>I am working with the latest quarkus version (2.7.1 - also tried with 2.31) and in order to test this I also wrote just a simple named query:
  <code>@NamedQuery(name = A.FIND, query = &quot;SELECT a FROM A a&quot;)</code>.</p>
  <pre><code>org.hibernate.resource.transaction.backend.jta.internal.synchronization.RegisteredSynchronization@4699241e &gt;: java.lang.NullPointerException
      at org.hibernate.engine.internal.Collections.processReachableCollection(Collections.java:149)
      at org.hibernate.event.internal.FlushVisitor.processCollection(FlushVisitor.java:53)
      at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:104)
      at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:65)
      at org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:59)
      at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:183)
      at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
      at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:229)
      at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:93)
      at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
      at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
      at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1402)
      at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:493)
      at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3285)
      at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2420)
      at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:449)
      at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl.beforeCompletion(JtaTransactionCoordinatorImpl.java:356)
      at org.hibernate.resource.transaction.backend.jta.internal.synchronization.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:47)
      at org.hibernate.resource.transaction.backend.jta.internal.synchronization.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:37)
      at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
      at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:360)
      at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
      at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
      at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1295)
      at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:128)
      at io.quarkus.narayana.jta.runtime.CDIDelegatingTransactionManager.commit(CDIDelegatingTransactionManager.java:105)
      at io.quarkus.narayana.jta.runtime.CDIDelegatingTransactionManager_Subclass.commit$$superforward1(Unknown Source)
      at io.quarkus.narayana.jta.runtime.CDIDelegatingTransactionManager_Subclass$$function$$6.apply(Unknown Source)
      at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
      at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
      at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:49)
      at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(Unknown Source)
      at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
      at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
      at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
      at io.quarkus.narayana.jta.runtime.CDIDelegatingTransactionManager_Subclass.commit(Unknown Source)
      at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.endTransaction(TransactionalInterceptorBase.java:365)
      at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:165)
      at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:103)
      at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequiresNew.doIntercept(TransactionalInterceptorRequiresNew.java:41)
      at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:57)
      at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequiresNew.intercept(TransactionalInterceptorRequiresNew.java:32)
      at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequiresNew_Bean.intercept(Unknown Source)
      at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
      at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
      at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
  </code></pre>