EJB 3 is a lot easier than its previous versions. Its because you've not used it that you dont understand. Here's why(according to how you put it) :
1. Although xml is used in cofiguring servlets and jsp's, we have to remember a lot of stuff in order to write a correct web.xml file. There's a lot of stuff in that file which we could forget easily. On the other hand, annotations are dependency injections. Think of it as an import statement in your code. When you want it just inject it there. You would just have to write a single line of simple java code(which you would be much more comfortable with) rather than writing a seperate xml file for a simple import and that too, a lot of xml for a single thing. Take an example of Interceptors. Using xml, including an interceptor in your code you would have to write the following :
So, you can see how much of effort we just saved in writing a single line than 6 lines !!!
2. EJB 3 allows you to change stuff in your code without touching it at the time of deployment and packaging. This has nothing to do with Annotations.
3. Yes, that is correct. You can override a lot of stuff you specified by annotations using the DD. But, if you are using annotations, using xml is completely optional. Besides, there may be situations in which overriding is necessary(for security reasons for e.g.) andthats when you can use your beloved xml.
In a nutshell, Annotations help a lot by reducing the pain programmers have to go through remembering all those verbose commands in XML.
I hope this has cleared any doubt from your mind. Good luck with EJB3 (and Annotations!!) Keep Programming.
Annotations are used where you won't be changing the features more often. For example, when you make a stateless bean, you won't be changing it to stateful for a long period of time unless a drastic design change takes place. So it would really save your time in using annotations for mentioning a POJO as stateless. Just use @Stateless. If not for annotations, you would have to learn all the xml elements <session> <enterprise-beans> and so on.
Use XML for frequently changing elements. For example your datasource connection URL will keep changing, from developement, to testing to production. If you use annotations you would have to recompile your classes everytime. So in such cases, it would be better to use XML.
The bottom line is annotations make your work more easier and comfortable and also help in making EJB's more attractive for learning to new people
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: advantage of ejb3 :: annotation as against DD