Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why do we use Hibernate annotations?  RSS feed

 
Kamila Rutkowski
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is it important? what are the advantages compared with XML mapping? Could anyone please explain these completely for me?
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37381
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kamila,
Annotations are less verbose. They also define the mapping right where the fields are defined.

If your database changes independently of the code, annotations would not be the right choice. For many applications, the database is stable and annotation make development easier.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!