title: JPA entity with join column but not persisted
body: <p>I have to entities</p>
  <pre><code>    @Table(name = &quot;BD_PERSON&quot;)
      public class DBPerson {
        @Id
        @Column(name = &quot;persion_id&quot;)
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private Long id;
        
        @Column(name = &quot;name&quot;)
        private String name;
      
        @Column(name = &quot;car_id&quot;)
        private Long car_id;
      
        @OneToOne(cascade = CascadeType.ALL)
        @JoinColumn(name = &quot;car_id&quot;, referencedColumnName = &quot;car_id&quot;, insertable = false, updatable = false)
        private DBCar car;
      
        @Column(name = &quot;label&quot;)
        private String label;
  </code></pre>
  <p>and</p>
  <pre><code>@Table(name = &quot;BD_CAR&quot;)
  public class DBCar {
    @Id
    @Column(name = &quot;car_id&quot;)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
  
    @Column(name = &quot;car_number&quot;)
    private Integer carNumber;
  
    @Column(name = &quot;description&quot;)
    private String description;
  </code></pre>
  <p>I want to be able to get the Person with the car entity but this should not persist to the database when updating.
  But i should be able to update the car_id by itself as it relates the the id in the car table.</p>
  <p>but when i try to test this by setting only the car_id i receive an Referential integrity constraint violation.
  Because the car_id (FK)references the car_id (PK)
  Is there any better way to accomplish what im trying to do?
  The database already exists and is configured like this where the car_id is not an actual foreign key</p>