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?
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.
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.
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?
Joined: Aug 09, 2005
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)