title: JPA - Persisting a Unidirectional One to Many relationship fails with EclipseLink
body: <p>I'm trying to persist a very simple Unidirectional One to Many relationship, but EclipseLink (2.3.1) fails.</p>
  
  <p>Service Class (Parent):</p>
  
  <pre><code>@Entity
  @Table(name = "tbl_service2")
  public class Service implements Serializable {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name="service_id")
      public long serviceID;
  
      @Column(name="name")
      public String name;
  
      @OneToMany(cascade={CascadeType.ALL})
      @JoinColumn(name="service_id", referencedColumnName="service_id")
      public Set&lt;Parameter&gt; parameters;
  }
  </code></pre>
  
  <p>Parameter Class (Child):<br>
  (Of course there is "service_id" foreign key field in the database, which is not represented in the class, as it's unidirectional relation).</p>
  
  <pre><code>@Entity
  @Table(name = "tbl_service_parameters2")
  public class Parameter implements Serializable {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name="param_id")
      public long parameterID;
  
      @Column(name="name")
      public String name;
  }
  </code></pre>
  
  <p>And this is the code for Entity persistence:</p>
  
  <pre><code>    Service service = new Service();
      service.parameters = new HashSet&lt;Parameter&gt;();
      service.name = "test";
      Parameter param = new Parameter();
      param.name = "test";
      service.parameters.add(param);
      em.persist(service);
      em.flush();
  </code></pre>
  
  <p>I get this exception:</p>
  
  <pre><code>Internal Exception: java.sql.SQLException: Field 'service_id' doesn't have a default value
  Error Code: 1364
  Call: INSERT INTO tbl_service_parameters2 (name) VALUES (?)
      bind =&gt; [test]
  </code></pre>
  
  <p><strong>EDIT:</strong> The database field <code>service_id</code> has (and should have) not-null constraint, due the nature of the data.</p>
  
  <p>Is this a bug or is something wrong in the code? </p>