Win a copy of Head First Android this week in the Android forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

EJB and hibernate --same or different

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the purpose of having EJB and hibernate in a project?
I thought hibernate is an alternative to EJB? Please clear me on this.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

shah rah wrote:What is the purpose of having EJB and hibernate in a project?
I thought hibernate is an alternative to EJB? Please clear me on this.



Hibernate shouldn't be thought of as an alternative to EJB, with exception to CMP (container-managed persistence). Hibernate basically gives object/relational mapping functionality. Although EJB does have POJO which provides object/relational mapping. Hibernate is great if you don't want to bother writing SQL, but I much prefer EJB. As far as using both in a project...well sure its can be done (and is supported obviously), but I have never done it, nor found a good enough reason to. Hope that helps.
 
Bartender
Posts: 4109
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

shah rah wrote:What is the purpose of having EJB and hibernate in a project? I thought hibernate is an alternative to EJB? Please clear me on this.


EJBs include Session, MDB & persistence, whereas Hibernate is for the persistence (O/R Mapping framework). While EJB3 introduces the standard way for O/R Mapping (JPA) you can use hibernate (or any other O/R Mapping framework which supports JPA) behind the scene for the persistence of your application.
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJB (I'm speaking in-terms of EJB 3) is a specification in which JPA is a part of it and Hibernate could be said as the reference implementation of the JPA specification.
 
You showed up just in time for the waffles! And 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
reply
    Bookmark Topic Watch Topic
  • New Topic