Online Tutorials & Training Materials |
Register Login

Hibernate Interview Questions

Hibernate Interview FAQ's

1. What is Hibernate?

A: Hibernate is lightweight open source ORM tool used to store, retrieve, and manipulate data from a database.

2. What is meant by ORM?

A: ORM or Object/Relational Mapping is a programming technique that maps objects to data stored in a database. Mapping makes creation, manipulation, and access simpler.

3. What core interfaces does Hibernate have?

A: Hibernate framework core interfaces include:

  • Configuration
  • SessionFactory
  • Session
  • Query
  • Criteria
  • Transaction

4. What is meant by SessionFactory?

A: SessionFactory is the factory and provides the instance of Session. It contains second level cache data which is not enabled by default.

5. What is meant by Session?

A: Session is what maintains the connection between the database and the Hibernate application. It provides methods for storing, fetching, updating, or deleting data from database.

6. In what states can objects exist in Hibernate?

A: Objects can exist in 3 states in Hibernate:

1.Transient: The object has just been created, but does not have a primary key or identifier, nor is it associated with a session.

2.Persistent: The object session is open and the instance has just been saved into or retrieved from the database.

3.Detached: When the object session is closed and has not yet been called.

7. What is meant by Hibernate configuration file?

A: The Hibernate configuration file has configurations specific to the database and is the properties file needed by application. It is the first object created and is usually created only once.

8. What strategies are used for inheritance mapping in Hibernate?

A: Inheritance strategies for hibernate include table per hierarchy, table per concrete class, and table per subclass.

9. What is meant by Lazy Loading?

A: In Hibernate, Lazy Loading is the phenomenon where objects are loaded on demand only. This improves the performance of the program by loading the child objects only when asked.

10. What does Automatic Dirty Checking mean?

A: Automatic dirty checking is a feature of hibernate that calls an update statement automatically on objects modified in transaction.

11. What does the Configuration Interface do?

A: The configuration interface is used to set up the Hibernate session being used by locating mapping documents. In other words, it bootstraps hibernate.

12. What is meant by POJO?

A: POJO or Plain Old Java Objects are Java objects with well defined get and set methods for all properties.

13. What is HQL?

A: The query language used in Hibernate is called Hibernate Query Language. It is an extension of SQL, but is a simpler, more efficient, and more flexible language to perform various operations on a database.

14. What is meant by JDBC?

A: JDBC or Java Database Connectivity gives a set of Java API to access relational databases from a Java program.

15. What does Transaction mean in hibernate?

A: A transaction in Hibernate is a unit of work done with a database. It is an optional object, and hibernate application may choose to not use it.

16. What does Query signify in Hibernate?

A: Query objects in Hibernate use HQL or SQL strings to pick up data from database and create objects.

17. What is meant by Criteria in Hibernate?

A: Criteria are objects that create and execute criteria queries to retrieve objects.

18. What method adds criteria to a query?

A: The method Session.createCriteria is used to create a new Criteria instance for a given class or the superclass of a class.

19. What method creates an HQL query?

A: The method Session.createQuery is used to create a new query instance for a given HQL query string.

20. What is meant by persistent class in Hibernate?

A: The classes of Java which have their objects or instance saved in database tables are persistent classes.

21. Where are Object/Relational Mappings defined in Hibernate?

A: Usually, mappings are defined in XML document. Map files serve as instruction to Hibernate on how to map class or classes to database.

22. What is meant by first level cache in Hibernate?

A: First Level Cache is a Session cache, and all requests must compulsorily pass through it. Before adding an object to the database, the Session object keeps it under its own control.

23. What is meant by second level cache in Hibernate?

A: The second level cache is the optional cache. The first level cache is consulted before an object is attempted to be located in the second level cache.

24. What is meant by Query level cache in Hibernate?

A: Close integrated with second level cache, the Query level cache is implemented by Hibernate for Query result sets. It is also an optional cache and needs two extra physical caches for cached query results and table update timestamps. They are useful for queries which are frequently run with same parameters.

25. How does Hibernate reduce database writing time?

A: The dirty checking feature of Hibernate reduces writing time by updating only the fields requiring changes and leaving other fields intact.

26. What is the function of callback interfaces in Hibernate?

A: Hibernate callback interfaces receive notifications for events from objects. An event generates when objects are loaded or deleted, for example, and notification for this event is sent via the callback interface.

27. What is meant by Light Object Mapping in Hibernate?

A: Light Object Mapping is a level of ORM where classes represent entities and are manually mapped.

28. What is meant by Derived Properties in Hibernate?

A: Derived Properties are properties not mapped to database table columns. They are calculated during runtime by evaluating expressions.

1020 results
  • Smartforms Interview Questions and Answers
    SAP ABAP Smartforms Interview FAQ n nQ) Define Smart form? n nForm Printing in the Internet Age n nSmart Forms was initially presented in SAP Basis Release 4.6C primarily as a tool for the creation...
  • Posted in: Interview Questions » ABAP » | By: rekha | Date: 29 Jun 2018 1:19 pm | Comments (6)
    1.  Priniples of oops?2.  What is difference between procedural & OO Programming?3.  What is class?4.  What is object?5.  Can we instantiate a class within implementation...
  • Posted in: Interview Questions » ABAP » | By: vishal singh | Date: 18 May 2018 11:23 am | Comments (1)
  • BAPI Interview Questions and Answers
    General BAPI Interview Questions n n1) Define BAPI? n nBAPI is a standardized programming interface (method) which enable external applications to gain access to business processes and data in...
  • Posted in: SAP Blogs » » | By: rekha | Date: 08 Jan 2019 6:43 am | Comments (1)
  • Reorganizations Interview Question and Answers
    nFAQ: Reorganizations 1. What is reorganization?The term reorganization refers to the reconstruction of objects in the database. A distinction is made between offline and online...
  • Posted in: Interview Questions » Oracle » | By: rekha | Date: 19 May 2018 4:27 am | Comments (0)
  • ALV Layout Interview Questions
    [1] Question: What do the terms "display variant" and "layout" mean? n nAnswer: Both the term "display variant" and the term "layout" refer to the same thing...
  • Posted in: Interview Questions » ABAP » | By: rekha | Date: 18 May 2018 12:00 pm | Comments (0)
  • JMon Interview Questions and Answers
    FAQ: JMon1.Q: The JVM cores on Windows 2000 with the following error in the file hs_err_pidxxxx.log: An unexpected exception has been detected in native code outside the VM. Unexpected Signal:...
  • Posted in: Interview Questions » Java » | By: rekha | Date: 20 May 2018 1:51 am | Comments (1)
  • SAP EHS Interview Questions
    Hello SAP Experts, n nI Need SAP EHS interview questions and answers that are asked usually in any interivew. Please try to share them with me as soon as possible so that I can read and follow them...
  • Posted in: Forum » EHS ( Environment, Health, and Safety Management ) » | By: | Date: 18 May 2018 11:53 pm | Comments (1)
  • Order Management Interview Questions
    Hello Experts, n nI have recently faced an interview of a Company and the interviewer asked me these question which i have mentioned below: n nFirst question : If a xyz sales person(may be he meant...
  • Posted in: Forum » SD (Sales and Distribution) » | By: Rohit Mahajan | Date: 04 Dec 2018 7:21 am | Comments (4)
  • Authorizations Interview Question and Answers
    FAQ: General Questions About Authorizations[1] Question: Can wildcards be used in authorizations?[2] Question: What does the PFCG_TIME_DEPENDENCY clean up?[3] Question: What happens to change...
  • Posted in: Interview Questions » BASIS » | By: rekha | Date: 18 May 2018 12:09 pm | Comments (0)
  • MODULARIZATION Interview Questions and Answers
    MODULARIZATION FAQs1.Does every ABAP/4 have a modular structure?Yes.2.What is Modularization and its benefits?If the program contains the same or similar blocks of statements or it is required to...
  • Posted in: Interview Questions » ABAP » | By: Merityunjay Kumar Shukla | Date: 19 May 2018 11:07 am | Comments (1)
  • SDBI_CLUSTER_CHECK Interview Questions and Answers
    Q-1.Will I be able to run the SDBI_CLUSTER_CHECK without option "Find duplicates"? What is the impact?Ans) It is indeed possible to run the report without causing any impacts. The option...
  • Posted in: Interview Questions » NetWeaver » | By: vaibhav gupta | Date: 18 May 2018 3:51 pm | Comments (0)
  • Informatica Interview Questions and Answer
    Informatica FAQ's n n1. What is Enterprise Data Warehousing? n nA: Enterprise Data Warehousing is the creation of organization data at a single access point. Data with global view can be given to...
  • Posted in: SAP Blogs » » | By: Nitesh Singh | Date: 30 May 2018 11:08 am | Comments (0)
  • Hive Interview Questions and Answers
    What is Hive? n nHive is a tool to perform ETL (extract, transform and load) and Data warehousing functions. It was developed as a sub-project of Hadoop Distributed File System (HDFS). Hive makes...
  • Posted in: Articles » » | By: vaibhav gupta | Date: 14 Feb 2019 6:43 am | Comments (0)
  • TestNG Interview Questions & Answers
    What is TestNG? n nTestNG is a tool to perform tasks like reporting, assertions, parallel test execution etc. integrating the framework with selenium or other automation tools. The NG in TestNG...
  • Posted in: Articles » » | By: Jyoti Pandey | Date: 15 Jan 2019 10:06 am | Comments (0)
  • SSRS Interview Questions and Answers
    What is SSRS? n nSQL Server Reporting Service is a server-based software system. It generates reports that Microsoft develops. You can prepare and deliver various printed reports that are...
  • Posted in: Articles » » | By: Shalesh Singh | Date: 11 Feb 2019 8:34 am | Comments (0)
  • VMware Interview Questions and Answers
    What is VMware? n nVMware is a software that enables you to do virtualization and cloud computing in your host computer. You can run a virtual computer from your own computer. The basis of...
  • Posted in: Articles » » | By: vaibhav gupta | Date: 24 Dec 2018 7:03 am | Comments (0)
  • Data Modelling Interview Questions
    What is data modelling? n nThe process of documenting the design of a complex software system through diagrams, text, and symbols that represent the data flow is known as data modelling. This...
  • Posted in: Articles » » | By: Romil Tripathi | Date: 15 Feb 2019 1:45 pm | Comments (0)
  • Microservices Interview Questions and Answers
    What are Microservices? n nMicroservices or Microservice Architecture is a style of architecture that organizes an application in the form of a collection of minor autonomous services that are...
  • Posted in: Articles » » | By: Sushma | Date: 08 Jan 2019 6:31 am | Comments (0)
  • SoapUI Interview Questions and Answers
    What is SoapUI? n nSoapUI is a tool that is used for functional and non-functional testing of SOAP Web Services as well as RESTful or HTTP based services Web Services. It is an Open Source, free...
  • Posted in: Articles » » | By: Sonia Barwar | Date: 24 Jan 2019 12:45 pm | Comments (0)
  • Unix Interview Questions and Answers
    What is UNIX? What does UNIX stand for? n nUNIX is easy to use, multi-user, multi-tasking and stable operating system for servers that have a graphical user interface (GUI) like Microsoft Windows. It...
  • Posted in: Articles » » | By: Romil Tripathi | Date: 18 Jan 2019 12:58 pm | Comments (0)