wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Hibernate--Mapping files or Annotations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate--Mapping files or Annotations" Watch "Hibernate--Mapping files or Annotations" New topic
Author

Hibernate--Mapping files or Annotations

Dinakar Kas
Ranch Hand

Joined: Jul 11, 2010
Posts: 34
What is the better approach for using the Hibernate in a new project? Use XML mapping files or JPA annotations?

Thanks,
Dinakar.K
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Its entirely personal preference really, both have pros and cons. Some people don't like mapping data separate from the code, others don't like cluttering the code with mapping data. Both provide the same functionality.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Dinakar Kas
Ranch Hand

Joined: Jul 11, 2010
Posts: 34
Thanks Paul.

I fall in the category of people who don't like to write xml files. so, may be annotations suit me better.

I happened to see a tutorial on Hibernate using JPA at http://www.thebookonhibernate.com/HiberBookWeb/index.jsp by the author of Hibernate Made Easy and found it amazing.

Did any one read the book Hibernate Made easy? Is it as good as the tutorial given?

Thanks,
Dinakar.K
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Oh, it's even better than the tutorial given. Really, it's one of the best books you'll ever read, right up there with "Catcher in the Rye."

Hubris aside, the book has been very popular and has helped many get started in Hibernate. I'm sure you'll love it. (I'm the author).

-Cameron McKenzie
Dinakar Kas
Ranch Hand

Joined: Jul 11, 2010
Posts: 34
Thanks Cameron. I am going today to buy it.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hibernate--Mapping files or Annotations
 
Similar Threads
annotations ?
org.hibernate.AnnotationException: No identifier specified for entity
Mixing Hibernate Annotations with .hbm files
Why POJO was not used before
confused with JAP,Hibernate