title: How to get SingularAttribute mapped value of a persistent object?
body: <p>I have a persistent object (Action) and auto generated data model (Action_). By having an object of Action class and an instance of SingularAttribute, is it possible to get the field corresponding to the given SingularAttribute?</p>
  
  <p>I need a function like this:</p>
  
  <pre><code>public S getValue(T object,SingularAttribute&lt;T,S&gt; attribute);
  </code></pre>
  
  <p>My entity class (Action.java):</p>
  
  <pre><code>@Entity
  @Table(name="ACTION")
  public class Action implements Serializable {
      private long id;
      private String name;
  
      public Action() {
      }
  
  
      @Id
      @Column(unique=true, nullable=false, precision=6)
      public long getId() {
          return this.id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
  
      @Column(length=50)
      public String getName() {
          return this.name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  }
  </code></pre>
  
  <p>My meta model class (Action_.java):</p>
  
  <pre><code>@StaticMetamodel(Action.class)
  public class Action_ {
      public static volatile SingularAttribute&lt;Action, Long&gt; id;
      public static volatile SingularAttribute&lt;Action, String&gt; name;
  }
  </code></pre>