0 Replies Latest reply on Oct 17, 2014 4:17 PM by firepod

    Title: How do I inject CDI beans into Custom Entity Classes?

    firepod Newbie

      We use Cassandra (and the DataStax driver) to store our entities. As such we have a custom entity service that creates new instances of our entity classes when it retrieves data from Cassandra.



      I also need to inject services into my entity classes using CDI. How do I do this? When I simply at the @Inject annotation, it never gets injected.


      public class Customer{
          private Event<DeactivationEvent> events;
          private String uid;
          public void setUid(String uid){
              this.uid = uid;
          public String getUid(){
              return this.uid;
          public void deactivate(){
              events.fire( new DeactivationEvent() );
      public CassandraEntityService{
          public Customer findCustomer(String uid){
              ...whatever lookup logic...
              Customer customer = new Customer();
              return customer;