title: Changing Generated Hibernate Foreign key in @OnetoOne shared primary key scenario
body: <p>I am using Hibernate as my ORM in a JEE6 project run on a JBOSS Server with MySql database.
  In my project for every Data element there will be detail element. And for this I have created a bidirectional one to one relationship with shared primary key as below. </p>
  
  <pre><code>    @Entity
      @Table(name="DATA", schema = "TEST")
      public class Data implements Serializable {
      ....
      .....
      @OneToOne(fetch = FetchType.LAZY, mappedBy = "data", cascade = CascadeType.ALL)
          public Details getDetails() {
              return details;
      ....
      }
  
  
  @Entity
  @Table(name = "DETAILS", schema = "TEST")
  public class Details implements Serializable {
  ...
  ...
  @GenericGenerator(name = "generator", strategy = "foreign", parameters = { @org.hibernate.annotations.Parameter(name = "property", value = "data") })
      @Id
      @GeneratedValue(generator = "generator")
      @Column(name = "DETAILS_ID", nullable=false)
      @Index(name="DETAILS_ID")
      @ForeignKey(name = "FK_DATA_ID")
      public Long getDetailsId() {
          return detailsId;
      }
  
      @OneToOne
      @PrimaryKeyJoinColumn(name = "DETAILS_ID", referencedColumnName = "DATA_ID")
      public Data getData() {
          return data;
      }
  ...
  }
  </code></pre>
  
  <p>Even after mentioning @ForeignKey it generates an ugly foreign key constraint like below </p>
  
  <pre><code>alter table TEST.DETAILS add constraint FK9FDD7BA22964C454 foreign key (DETAILS_ID) references TEST.DATA
  </code></pre>
  
  <p>How do I create a clean foreign key constraint in such scenario? I need to create a foreign key constraint with name 'FK_DATA_ID'. </p>