title: JPA OneToOne unidirectional mapping
body: <p>I have 2 entities : Field and ViewOptions</p>
  
  <p>fields and methods not related to the problem are omitted</p>
  
  <p>Table structure:</p>
  
  <pre><code>CREATE TABLE FIELD (
    ID                   INT          NOT NULL AUTO_INCREMENT,
    PRIMARY KEY (ID),
  );
  
  CREATE TABLE VIEW_OPTIONS (
    ID                INT         NOT NULL AUTO_INCREMENT,
    FIELD_ID INT         NOT NULL,  
    PRIMARY KEY (ID),
    INDEX (FIELD_ID ASC),
    CONSTRAINT
    FOREIGN KEY (FIELD_ID)
    REFERENCES FIELD (ID)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION);
  </code></pre>
  
  <p>Mapping:</p>
  
  <pre><code>@Table(name = "FIELD")
  @Entity
  public class Field {
      @OneToOne(mappedBy ="field")
       ViewOptions viewOptions;
  
  @Table(name = "VIEW_OPTIONS")
  @Entity
  public class ViewOptions  {
      @OneToOne
      @JoinColumn(name = "FIELD_ID")
      Field field;
  </code></pre>
  
  <p>In this relation the owner side is ViewOptions and the inverse side is Field.
  What i want to do is to swap sides - make Field the owner side. 
  But if i mark  viewOptions like this </p>
  
  <pre><code> @OneToOne
   @JoinColumn(name = "FIELD_ID")
   ViewOptions viewOptions;
  </code></pre>
  
  <p>Hibernate expecting join column in Field table. </p>
  
  <p>Is there any way to tell hibernate to search for join column in VIEW_OPTIONS?</p>