5 Replies Latest reply on Oct 27, 2005 8:00 AM by mihai_lihatchi

    javax.ejb.Inject

    mfornarisc

      Hi there,
      I was following a tutorial at http://trailblazer.demo.jboss.com/IDETrail/ejb3/index.html and everything when great until I have to decalre a private attribute with the annotation @Inject.

      I cannot find the Inject implementation since the package javax.ejb.* doesn't contain it.

      Can someone tell what I'm missing? I have JRE 1.5.0_05 within Eclipse, and I was pretending to test the demo application in JBoss.

      Thank you very much,
      Michel Fornaris

        • 1. Re: javax.ejb.Inject
          mistamoasn

          if you want to inject the entitymanager use:

          @PersistenceContext (name="yourDS")
          private EntityManager em;

          inject is no longer available...

          • 2. Re: javax.ejb.Inject
            mfornarisc

            Cool, thanks!

            • 3. Re: javax.ejb.Inject
              mihai_lihatchi


              > I have the same problem. The thing is that I do not understand what should I do .. define a new datasource for the Entity Manager ?
              > The trailblazer does not make any further reference to the persistence API ... I should create a -ds.xml file and a database for it myself ?
              > I will try but the demo than looses it's purpose to explain you how to get started since you have to use another editor to make the authors-ds.xml file.
              > Thank you

              • 4. Re: javax.ejb.Inject
                mihai_lihatchi

                I have another issue . I have developed everything deployed it.
                I have discovered that there is no way I can load the SessionBean Authors in the servlet.
                ClassNotFoundError.
                What have I done wrong ?
                The @Inject is to blame ?(Replaced it with PersistenceContext as advised)

                • 5. Re: javax.ejb.Inject
                  mihai_lihatchi

                  Fixed it .. it was a packaging error of the ejb3 bean . I tried to play around with packages ... my fault.
                  I should mention that I jumped to EJB3 without any prior EJB2 knowledge because it seams a lot simpler (no service locators) .
                  Hope that Sun certifies EJB3 soon .