title: Unidirectional @OneToOne with reversed foreign key
body: <p>We'd like to create unidirectional <code>@OneToOne</code> mapping with foreign key that is not in the master table, but in the slave. By providing following java code, Hibernate tries to find column <code>product_ID</code> in the table <code>product</code> but not in <code>productimage</code>. Is it possible to make it working with the only modifications to annotations?</p>
  
  <p>All unnecessary fields and columns have been stripped from the example.</p>
  
  <p>JPA entities:</p>
  
  <pre><code>@Entity
  public class Product {
  
      @Id
      @Column(name = "ID", unique = true)
      private String id;
  
      // this doesn't work
      @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
      @JoinColumn(name = "product_ID", nullable = false)
      private ProductImage productImage;
  
      // this works, but we want one-to-one
      // @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
      // @JoinColumn(name = "product_ID", nullable = false)
      // private List&lt;ProductImage&gt; productImages;
  
      // getters/setters omitted
  }
  
  @Entity
  public class ProductImage {
  
      @Id
      @Column(name = "ID", unique = true)
      private String id;
  
      @Column
      @Lob
      private Blob data;
  
      // getters/setters omitted
  }
  </code></pre>
  
  <p>Database tables:</p>
  
  <pre><code>CREATE TABLE `product` (
    `ID` varchar(255) NOT NULL,
    PRIMARY KEY (`ID`)
  )
  
  CREATE TABLE `productimage` (
    `ID` varchar(255) NOT NULL,
    `data` longblob NOT NULL,
    `product_ID` varchar(255) NOT NULL,
    PRIMARY KEY (`ID`),
    KEY `FK_123` (`product_ID`),
    CONSTRAINT `FK_123` FOREIGN KEY (`product_ID`) REFERENCES `product` (`ID`)
  )
  </code></pre>