- Hibernate - Home
- ORM - Overview
- Hibernate - Overview
- Hibernate - Architecture
- Hibernate - Environment
- Hibernate - Configuration
- Hibernate - Sessions
- Hibernate - Persistent Class
- Hibernate - Mapping Files
- Hibernate - Mapping Types
- Hibernate - Examples
- Hibernate - O/R Mappings
- Hibernate - Cascade Types
- Hibernate - Annotations
- Hibernate - Query Language
- Hibernate - Criteria Queries
- Hibernate - Native SQL
- Hibernate - Caching
- Hibernate - Entity Lifecycle
- Hibernate - Batch Processing
- Hibernate - Interceptors
- Hibernate - ID Generator
- Hibernate - Saving Image
- Hibernate - log4j Integration
- Hibernate - Spring Integration
- Hibernate - Struts 2 Integration
- Hibernate - Web Application
- Mapping Table Examples
- Hibernate - Table Per Hiearchy
- Hibernate - Table Per Concrete Class
- Hibernate - Table Per Subclass
Hibernate Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to Hibernate Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - Which of the following is not an ORM framework?
Answer : D
Explaination
NoSQL is not an ORM framework.
Q 2 - Which of the following is true about Query object in hibernate?
B - Query objects SQL string to retrieve data from the database and create objects.
Answer : D
Explaination
Query objects use SQL or Hibernate Query Language (HQL) string to retrieve data from the database and create objects. A Query instance is used to bind query parameters, limit the number of results returned by the query, and finally to execute the query.
Q 3 - Session.createQuery creates a new instance of Query for the given HQL query string.
Answer : A
Explaination
Session.createQuery creates a new instance of Query for the given HQL query string.
Q 4 - Which of the following is true about <id> element?
A - The <id> element maps the unique ID attribute in class to the primary key of the database table.
B - The name attribute of the id element refers to the property in the class.
C - The column attribute of the id element refers to the column in the database table.
Answer : D
Explaination
The <id> element maps the unique ID attribute in class to the primary key of the database table. The name attribute of the id element refers to the property in the class and the column attribute refers to the column in the database table. The type attribute holds the hibernate mapping type, this mapping types will convert from Java to SQL data type.
Q 5 - Which of the following element maps java.util.List property in hibernate?
Answer : B
Explaination
java.util.List property is mapped with a <list> element and initialized with java.util.ArrayList.
Answer : A
Explaination
Since Hibernate 3, lazy loading is by default, enabled so that child objects are not loaded when parent is loaded.
Q 7 - Whis of the following is true about second level cache in hibernate?
A - The second-level cache is the SessionFactory based cache.
B - The second-level cache can be configured on a per-class and per-collection basis.
C - The second-level cache is mainly responsible for caching objects across sessions.
Answer : D
Explaination
Second level cache is an optional cache and first-level cache will always be consulted before any attempt is made to locate an object in the second-level cache. The second-level cache can be configured on a per-class and per-collection basis and mainly responsible for caching objects across sessions.
Q 8 - Which of the following database is supported by Hibernate?
Answer : D
Explaination
All of the above mentioned databases are supported by Hibernate.
Answer : A
Explaination
Configuration object is used to create a SessionFactory object.
Q 10 - Which of the following is true about INSERT CLAUSE in HQL?
B - HQL supports INSERT INTO clause without any restriction.
Answer : A
Explaination
HQL supports INSERT INTO clause only where records can be inserted from one object to another object.