title: insert record with JPA having a field as an foreign key to another table
body: <p>I am trying to insert data into a table and one of the fields is an FK to a different table. The problem is that using JPA and Criteria to perform the operations I would like to avoid having to fill out the entire child object to do so. 
  Example:</p>
  
  <pre><code>@ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name="SENSOR_ID", nullable=false, updatable=false)
  private Sensor sensor;
  
  public Sensor getSensor() {
      return sensor;
  }
  
  public void setSensor(Sensor sensor) {
      this.sensor = sensor;
  }
  
  em.getTransaction().begin();
  Measure m = new Measure();
  
  m.setDeformation(measure.getDeformation());
  m.setMoment(timestamp);
  m.setTemperature(measure.getTemperature());
  m.setTension(measure.getTension());
  m.setSensorId(measure.getSensorId()); // I would like to do it like this and not having to use m.setSensor();
  
  em.persist(m);
  </code></pre>