Hibernate Interview Questions And Answers

Hibernate interview questions and answers on advance and basic Hibernate with example so this page for both freshers and experienced condidate. Fill the form below we will send the all interview questions on Hibernate also add your Questions if any you have to ask and for apply in Hibernate Tutorials and Training course just send a mail on info@pcds.co.in in detail about your self.

Top Hibernate interview questions and answers for freshers and experienced

What is Hibernate ?

Answer :

Questions : 1 :: What is Hibernate?

Hibernate is an ORM (Object Relational Mapping) and persistent framework. The framework helps to map plain java object to relational database table using xml configuration file. The framework helps...View answers

Questions : 2 :: Why hibernate and how does it help in the programming?

The main advantage of Hibernate (ORM) framework is that it shields developer to write a messy SQL. Apart from that ORM provides following benefits. • Improve Productivity of the...View answers

Questions : 3 :: How will you configure Hibernate?

To configure hibernate, you need hibernate.cfg.xml or hibernate.properties file and *.hbm.xml files, all these files are used by Configuration class to create sessionFactory, which in turn creates...View answers

Questions : 4 :: Which settings will be loaded if both hibernate.properties and hibernat.cf.xml files are present in the classpath?

If both hibernate.properties and hibernate.cfg.xml files are present in the classpath then hibernate.cfg.xml file will override the settings found in hibernate.properties. So please make sure that...View answers

Questions : 5 :: What are the Core interfaces of Hibernate framework?

There are five core interfaces being used extensively in every Hibernate application. Using these interfaces you can store or retrieve any persistent objects and also control...View answers

Questions : 6 :: What is the role of Session interface in Hibernate?

The session interface is the primary interface used in Hibernate Application. It is single threaded sort-lived object and represents conversation between Application and the persistent store. It...View answers

Questions : 7 :: What is the role of SessionFactory?

The application obtains session object from SessionFactory interface. Typically there should be only one sessionFacory for whole application and is loaded during application initialization. The...View answers

Questions : 8 :: What are the Collection types in Hibernate?

• Bag • Set • List • Array • Map

Questions : 9 :: What is HibernateTemplate?

The spring framework provides HibernateTemplate (org.springframework.orm.hibernate.HibernateTemplate) which is kind of helper class and provides following benefits. - HibernateTemplate class...View answers

Questions : 10 :: What is the difference between load() and get() method?

load():  - Use load() method only when you are sure that object you want to read already exists.  - If unique Id of an object does not exists in database then load() method will throw an...View answers

Questions : 11 :: What is lazy fetching in Hibernate?

In Hibernate Lazy fetching is associated with child objects loading for its parents. Through Hibernate mapping file (.hbm.xml) you can specified the selection of loading child objects. By default...View answers

Questions : 12 :: What is the difference between merge and update method?

Use update() method when you are sure that session does not contain an already persistent instance with the same identifier, and merge() if you want to merge your modifications at any time without...View answers

Questions : 13 :: How do you define sequence generated primary key in hibernate?

Using <generator> tag. Example:- <id column="CUST_ID" name="id" type="java.lang.Long"> <generator class="sequence"> <param name="table">SEQUENCE_NAME</param>...View answers

Questions : 14 :: What are the different types of caches in Hibernate?

Hibernate uses two different type of caches for objects: first-level cache and second-level cache. First level of cache is associated with Session object, while second-level of cache is associated...View answers

Questions : 15 :: What do you mean by Named – SQL query?

Named SQL queries are defined in the mapping xml document and called wherever required. Example: <sql-query name = "empdetails"> <return alias="emp" class="com.test.Employee"/>...View answers

Questions : 16 :: What is ORM?

ORM (Object Relational Mapping) is the fundamental concept of Hibernate framework which maps database tables with Java Objects and then provides various API’s to perform different types of...View answers

Questions : 17 :: What's the usage of Configuration Interface in hibernate?

Configuration interface of hibernate framework is used to configure hibernate. It’s also used to bootstrap hibernate. Mapping documents of hibernate are located using this interface.

Questions : 18 :: How can we use new custom interfaces to enhance functionality of built-in interfaces of hibernate?

We can use extension interfaces in order to add any required functionality which isn’t supported by built-in interfaces.

Questions : 19 :: Should all the mapping files of hibernate have .hbm.xml extension to work properly?

No, having .hbm.xml extension is a convention and not a requirement for hibernate mapping file names. We can have any extension for these mapping files.

Questions : 20 :: What's HQL?

HQL is the query language used in Hibernate which is an extension of SQL. HQL is very efficient, simple and flexible query language to do various type of operations on relational database without...View answers

Questions : 21 :: How can we invoke stored procedures in hibernate?

In hibernate we can execute stored procedures using code as below: [xml] <sql-query name=”getStudents” callable=”true”> <return alias=”st”...View answers
More Question

Ask your interview questions on Hibernate

Write Your comment or Questions if you want the answers on Hibernate from Hibernate Experts
Name* :
Email Id* :
Mob no* :
Comment* :

--------- Tutorials ---