File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Annotation dilema Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Annotation dilema" Watch "Annotation dilema" New topic

Annotation dilema

camelia codarcea
Ranch Hand

Joined: May 08, 2007
Posts: 36

I am reading about annotations, and I can't figure out the difference between EJB3 annotations, Hibernate annotations and JDK5 annotations.
All three have the same tags: @Id, @one-to-many etc
Can anyone explain to me, or is there a good tutorial about annotations ?

thank you

SCJP 5.0 .... 97%
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17260

I don't recall a JDK 5 Annotation @Id. But that doesn't matter Annotations are actually still class, and classes that can have the same name, but in different packages.

So there could be an @Id that is in a JDK package and one in the JPA package and even a seperate one in Hibernate. But the Hibernate and JPA annotations should be one and the same and in the same package, because Hibernate implements the JPA Specification. Just to claify I am using the JPA name instead of EJB3, because those EJB3 annotations you mentioned are part of the JPA spec which is included under EJB3.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Annotation dilema