• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JPA or Hibernate?

 
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.
 
author and cow tipper
Posts: 5000
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
Posts: 5000
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
 
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??
 
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?
 
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.
 
You didn't tell me he was so big. Unlike this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic