Not sure if @Basic(optional = false) should have an effect on nullability, but OTOH I’d suggest to use @Column(nullable = false) to control null constraints.