Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

confused with JAP,Hibernate

 
Vas Miriyala
Ranch Hand
Posts: 114
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dearl all,
I am getting confusion,that JPA will make our POJO's are persistence with annotations,Right?if we are not using annotations in hibernate lets say using only xml files,then is it psossible to use JPA?
 
Reddy Prashanth
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. You can mention all the mappings in the persistence.xml file in JPA.
 
Vas Miriyala
Ranch Hand
Posts: 114
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot,lets say i am not using JAP at all only hibernate,then our POJO's not persistent pojo's?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, you'll have to remember that JPA is not JAP You don't need to use JPA to make your pojos persistent in Hibernate. Hibernate is one persistence framework, which happens to also be an implementation of JPA. Check this article about Hibernate 3.5 without JPA.
 
Reddy Prashanth
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Hibernate is an ORM framework by its own and also it supports JPA specification. You dont need to use JPA if you dont want. Hibernate will persists your POJOs.

So you can use Hibernate as it is or you can use JPA in your application, leveraging hibernate's JPA implementation.
In hibernate applications, we mention pojo-table mapping details in *.hbm files or use Hibernate annotations.
In JPA, we mention the mappings in perssitence.xml or use JPA annotations.

JPA annotations are subset of hibernate annotations.
 
Vas Miriyala
Ranch Hand
Posts: 114
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot guys,at last one doubt,in what kind of scenario we will go for JPA ,even though our Framework is Persistence framework?
 
Reddy Prashanth
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want portability for your application across different JPA implementations and do not want to couple your application with Hibernate api, you can use JPA. Also, it is alway a good idea to use JPA. But hibernate has some additional features which are not part of JPA specification (ex: Criteria Queries and Query By Exmaple)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic