title: not-null property references a null or transient value in one to one relation
body: <p>After migrating from hibernate 5.1 to hibernate 5.4, my application is giving this exception:  <strong>org.hibernate.PropertyValueException</strong>: <strong>not-null property references a null or transient value</strong> : com.vermeg.apps.myJpaProject.Contract.customer</p>
  
  <ul>
  <li><strong><em>Application.java</em></strong></li>
  </ul>
  
  <pre><code>public class Application {
  
      public static void main(String[] args) {
          final EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("com.mydb.ds");
          final EntityManager entityManager = entityManagerFactory.createEntityManager();
          Customer customer = entityManager.find(Customer.class, new Integer(1));
          customer.setLastName("Chemek");
          Contract contract = new Contract();
          contract.setContractType("type1");
          contract.setCustomer(customer);
          customer.setContract(contract);
          entityManager.getTransaction().begin();
          entityManager.merge(customer);
          entityManager.getTransaction().commit();
      }
  }
  </code></pre>
  
  <ul>
  <li><strong><em>Customer.java</em></strong></li>
  </ul>
  
  <pre><code>@Entity
  @Inheritance(strategy = InheritanceType.JOINED)
  public class Customer {
  
     @Id
     @GeneratedValue
     private Integer id;
  
     private String firstName;
  
     private String lastName;
  
     @OneToOne(fetch = FetchType.LAZY, optional = true, cascade = CascadeType.ALL)
     @JoinColumns({ @JoinColumn(name = "contract_id", referencedColumnName = "id", unique = false, nullable = true) })
     private Contract contract;
  }
  </code></pre>
  
  <ul>
  <li><strong><em>Contract.java</em></strong></li>
  </ul>
  
  <pre><code>@Entity
  @Inheritance(strategy = InheritanceType.JOINED)
  public class Contract {
      @Id
      @GeneratedValue
      private Integer id;
  
      private String contractType;
  
      @OneToOne(fetch = FetchType.LAZY, optional = false, mappedBy = "contract")
      private Customer customer;
  }
  </code></pre>
  
  <ul>
  <li><strong><em>Exception</em></strong></li>
  </ul>
  
  <pre><code> org.hibernate.PropertyValueException: not-null property references a null or transient value : com.vermeg.apps.myJpaProject.Contract.customer
      at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
      at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
      at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
      at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:813)
      at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:776)
      at org.hibernate.engine.spi.CascadingActions$6.cascade(CascadingActions.java:261)
      at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:492)
      at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:416)
      at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:218)
      at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:151)
      at org.hibernate.event.internal.DefaultMergeEventListener.cascadeOnMerge(DefaultMergeEventListener.java:519)
      at org.hibernate.event.internal.DefaultMergeEventListener.entityIsPersistent(DefaultMergeEventListener.java:204)
      at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:178)
      at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:70)
      at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:102)
      at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:783)
      at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:770)
      at com.vermeg.apps.myJpaProject.Application.main(Application.java:19)
  Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value : com.vermeg.apps.myJpaProject.Contract.customer
      at org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:111)
      at org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:55)
  </code></pre>