2 Replies Latest reply on Dec 3, 2007 12:15 PM by Jason Long

    how to make a ejbql query from an entity bean ?

    Vincent LAUGIER Newbie

      Hello,

      I would like to perform ejbql queries from the entity beans. This way I could customize my getters and add some very handy transient methods.

      Is there a way to do this ?

      I have tries to declare an entityManager in the different fashion :

      @PersistenceContext
      EntityManager em;


      @PersistenceContext(type=EXTENDED)
      EntityManager em;

      @In
      EntityManager em;


      But I get

      Caused by: java.lang.IllegalArgumentException: @PersistenceContext may only be used on session bean or message driven bean components: employee
      


      Does anyone has ever managed to do this ?

      regards

      Vincent