Search your topic in Java2share
Home > FAQs
eXTReMe Tracker


Hibernate FAQs


7.What Does Hibernate Simplify?
Hibernate simplifies:

  • Saving and retrieving your domain objects
  • Making database column and table name changes
  • Centralizing pre save and post retrieve logic
  • Complex joins for retrieving related items
  • Schema creation from object model

 8.What is the main difference between Entity Beans and Hibernate ?

1)In Entity Bean at a time we can interact with only one data Base. Where as in Hibernate we can able to establishes the connections to more than One Data Base. Only thing we need to write one more configuration file.

2) EJB need container like Weblogic, WebSphare but hibernate don't nned. It can be run on tomcat.


3) Entity Beans does not support OOPS concepts where as Hibernate does.

4) Hibernate supports multi level cacheing, where as Entity Beans doesn't.

5) In Hibernate C3P0 can be used as a connection pool.

6) Hibernate is container independent. EJB not.


9.What are the Core interfaces and classes of Hibernate framework?
The five core interfaces are used in just about every Hibernate application. Using these interfaces, you can store and retrieve persistent objects and control transactions.

  • Configuration class (org.hibernate.cfg package)
  • Session interface (org.hibernate package)
  • SessionFactory interface  (org.hibernate package)
  • Transaction interface (org.hibernate package)
  • Query and Criteria interfaces (org.hibernate package)

10.What is the general flow of Hibernate communication with RDBMS?
The general flow of Hibernate communication with RDBMS is :

  • Load the Hibernate configuration file and create configuration object. It will automatically load all hbm mapping files because mapping file can be configured in configuration file.
  • Create session factory from configuration object
  • Get one session from this session factory
  • Create HQL Query
  • Execute query to get list containing Java objects.


11.What is the need for Hibernate mapping file?

Hibernate mapping file is used to provides the mapping between java class with table member variables with column names of the table. And also we can configure primary key generation algorithm, relations and so on. Typical mapping file look as follows:
 

12.What are the important tags of hibernate.cfg.xml?

This file can be used to provide the database information like driverclass name, url, database usename, database password, dialect, connection pooling mapping file and so on.
Following are the important tags of hibernate.cfg.xml: