• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA or Hibernate?

 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am going to work on a spring-hibernate enterprise project. When integrating spring with hibernate should i be using JPA or Hibernate for ex: should i configure JPA's entity manager factory or hibernate's session factory in my spring context file?

What are the pros and cons of both the approaches?

Thanks,
Srikanth.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your JPA provider if you're not using Hibernate?

-Cameron
 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cameron Wallace McKenzie wrote:What is your JPA provider if you're not using Hibernate?

-Cameron


Hibernate is the only JPA provider we are using at least now.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, in that case, you should configure Hibernate as your JPA provider.

I'm not sure of any drawbacks. You can always switch to a native JPA provider in the future. I think using Hibernate is a safe and secure option.

-Cameron McKenzie
 
Vamsi Mohan
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Hibernate is a safe and secure option. Also Hibernate facilitates faster data acess and database independent.
 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cameron Wallace McKenzie wrote:Well, in that case, you should configure Hibernate as your JPA provider.

I'm not sure of any drawbacks. You can always switch to a native JPA provider in the future. I think using Hibernate is a safe and secure option.

-Cameron McKenzie


So, you mean we have to configure this in spring context as below:


instead of this


right??
 
Ulas Ergin
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vamsi Mohan wrote:Yes, Hibernate is a safe and secure option. Also Hibernate facilitates faster data acess and database independent.

can you provide links to any bechmarks supporting this claim?
 
Lalit Bhatt
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some pointers:
- JPA is standard that mean you can write the code and it will run on any JavaEE compliant server. If you are on JBoss, hibernate is the JPA provider and on Glassfish Toplink is the JPA provider.
- Hibernate provides support for JPA and has some extended features. The extended feature will tie you to hibernate but this is fine as along as you get value out of it. Do not play vendor independence beyond it is required.
- If you are using Tomcat which is a plain servlet engine, than you might want to go with hibernate.

A good idea is to start with JPA and see if that serves your purpose. It will be a matter of time that most of the feature will become pare of Hibernate.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic