GeeCON Prague 2014*
The moose likes Object Relational Mapping and the fly likes confused with JAP,Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "confused with JAP,Hibernate" Watch "confused with JAP,Hibernate" New topic
Author

confused with JAP,Hibernate

Vas Miriyala
Ranch Hand

Joined: Sep 14, 2009
Posts: 114

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

Joined: Aug 09, 2005
Posts: 61
Yes. You can mention all the mappings in the persistence.xml file in JPA.
Vas Miriyala
Ranch Hand

Joined: Sep 14, 2009
Posts: 114

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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Reddy Prashanth
Ranch Hand

Joined: Aug 09, 2005
Posts: 61
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

Joined: Sep 14, 2009
Posts: 114

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

Joined: Aug 09, 2005
Posts: 61
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)
 
GeeCON Prague 2014
 
subject: confused with JAP,Hibernate