Whats the advantage of using Hibernate vs entity beans and vice versa ?
I can see the advantages of Hibernate vs JDBC clearly, but I stumbled when I was asked this in the interview.
From ejb3, there is no concept of entity bean , it has been redefined as JPA. JPA is a spec and it can use any of ORM frameworks as underlying persisting mechanism like Hibernate,OpenJPA, Toplink.
After the JPA specification , The ORM framwork should adhere to the JPA spec. It includes Hibernate too.
Hibernate or JPA can be used in standalone application i.e. it doesnt require any container to be deployed. It can be accessed in a standalone environment.
Thanks
According to Oracle EJB Concepts tutorial:
An entity bean represents a business object in a persistent storage mechanism. Some examples of business objects are customers, orders, and products. In the Application Server, the persistent storage mechanism is a relational database.
So Entity Beans are annotated with Java Persistence (JPA) annotations java classes. Hibernate in turn is an implementation of a JPA Spec.
In my opinion there is an advantage of using JPA Spec over Hibernate. This gives you ability to switch the implementation to Toplink, Eclipselink or any other implementation od JPA spec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With