Here you can find Hibernate Interview Questions and Answers.
In this Hibernate Interview Questions and Answers section you can learn and practice Hibernate Interview Questions and Answers to improve your skills in order to face technical inerview by IT companies. By Practicing these interview questions, you can easily crack any Hibernate interview.
AllIndiaExams provides you lots Hibernate Interview Questions and Answers with proper explanation. Fully solved examples with detailed answer description. All students, freshers can download Hibernate Interview Questions and Answers as PDF files and eBooks.
You no need to worry, we have given lots of Hibernate Interview Questions and Answers and also we have provided lots of FAQ's to quickly answer the questions in the Hibernate technical interview.
what is the advantage of Hibernate over jdbc?
There are so many 1) Hibernate is data base independent, your code will work for all ORACLE,MySQL ,SQLServer etc. In case of JDBC query must be data base specific. So hibernate based persistance logic is database independent persistance logic and JDBC based persistance logic is database dependent logic. 2) As Hibernate is set of Objects , 3) No need to learn SQL language.You can treat TABLE as a Object . Only Hibernate knowledge is need. In case of JDBC you need to learn SQL. 3) Dont need Query tuning in case of Hibernate. If you use Criteria Quires in Hibernate then hibernate automatically tuned your query and return best result with performance. In case of JDBC you need to tune your queries. 4) You will get benefit of Cache. Hibernate support two level of cache. First level and 2nd level. So you can store your data into Cache for better performance. In case of JDBC you need to implement your Hibernate cache . 5) Hibernate supports Query cache and It will provide the statistics about your query and database status. JDBC Not provides any statistics. 6) Development fast in case of Hibernate because you dont need to write queries 7) No need to create any connection pool in case of Hibernate. You can use c3p0. In case of JDBC you need to write your own connection pool 8) In the xml file you can see all the relations between tables in case of Hibernate. Easy readability. 9) You can load your objects on start up using lazy=false in case of Hibernate. JDBC Dont have such support. 10 ) Hibernate Supports automatic versioning of rows but JDBC Not.
What is Hibernate?
Hibernate is an open source, light weight Object Relational Mapping tool to develop the database independent persistence login in Hibernate and j2ee based applications. Hibernate is a pure Hibernate object-relational mapping (ORM) and persistence framework that allows you to map plain old Hibernate objects to relational database tables using (XML) configuration and mapping files. Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks
What is ORM ?
ORM stands for object/relational mapping, means providing the mapping between class with table and member variables with columns is called ORM. ORM is the automated persistence of objects in a Hibernate application to the tables in a relational database.
What does ORM consists of ?
An ORM solution consists of the following four pieces: 1. API for performing basic CRUD operations 2. API to express queries referring to classes 3. Facilities to specify metadata 4. Optimization facilities
What are the ORM levels ?
The ORM levels are: 1. Pure relational (stored procedure) 2. Light objects mapping (JDBC) 3. Medium object mapping 4. Full object Mapping (composition,inheritance, polymorphism, persistence by reachability)
Why do you need ORM tools like hibernate?
The main advantage of ORM like hibernate is that it can develop the database independent persistence logic. Apart from this, ORM provides following benefits: Improved productivity High-level object-oriented API Less Hibernate code to write No SQL to write Improved performance Sophisticated caching Lazy loading Eager loading Improved maintainability A lot less code to write Improved portability ORM framework generates database-specific SQL for you
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
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.
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)
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 Hibernate objects.