title: Using JPA metamodel for @OneToMany mappedBy
body: <p>Could someone explain what is wrong with this and is there a workaround?</p>
  
  <pre><code>private static final String parentField = AbstractType_.parent.getName();
  @OneToMany(fetch = FetchType.EAGER, orphanRemoval = true, mappedBy = parentField)
  private List&lt;AbstractType&gt; children = new ArrayList&lt;AbstractType&gt;();
  </code></pre>
  
  <p>In eclipse, this shows and error on the @OneToMany line:<br/></p>
  
  <blockquote>
    <p>While this would be fine:
    The value for annotation attribute OneToMany.mappedBy must be a constant expression.
    <br/></p>
  </blockquote>
  
  <p>Also the Maven build fails because of this.
  <br/>
  Then again, this will work fine.</p>
  
  <pre><code>private static final String test = "";
  @OneToMany(fetch = FetchType.EAGER, orphanRemoval = true, mappedBy = test)
  private List&lt;AbstractType&gt; children = new ArrayList&lt;AbstractType&gt;();
  </code></pre>
  
  <p><br/>
  UPDATE:
  What is happening here, that I wish to get the field name via metamodel, but one can not refer to it at 'mappedBy' attribute.</p>