title: How to define unidirectional OneToMany relationship in JPA
body: <p>I have a following problem with entity mapping in JPA. I have two entities, first one is Lookup and the second is Text which represents translations for entities. Now I need to bound Lookup to the Text but I don't want Text to have reference to Lookup. To make this more complicated, Text does not use its primary key in this relationship but a metacode defined in a  <code>TXTHEAD_CODE</code> column. </p>
  
  <p><code>Lookup.java</code></p>
  
  <pre><code>@Entity
  @Table(name = "DATREG")
  public class Lookup implements PersistableEntity {
  
      @Id
      @Column(name = "DATREG_META_CODE")
      private String metaCode;
  
      @OneToMany
      @JoinTable(name="TXT", 
              joinColumns=@JoinColumn(name="DATREG_META_CODE", referencedColumnName="TXTHEAD_CODE"),
              inverseJoinColumns=@JoinColumn(name="DATREG_META_CODE"))
      private List&lt;Text&gt; text;
  </code></pre>
  
  <p><code>Text.java</code></p>
  
  <pre><code>@Entity
  @Table(name = "TXT")
  public class Text {
  
      @Id
      @Column(name = "TXT_ID")
      private Long id;
  
      @Column(name = "TXTHEAD_CODE")
      private String code;
  </code></pre>
  
  <p>So I have tried this (and few other variations) but with no result. I also can't create join table in the DB and I don't want bound Lookup to my Text class. So can anyone please tell me if there is some other way?</p>