As I started working with Hibernate a few days ago, I was just wondering : suppose you\'re starting a project from scratch. Would you use annotation-based mapping or Hibernate m
Go ahead with annotations any day. The XML configurations where really over used and saving the metadata inside the class is a good viable option.
Annotations will help you map the relationships better and it will align you to the JPA standard as hibernate uses mostly JPA annotations. There are no real problems using annotations and there is not much trade-off either. It has superior advantages over the XML based configurations. There might be few hacks missing when you use annotations but they will come along.
It is even possible to use annotations for new classes in a legacy project that has XML based mapping as told here.
What advantages I see in using @Annotations:
What advantages I see in using XML:
We use annotations, but keep XML as an option.