Friday, 13 April 2012

Hibernate Interview Questions and Answers - 1 - 10


1) Explain about Hibernate?

Hibernate solves problems such as Object Relational impedance mismatch, etc. It is commonly used for object and query service. It helps data base developers develop classes which include inheritance, association, composition and polymorphism. A developer or user can express queries either in HQL or SQL.

2) Explain about the primary feature of Hibernate?

Primary feature of hibernate is to java classes to database tables. Data query and retrieval is also possible with Hibernate. Application portability is a key feature in Hibernate it allows developers to port applications to almost all SQL databases.

3) Explain about transparent persistence of Hibernate?

Transparent persistence is provided for Plain old Java objects or POJOs. For proper functioning of the applications importance should be given to the methods equals () and hash Code methods (). It has a requirement which should be strictly followed in the applications which is a no-argument constructor.
4) Explain about the dirty checking feature of Hibernate?

Dirty checking feature of the Hibernate allows users or developers to avoid time consuming data base write actions. This feature makes necessary updations and changes to the fields which require a change, remaining fields are left unchanged or untouched.

5) Brief about the Session factory interface?

It creates new hibernate sessions by referencing immutable and thread safe objects. Application using hibernate are usually allowed and desgined to implement single instance of the class using this interface. Only single instance of a class can be used which is using this interface.

6) Explain about session interface?

This represents hibernate session which perform the manipulation on the database entities. Some of the activities performed by session interface are as follows they are managing the persistence state, fetching persisted ones and management of the transaction demarcation.

7) Explain the steps involved in creating database applications with Java using Hibernate?

Creating Database applications with Java is made simpler with Hibernate. First Plain old java object needs to be written, XML mapping file should be created which shows relationship between database and class attributes. Hibernate APIs can be used to store persistent objects.

8) Explain about hibernate.cfg.xml?

Hibernate can be configured with two types of files out of which hibernate.cfg.xmlis widely used and popular feature. Hibernate consults hibernate.cfg.xml file for its operating properties such as database dialect, connection string and mapping files. These files are searched on class path.

9) Explain about mapping description file?

Mapping description file is the second file which Hibernate uses to configure its functions. This mapping file has an extension *.hbm which instructs mapping between Java class and database tables. The usage of mapping description file rests entirely upon the business entity.

10) Explain about transaction file?

Transactions denote a work file which can save changes made or revert back the changes. A transaction can be started by session.beginTransaction() and it uses JDBC connection, CORBA or JTA. When this session starts several transactions may occur.

2 comments:

Related Posts Plugin for WordPress, Blogger...