title: hibernate: exception when saving an entity without a foreign key
body: <p>I am trying to create an entity in the database, without a foreign key, and update the foreign key at a later stage.</p>
  
  <pre><code>@Entity
  public class Business {
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      private int businessId;
  
      @Column
      private String businessName;
  
      @ManyToOne()
      @JoinColumn(name="billTypeId", nullable=true)
      @NotFound(action=NotFoundAction.IGNORE)
      private BillType billType;
  
      // getters and setters
  }
  </code></pre>
  
  <p>The billType attribute has a null value and I am getting the following exception:</p>
  
  <pre><code>Caused by: java.sql.SQLIntegrityConstraintViolationException: (conn:54) 
  Column 'billTypeId' cannot be null
  at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:152)
  at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:118)
  </code></pre>
  
  <p>How can I persist the business Object and have a zero value in the billTypeId field, when the billType member is null</p>