• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Annotations vs XML

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

I'm finding it a bit hard using Annotations for EJB 3 entities than using plain XML. How many accep the same?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But they look very similar. What do you find hard to use with annotations ?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm actually preparing for my SCBCD 5 certification and as I read from the EJB 3 in Action book, I find that I need to remember a lot of these Annotations for Entities compared to MDB's or Session beans.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's true. But if you know the XML, annotations should be straight-forward as the syntax is pretty similar, isn't it ?
 
Ranch Hand
Posts: 563
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way,
are there questions about the XML syntax at the exam ?
I have read mixed reports on that matter, some say there aren't any question about XML, only annotations, and others say both are included.

What do you say ?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Christophe Verre:
That's true. But if you know the XML, annotations should be straight-forward as the syntax is pretty similar, isn't it ?



Christophe I agree with your point. I have another question to ask here. How is it when it comes to the choice of using Annotations or XML fiels for mapping? Which one has advantages over the other and what would they be? Any idea?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Which one has advantages over the other and what would they be?


I think it depends on people. Some like annotations, some prefer XML. People used to EJB2.x might still stick to XML.
The cool thing is that, in the end, the XML overrides the annotations so even if annotations are used, there's still a way to override them. Apart from that, I don't see any obvious advantage which would not break into a war between annotation-lovers and xml-lovers
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I Vote for Annotations over XML.
They are self explanatory and easy to use. Later, if anyone wants to debug the code, we can understand very easily about a method by looking into its annotations.
I would rather feel happy if the XML declarations will be removed from EJB in next version so that I needn't have to read them
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But using Annotations for Entity mapping becomes hard at some times. Don't they? Imagine you are maintaining a EJB 3 app and what would you like to see? I guess I'd prefer XML.

Another question that I have is as mentioned in one of the posts above, does the exam test us also on XML DD's? Any suggestion from previous exam takers?
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Just to inform you that :

- Annotations are hard coded parameters.
- Xml elements are run time parameters and can override annotations except
1) Ejb Bean type
2) Transaction Attribute type
and might be few more which i dont remember right now.



Use of Xml elements increases ejb-jar.xml length
and not very readable.

Use of excessive annotations also causes issues for readability
as it becomes tedious to keep track of all annotations when you have
more beans in your application.

So best technique is to have moderate use of annotations as well as Xml elements.

 
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic