We are using CDI(JSR 299) in our application (JSF2/Seam3.0/Hibernate 3.5.6/GlassFish 3.1.1)
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.
We have a base entity class(@MappedSuperclass) that all entity objects derive from. CDI injection fails in both classes.
@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
}
It seems like it may be a limitation with CDI. Can anyone confirm whether CDI works with Hibernate entities.
Any inputs would be appreciated.
Thanks & Regards