Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the difference between importing a POJO and injecting an EJB?

 
J Nix
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I was attempting to create a Dynamic Web Project in eclipse I received some notifications in eclipse telling me that I had to not only reference the EJB in the build but import that EJB package in addition to the @EJB dependency injection I used.

Can anyone help me clarify why all three are needed and what exactly is going on. The reason I ask is because to me importing the EJB package alone would be enough to put the EJB class in scope of the calling class, and this indicates that I do not yet have a clear understanding of what JEE6 is trying to achieve with annotations.

Thank you,
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The basic difference between import and injection is, compile time checking for the methods, types which are referenced in our java class from some package and injection does create property/object/methods dynamically from the annotation implemented java class.
If anyone have better ideas, you welcome to share with us. Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic