- 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 database is not supported by Hibernate?
Answer : C
Explaination
FoundationDB is a NoSQL database and is not supported by Hibernate.
Q 2 - Which of the following object is used to create SessionFactory object in hibernate?
Answer : A
Explaination
Configuration object is used to create a SessionFactory object.
Q 3 - Which of the following is true about transient state of a persistent entity?
A - A new instance of a persistent class which is not associated with a Session.
B - A new instance of a persistent class which has no representation in the database.
C - A new instance of a persistent class which has no identifier value.
Answer : D
Explaination
A new instance of a a persistent class which is not associated with a Session and has no representation in the database and no identifier value is considered transient by Hibernate.
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.Map property in hibernate?
Answer : D
Explaination
java.util.Map property is mapped with a <map> element and initialized with java.util.HashMap.
Q 6 - What is lazy loading?
A - Lazy loading is a technique in which objects are loaded on demand basis.
B - Lazy loading is a technique in which objects are persisted on demand basis.
Answer : A
Explaination
Lazy loading is a technique in which objects are loaded on demand basis.
Q 7 - What HQL stands for?
Answer : A
Explaination
HQL stands for Hibernate Query Language.
Q 8 - Which of the following is true about query level cache in hibernate?
A - Query level cache is an optional feature.
C - Query level cache is only useful for queries that are run frequently with the same parameters.
Answer : D
Explaination
Query level cache is an optional feature and requires two additional physical cache regions that hold the cached query results and the timestamps when a table was last updated. This is only useful for queries that are run frequently with the same parameters.
Answer : A
Explaination
A Session is used to get a physical connection with a database.
Q 10 - Which of the following is true about @GeneratedValue annotation?
A - @GeneratedValue annotation takes two parameters strategy and generator.
B - @GeneratedValue annotation provides the primary key generation strategy to be used.
Answer : C
Explaination
By default, the @Id annotation will automatically determine the most appropriate primary key generation strategy to be used but you can override this by applying the @GeneratedValue annotation which takes two parameters strategy and generator.