title: CDI Injection in Hibernate Entities
body: <p>We are using CDI(JSR 299) in our application (JSF2/Seam3.0/Hibernate 3.5.6/GlassFish 3.1.1)</p>
  
  <p>While we are unable to inject resources(Helper POJOs) in our managed beans using @Inject, we cannot do the same in our Hibernate Entity classes.</p>
  
  <p>We have a base entity class(@MappedSuperclass) that all entity objects derive from. CDI injection fails in both classes.</p>
  
  <pre><code>@MappedSuperclass
  public class BaseBusinessObject implements Serializable
  {     
      @Inject
      private TestClass testClass; //FAILS
  }
  
  
  @Entity
  @NamedQueries({ @NamedQuery(name = "Account.findAll", query = "SELECT b FROM Account b") })
  @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
  public class Account extends BaseBusinessObject
  {
      @Inject
      private TestClass testClass; //FAILS
  
  }
  </code></pre>
  
  <p>It seems like it may be a limitation with CDI. Can anyone confirm whether CDI works with Hibernate entities. </p>
  
  <p>Any inputs would be appreciated.</p>
  
  <p>Thanks &amp; Regards </p>