title: Field 'PlayerID' doesn't have a default value
body: <p>I have two classes, <code>Player</code> and <code>PlayerGoalsPrediction</code>.</p>
  <p>Requests are sent in, from the frontend, containing a <code>playerID</code> and <code>goals</code> value. The <code>playerID</code> is used to find the <code>Player</code> using the <code>playerRepository</code> and then the <code>Player</code> object is used in the constructor of a <code>PlayerGoalsPrediction</code>, along with the <code>goals</code>.</p>
  <p>However, when save the object to the db, an error (<code>java.sql.SQLException: Field 'PlayerID' doesn't have a default value</code>) is returned.</p>
  <p>I assume it must be coming from the <code>PlayerGoalsPrediction.player</code> attribute, but that object does have a <code>playerID</code> value assigned to it, so I am unsure where the issue is coming from?</p>
  <p><em>Player.java</em></p>
  <pre><code>@Entity
  @Table(name = &quot;Players&quot;)
  public class Player {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = &quot;PlayerID&quot;)
      private long playerID;
      
      @Column(name = &quot;Name&quot;)
      private String name;
  
      @OneToMany(
          targetEntity=PlayerGoalsPrediction.class,
          fetch=FetchType.LAZY,
          mappedBy=&quot;player&quot;
      )
      private List&lt;PlayerGoalsPrediction&gt; predictions;
  
      // constructors, getters and setters
  }
  </code></pre>
  <p><em>PlayerGoalsPrediction.java</em></p>
  <pre><code>@Entity
  @Table(name = &quot;PlayerGoalsPredictions&quot;)
  public class PlayerGoalsPrediction {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = &quot;PlayerGoalsPredictionID&quot;)
      private long playerGoalsPredictionID;
  
      @ManyToOne(
          targetEntity=Player.class,
          fetch=FetchType.EAGER
      )
      @Column(name = &quot;PlayerID&quot;)
      private Player player;
  
      @Column(name = &quot;Goals&quot;)
      private long goals;
  
      // constructors, getters and setters
  }
  </code></pre>
  <p><em>PlayerRepository.java</em></p>
  <pre><code>@Repository
  public interface PlayerRepository extends JpaRepository&lt;Player, String&gt;{
      
      public Player findByPlayerID(long playerID);
  }
  </code></pre>
  <p><em>PlayerGoalsPredictionController.java</em></p>
  <pre><code>@CrossOrigin(origins = &quot;*&quot;)
  @RestController
  @RequestMapping(&quot;/api/v1/playergoalsprediction&quot;)
  public class PlayerGoalsPredictionController {
  
      @Autowired
      private PlayerRepository playerRepository;
  
      @Autowired
      private PlayerGoalsPredictionRepository playerGoalsPredictionRepository;
  
      @PostMapping(&quot;/postprediction&quot;)
      public void postPredictions(
              @Valid @RequestBody PlayerGoalsPredictionRequest playerGoalsPredictionRequest 
      ) {
          PlayerGoalsPrediction playerGoalsPrediction = new PlayerGoalsPrediction(
              playerRepository.findByPlayerID(playerGoalsPredictionRequest.getPlayerID()),
              playerGoalsPredictionRequest.getGoals()
          );
          playerGoalsPredictionRepository.save(playerGoalsPrediction);
      }
  }
  </code></pre>